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