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

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: One tree per app. Created 3 years, 8 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 { 19 namespace views {
18 20
19 class View; 21 class View;
20 22
21 } // namespace views 23 } // namespace views
22 24
23 namespace arc { 25 namespace arc {
24 26
25 class ArcBridgeService; 27 class ArcBridgeService;
26 class AXTreeSourceArc; 28 class AXTreeSourceArc;
27 29
28 // ArcAccessibilityHelperBridge is an instance to receive converted Android 30 // ArcAccessibilityHelperBridge is an instance to receive converted Android
29 // accessibility events and info via mojo interface and dispatch them to chrome 31 // accessibility events and info via mojo interface and dispatch them to chrome
30 // os components. 32 // os components.
31 class ArcAccessibilityHelperBridge 33 class ArcAccessibilityHelperBridge
32 : public ArcService, 34 : public ArcService,
33 public mojom::AccessibilityHelperHost, 35 public mojom::AccessibilityHelperHost,
34 public InstanceHolder<mojom::AccessibilityHelperInstance>::Observer, 36 public InstanceHolder<mojom::AccessibilityHelperInstance>::Observer,
35 public exo::WMHelper::ActivationObserver, 37 public exo::WMHelper::ActivationObserver,
36 public ui::AXHostDelegate { 38 public AXTreeSourceArc::Delegate,
39 public ArcAppListPrefs::Observer {
37 public: 40 public:
38 explicit ArcAccessibilityHelperBridge(ArcBridgeService* bridge_service); 41 explicit ArcAccessibilityHelperBridge(ArcBridgeService* bridge_service);
39 ~ArcAccessibilityHelperBridge() override; 42 ~ArcAccessibilityHelperBridge() override;
40 43
41 // InstanceHolder<mojom::AccessibilityHelperInstance>::Observer overrides. 44 // InstanceHolder<mojom::AccessibilityHelperInstance>::Observer overrides.
42 void OnInstanceReady() override; 45 void OnInstanceReady() override;
43 46
44 // mojom::AccessibilityHelperHost overrides. 47 // mojom::AccessibilityHelperHost overrides.
45 void OnAccessibilityEventDeprecated( 48 void OnAccessibilityEventDeprecated(
46 mojom::AccessibilityEventType event_type, 49 mojom::AccessibilityEventType event_type,
47 mojom::AccessibilityNodeInfoDataPtr event_source) override; 50 mojom::AccessibilityNodeInfoDataPtr event_source) override;
48 void OnAccessibilityEvent( 51 void OnAccessibilityEvent(
49 mojom::AccessibilityEventDataPtr event_data) override; 52 mojom::AccessibilityEventDataPtr event_data) override;
50 53
54 // AXTreeSourceArc::Delegate overrides.
55 void OnAction(const ui::AXActionData& data) override;
56
51 private: 57 private:
52 // exo::WMHelper::ActivationObserver overrides. 58 // exo::WMHelper::ActivationObserver overrides.
53 void OnWindowActivated(aura::Window* gained_active, 59 void OnWindowActivated(aura::Window* gained_active,
54 aura::Window* lost_active) override; 60 aura::Window* lost_active) override;
55 61
56 // AXHostDelegate overrides. 62 // ArcAppListPrefs::Observer overrides.
57 void PerformAction(const ui::AXActionData& data) override; 63 void OnTaskCreated(int task_id,
64 const std::string& package_name,
65 const std::string& activity,
66 const std::string& intent) override;
67 void OnTaskDestroyed(int task_id) override;
68 void OnTaskSetActive(int32_t task_id) override;
58 69
59 mojo::Binding<mojom::AccessibilityHelperHost> binding_; 70 mojo::Binding<mojom::AccessibilityHelperHost> binding_;
60 71
61 std::unique_ptr<AXTreeSourceArc> tree_source_; 72 std::map<int32_t, AXTreeSourceArc*> task_id_to_tree_;
Luis Héctor Chávez 2017/04/25 15:27:00 consider using std::map<int32_t, std::unique_ptr<A
David Tseng 2017/04/25 22:48:02 If we trust that ArcAppListPrefs::Observer works a
Luis Héctor Chávez 2017/04/25 23:08:16 Right, the goal is to remove a bit of such trust a
David Tseng 2017/04/26 15:29:52 Ok, if this is the general trend of the codebase,
62 std::unique_ptr<views::View> focus_stealer_; 73 std::map<std::string, int32_t> package_name_to_task_id_;
74 int32_t current_task_id_;
63 75
64 DISALLOW_COPY_AND_ASSIGN(ArcAccessibilityHelperBridge); 76 DISALLOW_COPY_AND_ASSIGN(ArcAccessibilityHelperBridge);
65 }; 77 };
66 78
67 } // namespace arc 79 } // namespace arc
68 80
69 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BR IDGE_H_ 81 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_HELPER_BR IDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698