blob: b9d6120db87564411a09b79ff7011cd8840c0951 [file] [log] [blame]
Sharon Yang23a8135b2019-09-10 21:10:541// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FUCHSIA_ENGINE_BROWSER_ACCESSIBILITY_BRIDGE_H_
6#define FUCHSIA_ENGINE_BROWSER_ACCESSIBILITY_BRIDGE_H_
7
8#include <fuchsia/accessibility/semantics/cpp/fidl.h>
9#include <fuchsia/math/cpp/fidl.h>
10#include <fuchsia/ui/views/cpp/fidl.h>
11#include <lib/fidl/cpp/binding.h>
12
13#include "base/macros.h"
14#include "fuchsia/engine/web_engine_export.h"
15
16// This class is the intermediate for accessibility between Chrome and Fuchsia.
17// It handles registration to the Fuchsia Semantics Manager, translating events
18// and data structures between the two services, and forwarding actions and
19// events.
20// The lifetime of an instance of AccessibilityBridge is the same as that of a
21// View created by FrameImpl. This class refers to the View via the
22// caller-supplied ViewRef.
23class WEB_ENGINE_EXPORT AccessibilityBridge
24 : public fuchsia::accessibility::semantics::SemanticListener {
25 public:
26 AccessibilityBridge(
27 fuchsia::accessibility::semantics::SemanticsManagerPtr semantics_manager,
28 fuchsia::ui::views::ViewRef view_ref);
29 ~AccessibilityBridge() final;
30
31 private:
32 // fuchsia::accessibility::semantics::SemanticListener implementation.
33 void OnAccessibilityActionRequested(
34 uint32_t node_id,
35 fuchsia::accessibility::semantics::Action action,
36 OnAccessibilityActionRequestedCallback callback) final;
37 void HitTest(fuchsia::math::PointF local_point,
38 HitTestCallback callback) final;
39 void OnSemanticsModeChanged(bool updates_enabled,
40 OnSemanticsModeChangedCallback callback) final;
41
42 fuchsia::accessibility::semantics::SemanticTreePtr tree_ptr_;
43 fidl::Binding<fuchsia::accessibility::semantics::SemanticListener> binding_;
44
45 DISALLOW_COPY_AND_ASSIGN(AccessibilityBridge);
46};
47
48#endif // FUCHSIA_ENGINE_BROWSER_ACCESSIBILITY_BRIDGE_H_