OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BRIDG
E_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BRIDG
E_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BRIDG
E_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BRIDG
E_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <memory> | 9 #include <memory> |
| 10 #include <set> |
| 11 #include <string> |
9 | 12 |
| 13 #include "chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h" |
| 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
10 #include "components/arc/arc_service.h" | 15 #include "components/arc/arc_service.h" |
11 #include "components/arc/common/accessibility_helper.mojom.h" | 16 #include "components/arc/common/accessibility_helper.mojom.h" |
12 #include "components/arc/instance_holder.h" | 17 #include "components/arc/instance_holder.h" |
13 #include "components/exo/wm_helper.h" | 18 #include "components/exo/wm_helper.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 19 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "ui/accessibility/ax_host_delegate.h" | 20 #include "ui/accessibility/ax_host_delegate.h" |
16 | 21 |
17 namespace views { | |
18 | |
19 class View; | |
20 | |
21 } // namespace views | |
22 | |
23 namespace arc { | 22 namespace arc { |
24 | 23 |
25 class ArcBridgeService; | 24 class ArcBridgeService; |
26 class AXTreeSourceArc; | 25 class AXTreeSourceArc; |
27 | 26 |
28 // ArcAccessibilityHelperBridge is an instance to receive converted Android | 27 // ArcAccessibilityHelperBridge is an instance to receive converted Android |
29 // accessibility events and info via mojo interface and dispatch them to chrome | 28 // accessibility events and info via mojo interface and dispatch them to chrome |
30 // os components. | 29 // os components. |
31 class ArcAccessibilityHelperBridge | 30 class ArcAccessibilityHelperBridge |
32 : public ArcService, | 31 : public ArcService, |
33 public mojom::AccessibilityHelperHost, | 32 public mojom::AccessibilityHelperHost, |
34 public InstanceHolder<mojom::AccessibilityHelperInstance>::Observer, | 33 public InstanceHolder<mojom::AccessibilityHelperInstance>::Observer, |
35 public exo::WMHelper::ActivationObserver, | 34 public exo::WMHelper::ActivationObserver, |
36 public ui::AXHostDelegate { | 35 public AXTreeSourceArc::Delegate, |
| 36 public ArcAppListPrefs::Observer { |
37 public: | 37 public: |
38 explicit ArcAccessibilityHelperBridge(ArcBridgeService* bridge_service); | 38 explicit ArcAccessibilityHelperBridge(ArcBridgeService* bridge_service); |
39 ~ArcAccessibilityHelperBridge() override; | 39 ~ArcAccessibilityHelperBridge() override; |
40 | 40 |
41 // InstanceHolder<mojom::AccessibilityHelperInstance>::Observer overrides. | 41 // InstanceHolder<mojom::AccessibilityHelperInstance>::Observer overrides. |
42 void OnInstanceReady() override; | 42 void OnInstanceReady() override; |
43 | 43 |
44 // mojom::AccessibilityHelperHost overrides. | 44 // mojom::AccessibilityHelperHost overrides. |
45 void OnAccessibilityEventDeprecated( | 45 void OnAccessibilityEventDeprecated( |
46 mojom::AccessibilityEventType event_type, | 46 mojom::AccessibilityEventType event_type, |
47 mojom::AccessibilityNodeInfoDataPtr event_source) override; | 47 mojom::AccessibilityNodeInfoDataPtr event_source) override; |
48 void OnAccessibilityEvent( | 48 void OnAccessibilityEvent( |
49 mojom::AccessibilityEventDataPtr event_data) override; | 49 mojom::AccessibilityEventDataPtr event_data) override; |
50 | 50 |
| 51 // AXTreeSourceArc::Delegate overrides. |
| 52 void OnAction(const ui::AXActionData& data) const override; |
| 53 |
| 54 // ArcAppListPrefs::Observer overrides. |
| 55 void OnTaskCreated(int task_id, |
| 56 const std::string& package_name, |
| 57 const std::string& activity, |
| 58 const std::string& intent) override; |
| 59 void OnTaskDestroyed(int32_t task_id) override; |
| 60 void OnTaskSetActive(int32_t task_id) override; |
| 61 |
| 62 const std::map<std::string, std::unique_ptr<AXTreeSourceArc>>& |
| 63 package_name_to_tree_for_test() { |
| 64 return package_name_to_tree_; |
| 65 } |
| 66 const std::map<std::string, std::set<int32_t>>& |
| 67 package_name_to_task_ids_for_test() { |
| 68 return package_name_to_task_ids_; |
| 69 } |
| 70 |
51 private: | 71 private: |
52 // exo::WMHelper::ActivationObserver overrides. | 72 // exo::WMHelper::ActivationObserver overrides. |
53 void OnWindowActivated(aura::Window* gained_active, | 73 void OnWindowActivated(aura::Window* gained_active, |
54 aura::Window* lost_active) override; | 74 aura::Window* lost_active) override; |
55 | 75 |
56 // AXHostDelegate overrides. | |
57 void PerformAction(const ui::AXActionData& data) override; | |
58 | |
59 mojo::Binding<mojom::AccessibilityHelperHost> binding_; | 76 mojo::Binding<mojom::AccessibilityHelperHost> binding_; |
60 | 77 |
61 std::unique_ptr<AXTreeSourceArc> tree_source_; | 78 std::map<std::string, std::unique_ptr<AXTreeSourceArc>> package_name_to_tree_; |
62 std::unique_ptr<views::View> focus_stealer_; | 79 std::map<std::string, std::set<int32_t>> package_name_to_task_ids_; |
| 80 int32_t current_task_id_; |
63 | 81 |
64 DISALLOW_COPY_AND_ASSIGN(ArcAccessibilityHelperBridge); | 82 DISALLOW_COPY_AND_ASSIGN(ArcAccessibilityHelperBridge); |
65 }; | 83 }; |
66 | 84 |
67 } // namespace arc | 85 } // namespace arc |
68 | 86 |
69 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BR
IDGE_H_ | 87 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BR
IDGE_H_ |
OLD | NEW |