OLD | NEW |
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_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_ASH_H_ | 5 #ifndef CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ |
6 #define CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_ASH_H_ | 6 #define CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad
apter.h" | 10 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad
apter.h" |
11 #include "chrome/browser/ui/ash/accessibility/ax_tree_source_ash.h" | 11 #include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" |
12 #include "ui/accessibility/ax_tree_serializer.h" | 12 #include "ui/accessibility/ax_tree_serializer.h" |
13 | 13 |
14 template <typename T> struct DefaultSingletonTraits; | 14 template <typename T> |
| 15 struct DefaultSingletonTraits; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class BrowserContext; | 18 class BrowserContext; |
18 } // namespace content | 19 } // namespace content |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 class AXAuraObjWrapper; | 22 class AXAuraObjWrapper; |
22 class View; | 23 class View; |
23 } // namespace views | 24 } // namespace views |
24 | 25 |
25 // Manages a tree of automation nodes. | 26 // Manages a tree of automation nodes. |
26 class AutomationManagerAsh : public extensions::AutomationActionAdapter { | 27 class AutomationManagerAura : public extensions::AutomationActionAdapter { |
27 public: | 28 public: |
28 // Get the single instance of this class. | 29 // Get the single instance of this class. |
29 static AutomationManagerAsh* GetInstance(); | 30 static AutomationManagerAura* GetInstance(); |
30 | 31 |
31 // Enable automation support for views. | 32 // Enable automation support for views. |
32 void Enable(content::BrowserContext* context); | 33 void Enable(content::BrowserContext* context); |
33 | 34 |
34 // Disable automation support for views. | 35 // Disable automation support for views. |
35 void Disable(); | 36 void Disable(); |
36 | 37 |
37 // Handle an event fired upon a |View|. | 38 // Handle an event fired upon a |View|. |
38 void HandleEvent(content::BrowserContext* context, | 39 void HandleEvent(content::BrowserContext* context, |
39 views::View* view, | 40 views::View* view, |
40 ui::AXEvent event_type); | 41 ui::AXEvent event_type); |
41 | 42 |
42 void HandleAlert(content::BrowserContext* context, const std::string& text); | 43 void HandleAlert(content::BrowserContext* context, const std::string& text); |
43 | 44 |
44 // AutomationActionAdapter implementation. | 45 // AutomationActionAdapter implementation. |
45 void DoDefault(int32 id) override; | 46 void DoDefault(int32 id) override; |
46 void Focus(int32 id) override; | 47 void Focus(int32 id) override; |
47 void MakeVisible(int32 id) override; | 48 void MakeVisible(int32 id) override; |
48 void SetSelection(int32 id, int32 start, int32 end) override; | 49 void SetSelection(int32 id, int32 start, int32 end) override; |
49 | 50 |
50 protected: | 51 protected: |
51 virtual ~AutomationManagerAsh(); | 52 virtual ~AutomationManagerAura(); |
52 | 53 |
53 private: | 54 private: |
54 friend struct DefaultSingletonTraits<AutomationManagerAsh>; | 55 friend struct DefaultSingletonTraits<AutomationManagerAura>; |
55 | 56 |
56 AutomationManagerAsh(); | 57 AutomationManagerAura(); |
57 | 58 |
58 // Reset all state in this manager. | 59 // Reset all state in this manager. |
59 void ResetSerializer(); | 60 void ResetSerializer(); |
60 | 61 |
61 void SendEvent(content::BrowserContext* context, | 62 void SendEvent(content::BrowserContext* context, |
62 views::AXAuraObjWrapper* aura_obj, | 63 views::AXAuraObjWrapper* aura_obj, |
63 ui::AXEvent event_type); | 64 ui::AXEvent event_type); |
64 | 65 |
65 // Whether automation support for views is enabled. | 66 // Whether automation support for views is enabled. |
66 bool enabled_; | 67 bool enabled_; |
67 | 68 |
68 // Holds the active views-based accessibility tree. A tree currently consists | 69 // Holds the active views-based accessibility tree. A tree currently consists |
69 // of all views descendant to a |Widget| (see |AXTreeSourceViews|). | 70 // of all views descendant to a |Widget| (see |AXTreeSourceViews|). |
70 // A tree becomes active when an event is fired on a descendant view. | 71 // A tree becomes active when an event is fired on a descendant view. |
71 scoped_ptr <AXTreeSourceAsh> current_tree_; | 72 scoped_ptr<AXTreeSourceAura> current_tree_; |
72 | 73 |
73 // Serializes incremental updates on the currently active tree | 74 // Serializes incremental updates on the currently active tree |
74 // |current_tree_|. | 75 // |current_tree_|. |
75 scoped_ptr<ui::AXTreeSerializer<views::AXAuraObjWrapper*> > | 76 scoped_ptr<ui::AXTreeSerializer<views::AXAuraObjWrapper*>> |
76 current_tree_serializer_; | 77 current_tree_serializer_; |
77 | 78 |
78 std::string pending_alert_text_; | 79 std::string pending_alert_text_; |
79 | 80 |
80 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAsh); | 81 bool processing_events_; |
| 82 |
| 83 std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_; |
| 84 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura); |
81 }; | 85 }; |
82 | 86 |
83 #endif // CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_ASH_H_ | 87 #endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ |
OLD | NEW |