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

Side by Side Diff: chrome/browser/ui/aura/accessibility/automation_manager_aura.h

Issue 2700103004: Initial support for accessibility actions on ARC. (Closed)
Patch Set: Use desktop tree id. Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ 5 #ifndef CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_
6 #define CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ 6 #define CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string>
12 #include <utility>
13 #include <vector>
11 14
12 #include "base/macros.h" 15 #include "base/macros.h"
13 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad apter.h"
14 #include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" 16 #include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h"
17 #include "ui/accessibility/ax_host_delegate.h"
15 #include "ui/accessibility/ax_tree_serializer.h" 18 #include "ui/accessibility/ax_tree_serializer.h"
16 #include "ui/views/accessibility/ax_aura_obj_cache.h" 19 #include "ui/views/accessibility/ax_aura_obj_cache.h"
17 20
18 namespace base { 21 namespace base {
19 template <typename T> 22 template <typename T>
20 struct DefaultSingletonTraits; 23 struct DefaultSingletonTraits;
21 } // namespace base 24 } // namespace base
22 25
23 namespace content { 26 namespace content {
24 class BrowserContext; 27 class BrowserContext;
25 } // namespace content 28 } // namespace content
26 29
27 namespace views { 30 namespace views {
28 class AXAuraObjWrapper; 31 class AXAuraObjWrapper;
29 class View; 32 class View;
30 } // namespace views 33 } // namespace views
31 34
32 using AuraAXTreeSerializer = 35 using AuraAXTreeSerializer =
33 ui::AXTreeSerializer<views::AXAuraObjWrapper*, 36 ui::AXTreeSerializer<views::AXAuraObjWrapper*,
34 ui::AXNodeData, 37 ui::AXNodeData,
35 ui::AXTreeData>; 38 ui::AXTreeData>;
36 39
37 // Manages a tree of automation nodes. 40 // Manages a tree of automation nodes.
38 class AutomationManagerAura : public extensions::AutomationActionAdapter, 41 class AutomationManagerAura : public ui::AXHostDelegate,
39 views::AXAuraObjCache::Delegate { 42 views::AXAuraObjCache::Delegate {
40 public: 43 public:
41 // Get the single instance of this class. 44 // Get the single instance of this class.
42 static AutomationManagerAura* GetInstance(); 45 static AutomationManagerAura* GetInstance();
43 46
44 // Enable automation support for views. 47 // Enable automation support for views.
45 void Enable(content::BrowserContext* context); 48 void Enable(content::BrowserContext* context);
46 49
47 // Disable automation support for views. 50 // Disable automation support for views.
48 void Disable(); 51 void Disable();
49 52
50 // Handle an event fired upon a |View|. 53 // Handle an event fired upon a |View|.
51 void HandleEvent(content::BrowserContext* context, 54 void HandleEvent(content::BrowserContext* context,
52 views::View* view, 55 views::View* view,
53 ui::AXEvent event_type); 56 ui::AXEvent event_type);
54 57
55 void HandleAlert(content::BrowserContext* context, const std::string& text); 58 void HandleAlert(content::BrowserContext* context, const std::string& text);
56 59
57 // AutomationActionAdapter implementation. 60 // AXHostDelegate implementation.
58 void PerformAction(const ui::AXActionData& data) override; 61 void PerformAction(const ui::AXActionData& data) override;
59 62
60 // views::AXAuraObjCache::Delegate implementation. 63 // views::AXAuraObjCache::Delegate implementation.
61 void OnChildWindowRemoved(views::AXAuraObjWrapper* parent) override; 64 void OnChildWindowRemoved(views::AXAuraObjWrapper* parent) override;
62 65
63 protected: 66 protected:
64 AutomationManagerAura(); 67 AutomationManagerAura();
65 virtual ~AutomationManagerAura(); 68 ~AutomationManagerAura() override;
66 69
67 private: 70 private:
68 friend struct base::DefaultSingletonTraits<AutomationManagerAura>; 71 friend struct base::DefaultSingletonTraits<AutomationManagerAura>;
69 72
70 // Reset state in this manager. If |reset_serializer| is true, reset the 73 // Reset state in this manager. If |reset_serializer| is true, reset the
71 // serializer to save memory. 74 // serializer to save memory.
72 void Reset(bool reset_serializer); 75 void Reset(bool reset_serializer);
73 76
74 void SendEvent(content::BrowserContext* context, 77 void SendEvent(content::BrowserContext* context,
75 views::AXAuraObjWrapper* aura_obj, 78 views::AXAuraObjWrapper* aura_obj,
(...skipping 12 matching lines...) Expand all
88 std::unique_ptr<AuraAXTreeSerializer> current_tree_serializer_; 91 std::unique_ptr<AuraAXTreeSerializer> current_tree_serializer_;
89 92
90 bool processing_events_; 93 bool processing_events_;
91 94
92 std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_; 95 std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_;
93 96
94 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura); 97 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura);
95 }; 98 };
96 99
97 #endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ 100 #endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698