| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad
apter.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" | 14 #include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" |
| 15 #include "ui/accessibility/ax_tree_serializer.h" | 15 #include "ui/accessibility/ax_tree_serializer.h" |
| 16 #include "ui/views/accessibility/ax_aura_obj_cache.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 template <typename T> | 19 template <typename T> |
| 19 struct DefaultSingletonTraits; | 20 struct DefaultSingletonTraits; |
| 20 } // namespace base | 21 } // namespace base |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 class BrowserContext; | 24 class BrowserContext; |
| 24 } // namespace content | 25 } // namespace content |
| 25 | 26 |
| 26 namespace views { | 27 namespace views { |
| 27 class AXAuraObjWrapper; | 28 class AXAuraObjWrapper; |
| 28 class View; | 29 class View; |
| 29 } // namespace views | 30 } // namespace views |
| 30 | 31 |
| 31 using AuraAXTreeSerializer = | 32 using AuraAXTreeSerializer = |
| 32 ui::AXTreeSerializer<views::AXAuraObjWrapper*, | 33 ui::AXTreeSerializer<views::AXAuraObjWrapper*, |
| 33 ui::AXNodeData, | 34 ui::AXNodeData, |
| 34 ui::AXTreeData>; | 35 ui::AXTreeData>; |
| 35 | 36 |
| 36 // Manages a tree of automation nodes. | 37 // Manages a tree of automation nodes. |
| 37 class AutomationManagerAura : public extensions::AutomationActionAdapter { | 38 class AutomationManagerAura : public extensions::AutomationActionAdapter, |
| 39 views::AXAuraObjCache::Delegate { |
| 38 public: | 40 public: |
| 39 // Get the single instance of this class. | 41 // Get the single instance of this class. |
| 40 static AutomationManagerAura* GetInstance(); | 42 static AutomationManagerAura* GetInstance(); |
| 41 | 43 |
| 42 // Enable automation support for views. | 44 // Enable automation support for views. |
| 43 void Enable(content::BrowserContext* context); | 45 void Enable(content::BrowserContext* context); |
| 44 | 46 |
| 45 // Disable automation support for views. | 47 // Disable automation support for views. |
| 46 void Disable(); | 48 void Disable(); |
| 47 | 49 |
| 48 // Handle an event fired upon a |View|. | 50 // Handle an event fired upon a |View|. |
| 49 void HandleEvent(content::BrowserContext* context, | 51 void HandleEvent(content::BrowserContext* context, |
| 50 views::View* view, | 52 views::View* view, |
| 51 ui::AXEvent event_type); | 53 ui::AXEvent event_type); |
| 52 | 54 |
| 53 void HandleAlert(content::BrowserContext* context, const std::string& text); | 55 void HandleAlert(content::BrowserContext* context, const std::string& text); |
| 54 | 56 |
| 55 // AutomationActionAdapter implementation. | 57 // AutomationActionAdapter implementation. |
| 56 void DoDefault(int32_t id) override; | 58 void DoDefault(int32_t id) override; |
| 57 void Focus(int32_t id) override; | 59 void Focus(int32_t id) override; |
| 58 void MakeVisible(int32_t id) override; | 60 void MakeVisible(int32_t id) override; |
| 59 void SetSelection(int32_t anchor_id, | 61 void SetSelection(int32_t anchor_id, |
| 60 int32_t anchor_offset, | 62 int32_t anchor_offset, |
| 61 int32_t focus_id, | 63 int32_t focus_id, |
| 62 int32_t focus_offset) override; | 64 int32_t focus_offset) override; |
| 63 void ShowContextMenu(int32_t id) override; | 65 void ShowContextMenu(int32_t id) override; |
| 64 | 66 |
| 67 // views::AXAuraObjCache::Delegate implementation. |
| 68 void OnChildWindowRemoved(views::AXAuraObjWrapper* parent) override; |
| 69 |
| 65 private: | 70 private: |
| 66 friend struct base::DefaultSingletonTraits<AutomationManagerAura>; | 71 friend struct base::DefaultSingletonTraits<AutomationManagerAura>; |
| 67 | 72 |
| 68 AutomationManagerAura(); | 73 AutomationManagerAura(); |
| 69 virtual ~AutomationManagerAura(); | 74 virtual ~AutomationManagerAura(); |
| 70 | 75 |
| 71 // Reset all state in this manager. | 76 // Reset all state in this manager. |
| 72 void ResetSerializer(); | 77 void ResetSerializer(); |
| 73 | 78 |
| 74 void SendEvent(content::BrowserContext* context, | 79 void SendEvent(content::BrowserContext* context, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 88 std::unique_ptr<AuraAXTreeSerializer> current_tree_serializer_; | 93 std::unique_ptr<AuraAXTreeSerializer> current_tree_serializer_; |
| 89 | 94 |
| 90 bool processing_events_; | 95 bool processing_events_; |
| 91 | 96 |
| 92 std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_; | 97 std::vector<std::pair<views::AXAuraObjWrapper*, ui::AXEvent>> pending_events_; |
| 93 | 98 |
| 94 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura); | 99 DISALLOW_COPY_AND_ASSIGN(AutomationManagerAura); |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 #endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ | 102 #endif // CHROME_BROWSER_UI_AURA_ACCESSIBILITY_AUTOMATION_MANAGER_AURA_H_ |
| OLD | NEW |