#include "chrome/browser/ui/lens/lens_overlay_proto_converter.h"
#include <vector>
#include "base/strings/utf_string_conversions.h"
#include "base/types/optional_ref.h"
#include "chrome/browser/lens/core/mojom/geometry.mojom.h"
#include "chrome/browser/lens/core/mojom/overlay_object.mojom.h"
#include "chrome/browser/lens/core/mojom/polygon.mojom.h"
#include "chrome/browser/lens/core/mojom/text.mojom-forward.h"
#include "chrome/browser/lens/core/mojom/text.mojom.h"
#include "third_party/icu/source/common/unicode/unistr.h"
#include "third_party/lens_server_proto/lens_overlay_deep_gleam_data.pb.h"
#include "third_party/lens_server_proto/lens_overlay_geometry.pb.h"
#include "third_party/lens_server_proto/lens_overlay_polygon.pb.h"
#include "third_party/lens_server_proto/lens_overlay_server.pb.h"
#include "third_party/lens_server_proto/lens_overlay_service_deps.pb.h"
#include "third_party/lens_server_proto/lens_overlay_text.pb.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/text_utils.h"
namespace lens {
namespace {
lens::mojom::Polygon_VertexOrdering ProtoToMojo(
lens::Polygon::VertexOrdering vertex_ordering) { … }
lens::mojom::Polygon_CoordinateType ProtoToMojo(
lens::CoordinateType coordinate_type) { … }
lens::mojom::Alignment ProtoToMojo(lens::Alignment text_alignment) { … }
lens::mojom::PolygonPtr CreatePolygonMojomFromProto(
const lens::Polygon& proto_polygon) { … }
lens::mojom::GeometryPtr CreateGeometryMojomFromProto(
const lens::Geometry& response_geometry) { … }
lens::mojom::WordPtr CreateWordMojomFromProto(
const lens::TextLayout_Word& proto_word,
lens::WritingDirection writing_direction) { … }
lens::mojom::LinePtr CreateLineMojomFromProto(
const lens::TextLayout_Line& proto_line,
lens::WritingDirection writing_direction) { … }
lens::mojom::BackgroundImageDataPtr CreateBackgroundImageDataMojomFromProto(
lens::TranslationData_BackgroundImageData background_image_data) { … }
lens::mojom::WordPtr CreateTranslatedWordMojomFromProto(
const std::string& translated_text,
const std::string& text_separator,
const gfx::SizeF& word_size,
const gfx::PointF& word_center,
float rotation,
lens::WritingDirection writing_direction) { … }
lens::mojom::TranslatedLinePtr CreateTranslatedLineMojomFromProto(
const lens::TextLayout_Line& proto_line,
const lens::TranslationData_Line& translated_line,
const std::string& line_translation,
const gfx::Size& resized_bitmap_size,
lens::WritingDirection writing_direction) { … }
lens::mojom::TranslatedParagraphPtr CreateTranslatedParagraphMojomFromProto(
const lens::TextLayout_Paragraph& proto_paragraph,
const lens::DeepGleamData& deep_gleam,
const gfx::Size& resized_bitmap_size) { … }
lens::mojom::ParagraphPtr CreateParagraphMojomFromProto(
const lens::TextLayout_Paragraph& proto_paragraph,
base::optional_ref<const lens::DeepGleamData> deep_gleam,
const gfx::Size& resized_bitmap_size) { … }
}
std::vector<lens::mojom::OverlayObjectPtr>
CreateObjectsMojomArrayFromServerResponse(
const lens::LensOverlayServerResponse& response) { … }
lens::mojom::TextPtr CreateTextMojomFromServerResponse(
const lens::LensOverlayServerResponse& response,
const gfx::Size resized_bitmap_size) { … }
}