Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h

Issue 2826423003: Expand Chrome OS ARC support to create one tree source per package (Closed)
Patch Set: Final touches/nits. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 9
10 #include "chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h"
11 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
10 #include "components/arc/arc_service.h" 12 #include "components/arc/arc_service.h"
11 #include "components/arc/common/accessibility_helper.mojom.h" 13 #include "components/arc/common/accessibility_helper.mojom.h"
12 #include "components/arc/instance_holder.h" 14 #include "components/arc/instance_holder.h"
13 #include "components/exo/wm_helper.h" 15 #include "components/exo/wm_helper.h"
14 #include "mojo/public/cpp/bindings/binding.h" 16 #include "mojo/public/cpp/bindings/binding.h"
15 #include "ui/accessibility/ax_host_delegate.h" 17 #include "ui/accessibility/ax_host_delegate.h"
16 18
17 namespace views {
18
19 class View;
20
21 } // namespace views
22
23 namespace arc { 19 namespace arc {
24 20
25 class ArcBridgeService; 21 class ArcBridgeService;
26 class AXTreeSourceArc; 22 class AXTreeSourceArc;
27 23
28 // ArcAccessibilityHelperBridge is an instance to receive converted Android 24 // ArcAccessibilityHelperBridge is an instance to receive converted Android
29 // accessibility events and info via mojo interface and dispatch them to chrome 25 // accessibility events and info via mojo interface and dispatch them to chrome
30 // os components. 26 // os components.
31 class ArcAccessibilityHelperBridge 27 class ArcAccessibilityHelperBridge
32 : public ArcService, 28 : public ArcService,
33 public mojom::AccessibilityHelperHost, 29 public mojom::AccessibilityHelperHost,
34 public InstanceHolder<mojom::AccessibilityHelperInstance>::Observer, 30 public InstanceHolder<mojom::AccessibilityHelperInstance>::Observer,
35 public exo::WMHelper::ActivationObserver, 31 public exo::WMHelper::ActivationObserver,
36 public ui::AXHostDelegate { 32 public AXTreeSourceArc::Delegate,
33 public ArcAppListPrefs::Observer {
37 public: 34 public:
38 explicit ArcAccessibilityHelperBridge(ArcBridgeService* bridge_service); 35 explicit ArcAccessibilityHelperBridge(ArcBridgeService* bridge_service);
39 ~ArcAccessibilityHelperBridge() override; 36 ~ArcAccessibilityHelperBridge() override;
40 37
41 // InstanceHolder<mojom::AccessibilityHelperInstance>::Observer overrides. 38 // InstanceHolder<mojom::AccessibilityHelperInstance>::Observer overrides.
42 void OnInstanceReady() override; 39 void OnInstanceReady() override;
43 40
44 // mojom::AccessibilityHelperHost overrides. 41 // mojom::AccessibilityHelperHost overrides.
45 void OnAccessibilityEventDeprecated( 42 void OnAccessibilityEventDeprecated(
46 mojom::AccessibilityEventType event_type, 43 mojom::AccessibilityEventType event_type,
47 mojom::AccessibilityNodeInfoDataPtr event_source) override; 44 mojom::AccessibilityNodeInfoDataPtr event_source) override;
48 void OnAccessibilityEvent( 45 void OnAccessibilityEvent(
49 mojom::AccessibilityEventDataPtr event_data) override; 46 mojom::AccessibilityEventDataPtr event_data) override;
50 47
48 // AXTreeSourceArc::Delegate overrides.
49 void OnAction(const ui::AXActionData& data) const override;
50
51 // ArcAppListPrefs::Observer overrides.
52 void OnTaskCreated(int task_id,
53 const std::string& package_name,
54 const std::string& activity,
55 const std::string& intent) override;
56 void OnTaskDestroyed(int task_id) override;
dcheng 2017/05/10 06:36:42 Nit: the interface should be consistent about int3
David Tseng 2017/05/10 21:01:19 Done.
57 void OnTaskSetActive(int32_t task_id) override;
58
59 const std::map<std::string, std::unique_ptr<AXTreeSourceArc>>&
60 package_name_to_tree_for_test() {
61 return package_name_to_tree_;
62 }
63 const std::map<std::string, std::set<int32_t>>&
64 package_name_to_task_ids_for_test() {
65 return package_name_to_task_ids_;
66 }
67
51 private: 68 private:
52 // exo::WMHelper::ActivationObserver overrides. 69 // exo::WMHelper::ActivationObserver overrides.
53 void OnWindowActivated(aura::Window* gained_active, 70 void OnWindowActivated(aura::Window* gained_active,
54 aura::Window* lost_active) override; 71 aura::Window* lost_active) override;
55 72
56 // AXHostDelegate overrides.
57 void PerformAction(const ui::AXActionData& data) override;
58
59 mojo::Binding<mojom::AccessibilityHelperHost> binding_; 73 mojo::Binding<mojom::AccessibilityHelperHost> binding_;
60 74
61 std::unique_ptr<AXTreeSourceArc> tree_source_; 75 std::map<std::string, std::unique_ptr<AXTreeSourceArc>> package_name_to_tree_;
dcheng 2017/05/10 06:36:42 For IWYU, please #include <map>, <string>, <set>
David Tseng 2017/05/10 21:01:19 Done.
62 std::unique_ptr<views::View> focus_stealer_; 76 std::map<std::string, std::set<int32_t>> package_name_to_task_ids_;
77 int32_t current_task_id_;
63 78
64 DISALLOW_COPY_AND_ASSIGN(ArcAccessibilityHelperBridge); 79 DISALLOW_COPY_AND_ASSIGN(ArcAccessibilityHelperBridge);
65 }; 80 };
66 81
67 } // namespace arc 82 } // namespace arc
68 83
69 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BR IDGE_H_ 84 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BR IDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698