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