blob: a66cac20bb5352574691da459b9764f7978fe0ee [file] [log] [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_SCREEN_AI_PROTO_VISUAL_ANNOTATOR_PROTO_CONVERTOR_H_
#define SERVICES_SCREEN_AI_PROTO_VISUAL_ANNOTATOR_PROTO_CONVERTOR_H_
#include "services/screen_ai/proto/chrome_screen_ai.pb.h"
#include "services/screen_ai/public/mojom/screen_ai_service.mojom.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "ui/accessibility/ax_tree_update.h"
namespace gfx {
class Rect;
} // namespace gfx
#endif // BUILDFLAG(IS_CHROMEOS)
namespace screen_ai {
#if BUILDFLAG(IS_CHROMEOS)
// Converts serialized VisualAnnotation proto from VisualAnnotator to
// AXTreeUpdate. The argument `image_rect` is the bounding box of the image
// from which the visual annotation was created.
ui::AXTreeUpdate VisualAnnotationToAXTreeUpdate(
chrome_screen_ai::VisualAnnotation& visual_annotation,
const gfx::Rect& image_rect);
// Resets the node id generator to start from 1 again.
void ResetNodeIDForTesting();
#endif // BUILDFLAG(IS_CHROMEOS)
// Converts a serialized VisualAnnotation proto into a mojo struct.
mojom::VisualAnnotationPtr ConvertProtoToVisualAnnotation(
const chrome_screen_ai::VisualAnnotation& annotation_proto);
} // namespace screen_ai
#endif // SERVICES_SCREEN_AI_PROTO_VISUAL_ANNOTATOR_PROTO_CONVERTOR_H_