Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.h

Issue 10544099: Refactor all accessibility code out of webkit/glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/common/accessibility_node_data.h"
14 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
15 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
16 #include "webkit/glue/webaccessibility.h"
17 17
18 class BrowserAccessibility; 18 class BrowserAccessibility;
19 #if defined(OS_WIN) 19 #if defined(OS_WIN)
20 class BrowserAccessibilityManagerWin; 20 class BrowserAccessibilityManagerWin;
21 #endif 21 #endif
22 22
23 using webkit_glue::WebAccessibility; 23 using content::AccessibilityNodeData;
jam 2012/06/12 00:00:42 ditto
24 24
25 struct AccessibilityHostMsg_NotificationParams; 25 struct AccessibilityHostMsg_NotificationParams;
26 26
27 // Class that can perform actions on behalf of the BrowserAccessibilityManager. 27 // Class that can perform actions on behalf of the BrowserAccessibilityManager.
28 class CONTENT_EXPORT BrowserAccessibilityDelegate { 28 class CONTENT_EXPORT BrowserAccessibilityDelegate {
29 public: 29 public:
30 virtual ~BrowserAccessibilityDelegate() {} 30 virtual ~BrowserAccessibilityDelegate() {}
31 virtual void SetAccessibilityFocus(int acc_obj_id) = 0; 31 virtual void SetAccessibilityFocus(int acc_obj_id) = 0;
32 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0; 32 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0;
33 virtual void AccessibilityScrollToMakeVisible( 33 virtual void AccessibilityScrollToMakeVisible(
(...skipping 15 matching lines...) Expand all
49 virtual BrowserAccessibility* Create(); 49 virtual BrowserAccessibility* Create();
50 }; 50 };
51 51
52 // Manages a tree of BrowserAccessibility objects. 52 // Manages a tree of BrowserAccessibility objects.
53 class CONTENT_EXPORT BrowserAccessibilityManager { 53 class CONTENT_EXPORT BrowserAccessibilityManager {
54 public: 54 public:
55 // Creates the platform specific BrowserAccessibilityManager. Ownership passes 55 // Creates the platform specific BrowserAccessibilityManager. Ownership passes
56 // to the caller. 56 // to the caller.
57 static BrowserAccessibilityManager* Create( 57 static BrowserAccessibilityManager* Create(
58 gfx::NativeView parent_view, 58 gfx::NativeView parent_view,
59 const WebAccessibility& src, 59 const AccessibilityNodeData& src,
60 BrowserAccessibilityDelegate* delegate, 60 BrowserAccessibilityDelegate* delegate,
61 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); 61 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
62 62
63 // Creates the platform specific BrowserAccessibilityManager. Ownership passes 63 // Creates the platform specific BrowserAccessibilityManager. Ownership passes
64 // to the caller. 64 // to the caller.
65 static BrowserAccessibilityManager* CreateEmptyDocument( 65 static BrowserAccessibilityManager* CreateEmptyDocument(
66 gfx::NativeView parent_view, 66 gfx::NativeView parent_view,
67 WebAccessibility::State state, 67 AccessibilityNodeData::State state,
68 BrowserAccessibilityDelegate* delegate, 68 BrowserAccessibilityDelegate* delegate,
69 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); 69 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
70 70
71 virtual ~BrowserAccessibilityManager(); 71 virtual ~BrowserAccessibilityManager();
72 72
73 // Type is enum AccessibilityNotification. 73 // Type is enum AccessibilityNotification.
74 // We pass it as int so that we don't include the message declaration 74 // We pass it as int so that we don't include the message declaration
75 // header here. 75 // header here.
76 virtual void NotifyAccessibilityEvent( 76 virtual void NotifyAccessibilityEvent(
77 int type, 77 int type,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 BrowserAccessibilityManagerWin* ToBrowserAccessibilityManagerWin(); 136 BrowserAccessibilityManagerWin* ToBrowserAccessibilityManagerWin();
137 #endif 137 #endif
138 138
139 // Return the object that has focus, if it's a descandant of the 139 // Return the object that has focus, if it's a descandant of the
140 // given root (inclusive). Does not make a new reference. 140 // given root (inclusive). Does not make a new reference.
141 BrowserAccessibility* GetFocus(BrowserAccessibility* root); 141 BrowserAccessibility* GetFocus(BrowserAccessibility* root);
142 142
143 protected: 143 protected:
144 BrowserAccessibilityManager( 144 BrowserAccessibilityManager(
145 gfx::NativeView parent_view, 145 gfx::NativeView parent_view,
146 const WebAccessibility& src, 146 const AccessibilityNodeData& src,
147 BrowserAccessibilityDelegate* delegate, 147 BrowserAccessibilityDelegate* delegate,
148 BrowserAccessibilityFactory* factory); 148 BrowserAccessibilityFactory* factory);
149 149
150 private: 150 private:
151 // Update an accessibility node with an updated WebAccessibility node 151 // Update an accessibility node with an updated AccessibilityNodeData node
152 // received from the renderer process. When |include_children| is true 152 // received from the renderer process. When |include_children| is true
153 // the node's children will also be updated, otherwise only the node 153 // the node's children will also be updated, otherwise only the node
154 // itself is updated. 154 // itself is updated.
155 void UpdateNode(const WebAccessibility& src, bool include_children); 155 void UpdateNode(const AccessibilityNodeData& src, bool include_children);
156 156
157 // Recursively build a tree of BrowserAccessibility objects from 157 // Recursively build a tree of BrowserAccessibility objects from
158 // the WebAccessibility tree received from the renderer process. 158 // the AccessibilityNodeData tree received from the renderer process.
159 BrowserAccessibility* CreateAccessibilityTree( 159 BrowserAccessibility* CreateAccessibilityTree(
160 BrowserAccessibility* parent, 160 BrowserAccessibility* parent,
161 const WebAccessibility& src, 161 const AccessibilityNodeData& src,
162 int index_in_parent, 162 int index_in_parent,
163 bool send_show_events); 163 bool send_show_events);
164 164
165 protected: 165 protected:
166 // The next unique id for a BrowserAccessibility instance. 166 // The next unique id for a BrowserAccessibility instance.
167 static int32 next_child_id_; 167 static int32 next_child_id_;
168 168
169 // The parent view. 169 // The parent view.
170 gfx::NativeView parent_view_; 170 gfx::NativeView parent_view_;
171 171
(...skipping 12 matching lines...) Expand all
184 // we use internally here. 184 // we use internally here.
185 base::hash_map<int32, int32> renderer_id_to_child_id_map_; 185 base::hash_map<int32, int32> renderer_id_to_child_id_map_;
186 186
187 // A mapping from child IDs to BrowserAccessibility objects. 187 // A mapping from child IDs to BrowserAccessibility objects.
188 base::hash_map<int32, BrowserAccessibility*> child_id_map_; 188 base::hash_map<int32, BrowserAccessibility*> child_id_map_;
189 189
190 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); 190 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
191 }; 191 };
192 192
193 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 193 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698