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_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 "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/aura/accessibility/ax_tree_source_aura.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 #include "ui/aura/window_observer.h" |
13 #include "ui/views/focus/widget_focus_manager.h" | 14 #include "ui/views/focus/widget_focus_manager.h" |
14 | 15 |
15 template <typename T> | 16 template <typename T> |
16 struct DefaultSingletonTraits; | 17 struct DefaultSingletonTraits; |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 class BrowserContext; | 20 class BrowserContext; |
20 } // namespace content | 21 } // namespace content |
21 | 22 |
22 namespace views { | 23 namespace views { |
23 class AXAuraObjWrapper; | 24 class AXAuraObjWrapper; |
24 class View; | 25 class View; |
25 } // namespace views | 26 } // namespace views |
26 | 27 |
27 // Manages a tree of automation nodes. | 28 // Manages a tree of automation nodes. |
28 class AutomationManagerAura : public extensions::AutomationActionAdapter, | 29 class AutomationManagerAura : public extensions::AutomationActionAdapter, |
| 30 public aura::WindowObserver, |
29 public views::WidgetFocusChangeListener { | 31 public views::WidgetFocusChangeListener { |
30 public: | 32 public: |
31 // Get the single instance of this class. | 33 // Get the single instance of this class. |
32 static AutomationManagerAura* GetInstance(); | 34 static AutomationManagerAura* GetInstance(); |
33 | 35 |
34 // Enable automation support for views. | 36 // Enable automation support for views. |
35 void Enable(content::BrowserContext* context); | 37 void Enable(content::BrowserContext* context); |
36 | 38 |
37 // Disable automation support for views. | 39 // Disable automation support for views. |
38 void Disable(); | 40 void Disable(); |
(...skipping 20 matching lines...) Expand all Loading... |
59 | 61 |
60 AutomationManagerAura(); | 62 AutomationManagerAura(); |
61 | 63 |
62 // Reset all state in this manager. | 64 // Reset all state in this manager. |
63 void ResetSerializer(); | 65 void ResetSerializer(); |
64 | 66 |
65 void SendEvent(content::BrowserContext* context, | 67 void SendEvent(content::BrowserContext* context, |
66 views::AXAuraObjWrapper* aura_obj, | 68 views::AXAuraObjWrapper* aura_obj, |
67 ui::AXEvent event_type); | 69 ui::AXEvent event_type); |
68 | 70 |
| 71 // aura::WindowObserver: |
| 72 void OnWindowDestroying(aura::Window* window) override; |
| 73 |
69 // views::WidgetFocusChangeListener: | 74 // views::WidgetFocusChangeListener: |
70 void OnNativeFocusChanged(aura::Window* focused_now) override; | 75 void OnNativeFocusChanged(aura::Window* focused_now) override; |
71 | 76 |
72 // Whether automation support for views is enabled. | 77 // Whether automation support for views is enabled. |
73 bool enabled_; | 78 bool enabled_; |
74 | 79 |
75 // Holds the active views-based accessibility tree. A tree currently consists | 80 // Holds the active views-based accessibility tree. A tree currently consists |
76 // of all views descendant to a |Widget| (see |AXTreeSourceViews|). | 81 // of all views descendant to a |Widget| (see |AXTreeSourceViews|). |
77 // A tree becomes active when an event is fired on a descendant view. | 82 // A tree becomes active when an event is fired on a descendant view. |
78 scoped_ptr<AXTreeSourceAura> current_tree_; | 83 scoped_ptr<AXTreeSourceAura> current_tree_; |
79 | 84 |
80 // Serializes incremental updates on the currently active tree | 85 // Serializes incremental updates on the currently active tree |
81 // |current_tree_|. | 86 // |current_tree_|. |
82 scoped_ptr<ui::AXTreeSerializer<views::AXAuraObjWrapper*>> | 87 scoped_ptr<ui::AXTreeSerializer<views::AXAuraObjWrapper*>> |
83 current_tree_serializer_; | 88 current_tree_serializer_; |
84 | 89 |
85 bool processing_events_; | 90 bool processing_events_; |
86 | 91 |
87 std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_; | 92 std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_; |
88 | 93 |
89 aura::Window* focused_window_; | 94 aura::Window* focused_window_; |
90 | 95 |
91 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura); | 96 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura); |
92 }; | 97 }; |
93 | 98 |
94 #endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ | 99 #endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ |
OLD | NEW |