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.
5 #ifndef CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_VIEWS_H_
6 #define CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_VIEWS_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/ash/accessibility/ax_tree_source_views.h"
12 #include "ui/accessibility/ax_tree_serializer.h"
14 template <typename T> struct DefaultSingletonTraits;
18 } // namespace content
21 class AXAuraObjWrapper;
25 // Manages a tree of automation nodes.
26 class AutomationManagerViews {
28 // Get the single instance of this class.
29 static AutomationManagerViews* GetInstance();
31 // Enable automation support for views.
32 void Enable(content::BrowserContext* context);
34 // Disable automation support for views.
37 // Handle an event fired upon a |View|.
38 void HandleEvent(content::BrowserContext* context,
40 ui::AXEvent event_type);
43 friend struct DefaultSingletonTraits<AutomationManagerViews>;
45 AutomationManagerViews();
46 ~AutomationManagerViews();
48 // Reset all state in this manager.
51 void SendEvent(content::BrowserContext* context,
52 views::AXAuraObjWrapper* aura_obj,
53 ui::AXEvent event_type);
55 // Whether automation support for views is enabled.
58 // Holds the active views-based accessibility tree. A tree currently consists
59 // of all views descendant to a |Widget| (see |AXTreeSourceViews|).
60 // A tree becomes active when an event is fired on a descendant view.
61 scoped_ptr <AXTreeSourceViews> current_tree_;
63 // Serializes incremental updates on the currently active tree
65 scoped_ptr<ui::AXTreeSerializer<views::AXAuraObjWrapper*> >
66 current_tree_serializer_;
68 DISALLOW_COPY_AND_ASSIGN(AutomationManagerViews);
71 #endif // CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AUTOMATION_MANAGER_VIEWS_H_