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

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

Issue 116293005: Refactor content/ to use ui::AXNodeData instead of blink. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update content/DEPS instead of subdirs Created 6 years, 11 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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/common/accessibility_node_data.h"
14 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
15 #include "third_party/WebKit/public/web/WebAXEnums.h" 14 #include "third_party/WebKit/public/web/WebAXEnums.h"
15 #include "ui/accessibility/ax_node_data.h"
16 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
17 17
18 struct AccessibilityHostMsg_EventParams; 18 struct AccessibilityHostMsg_EventParams;
19 struct AccessibilityHostMsg_LocationChangeParams; 19 struct AccessibilityHostMsg_LocationChangeParams;
20 20
21 namespace content { 21 namespace content {
22 class BrowserAccessibility; 22 class BrowserAccessibility;
23 #if defined(OS_ANDROID) 23 #if defined(OS_ANDROID)
24 class BrowserAccessibilityManagerAndroid; 24 class BrowserAccessibilityManagerAndroid;
25 #endif 25 #endif
(...skipping 27 matching lines...) Expand all
53 // reference to it. 53 // reference to it.
54 virtual BrowserAccessibility* Create(); 54 virtual BrowserAccessibility* Create();
55 }; 55 };
56 56
57 // Manages a tree of BrowserAccessibility objects. 57 // Manages a tree of BrowserAccessibility objects.
58 class CONTENT_EXPORT BrowserAccessibilityManager { 58 class CONTENT_EXPORT BrowserAccessibilityManager {
59 public: 59 public:
60 // Creates the platform-specific BrowserAccessibilityManager, but 60 // Creates the platform-specific BrowserAccessibilityManager, but
61 // with no parent window pointer. Only useful for unit tests. 61 // with no parent window pointer. Only useful for unit tests.
62 static BrowserAccessibilityManager* Create( 62 static BrowserAccessibilityManager* Create(
63 const AccessibilityNodeData& src, 63 const ui::AXNodeData& src,
64 BrowserAccessibilityDelegate* delegate, 64 BrowserAccessibilityDelegate* delegate,
65 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); 65 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
66 66
67 virtual ~BrowserAccessibilityManager(); 67 virtual ~BrowserAccessibilityManager();
68 68
69 void Initialize(const AccessibilityNodeData src); 69 void Initialize(const ui::AXNodeData src);
70 70
71 static AccessibilityNodeData GetEmptyDocument(); 71 static ui::AXNodeData GetEmptyDocument();
72 72
73 virtual void NotifyAccessibilityEvent( 73 virtual void NotifyAccessibilityEvent(
74 blink::WebAXEvent event_type, BrowserAccessibility* node) { } 74 ui::AXEvent event_type, BrowserAccessibility* node) { }
75 75
76 // Return a pointer to the root of the tree, does not make a new reference. 76 // Return a pointer to the root of the tree, does not make a new reference.
77 BrowserAccessibility* GetRoot(); 77 BrowserAccessibility* GetRoot();
78 78
79 // Removes a node from the manager. 79 // Removes a node from the manager.
80 virtual void RemoveNode(BrowserAccessibility* node); 80 virtual void RemoveNode(BrowserAccessibility* node);
81 81
82 // Return a pointer to the object corresponding to the given renderer_id, 82 // Return a pointer to the object corresponding to the given renderer_id,
83 // does not make a new reference. 83 // does not make a new reference.
84 BrowserAccessibility* GetFromRendererID(int32 renderer_id); 84 BrowserAccessibility* GetFromRendererID(int32 renderer_id);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // True by default, but some platforms want to treat the root 153 // True by default, but some platforms want to treat the root
154 // scroll offsets separately. 154 // scroll offsets separately.
155 virtual bool UseRootScrollOffsetsWhenComputingBounds(); 155 virtual bool UseRootScrollOffsetsWhenComputingBounds();
156 156
157 // For testing only: update the given nodes as if they were 157 // For testing only: update the given nodes as if they were
158 // received from the renderer process in OnAccessibilityEvents. 158 // received from the renderer process in OnAccessibilityEvents.
159 // Takes up to 7 nodes at once so tests don't need to create a vector 159 // Takes up to 7 nodes at once so tests don't need to create a vector
160 // each time. 160 // each time.
161 void UpdateNodesForTesting( 161 void UpdateNodesForTesting(
162 const AccessibilityNodeData& node, 162 const ui::AXNodeData& node,
163 const AccessibilityNodeData& node2 = AccessibilityNodeData(), 163 const ui::AXNodeData& node2 = ui::AXNodeData(),
164 const AccessibilityNodeData& node3 = AccessibilityNodeData(), 164 const ui::AXNodeData& node3 = ui::AXNodeData(),
165 const AccessibilityNodeData& node4 = AccessibilityNodeData(), 165 const ui::AXNodeData& node4 = ui::AXNodeData(),
166 const AccessibilityNodeData& node5 = AccessibilityNodeData(), 166 const ui::AXNodeData& node5 = ui::AXNodeData(),
167 const AccessibilityNodeData& node6 = AccessibilityNodeData(), 167 const ui::AXNodeData& node6 = ui::AXNodeData(),
168 const AccessibilityNodeData& node7 = AccessibilityNodeData()); 168 const ui::AXNodeData& node7 = ui::AXNodeData());
169 169
170 protected: 170 protected:
171 BrowserAccessibilityManager( 171 BrowserAccessibilityManager(
172 BrowserAccessibilityDelegate* delegate, 172 BrowserAccessibilityDelegate* delegate,
173 BrowserAccessibilityFactory* factory); 173 BrowserAccessibilityFactory* factory);
174 174
175 BrowserAccessibilityManager( 175 BrowserAccessibilityManager(
176 const AccessibilityNodeData& src, 176 const ui::AXNodeData& src,
177 BrowserAccessibilityDelegate* delegate, 177 BrowserAccessibilityDelegate* delegate,
178 BrowserAccessibilityFactory* factory); 178 BrowserAccessibilityFactory* factory);
179 179
180 virtual void AddNodeToMap(BrowserAccessibility* node); 180 virtual void AddNodeToMap(BrowserAccessibility* node);
181 181
182 virtual void NotifyRootChanged() {} 182 virtual void NotifyRootChanged() {}
183 183
184 private: 184 private:
185 // The following states keep track of whether or not the 185 // The following states keep track of whether or not the
186 // on-screen keyboard is allowed to be shown. 186 // on-screen keyboard is allowed to be shown.
(...skipping 12 matching lines...) Expand all
199 OSK_ALLOWED_WITHIN_FOCUSED_OBJECT, 199 OSK_ALLOWED_WITHIN_FOCUSED_OBJECT,
200 200
201 // Focus has changed within a tab that's already visible. Allow the 201 // Focus has changed within a tab that's already visible. Allow the
202 // on-screen keyboard to show anytime that a touch event leads to an 202 // on-screen keyboard to show anytime that a touch event leads to an
203 // editable text control getting focus. 203 // editable text control getting focus.
204 OSK_ALLOWED 204 OSK_ALLOWED
205 }; 205 };
206 206
207 // Update a set of nodes using data received from the renderer 207 // Update a set of nodes using data received from the renderer
208 // process. 208 // process.
209 bool UpdateNodes(const std::vector<AccessibilityNodeData>& nodes); 209 bool UpdateNodes(const std::vector<ui::AXNodeData>& nodes);
210 210
211 // Update one node from the tree using data received from the renderer 211 // Update one node from the tree using data received from the renderer
212 // process. Returns true on success, false on fatal error. 212 // process. Returns true on success, false on fatal error.
213 bool UpdateNode(const AccessibilityNodeData& src); 213 bool UpdateNode(const ui::AXNodeData& src);
214 214
215 void SetRoot(BrowserAccessibility* root); 215 void SetRoot(BrowserAccessibility* root);
216 216
217 BrowserAccessibility* CreateNode( 217 BrowserAccessibility* CreateNode(
218 BrowserAccessibility* parent, 218 BrowserAccessibility* parent,
219 int32 renderer_id, 219 int32 renderer_id,
220 int32 index_in_parent); 220 int32 index_in_parent);
221 221
222 protected: 222 protected:
223 // The object that can perform actions on our behalf. 223 // The object that can perform actions on our behalf.
(...skipping 12 matching lines...) Expand all
236 236
237 // A mapping from renderer IDs to BrowserAccessibility objects. 237 // A mapping from renderer IDs to BrowserAccessibility objects.
238 base::hash_map<int32, BrowserAccessibility*> renderer_id_map_; 238 base::hash_map<int32, BrowserAccessibility*> renderer_id_map_;
239 239
240 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); 240 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
241 }; 241 };
242 242
243 } // namespace content 243 } // namespace content
244 244
245 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 245 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698