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

Side by Side Diff: content/browser/accessibility/browser_accessibility.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_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/common/accessibility_node_data.h"
15 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
16 #include "webkit/glue/webaccessibility.h"
17 17
18 class BrowserAccessibilityManager; 18 class BrowserAccessibilityManager;
19 #if defined(OS_MACOSX) && __OBJC__ 19 #if defined(OS_MACOSX) && __OBJC__
20 @class BrowserAccessibilityCocoa; 20 @class BrowserAccessibilityCocoa;
21 #elif defined(OS_WIN) 21 #elif defined(OS_WIN)
22 class BrowserAccessibilityWin; 22 class BrowserAccessibilityWin;
23 #elif defined(TOOLKIT_GTK) 23 #elif defined(TOOLKIT_GTK)
24 class BrowserAccessibilityGtk; 24 class BrowserAccessibilityGtk;
25 #endif 25 #endif
26 26
27 using webkit_glue::WebAccessibility; 27 using content::AccessibilityNodeData;
jam 2012/06/12 00:00:42 this is against the google style guide per http://
dmazzoni 2012/06/12 18:35:33 Done throughout, got rid of "using" in header file
28 typedef std::map<WebAccessibility::BoolAttribute, bool> BoolAttrMap; 28 typedef std::map<AccessibilityNodeData::BoolAttribute, bool> BoolAttrMap;
29 typedef std::map<WebAccessibility::FloatAttribute, float> FloatAttrMap; 29 typedef std::map<AccessibilityNodeData::FloatAttribute, float> FloatAttrMap;
30 typedef std::map<WebAccessibility::IntAttribute, int> IntAttrMap; 30 typedef std::map<AccessibilityNodeData::IntAttribute, int> IntAttrMap;
31 typedef std::map<WebAccessibility::StringAttribute, string16> StringAttrMap; 31 typedef std::map<AccessibilityNodeData::StringAttribute, string16>
32 StringAttrMap;
32 33
33 //////////////////////////////////////////////////////////////////////////////// 34 ////////////////////////////////////////////////////////////////////////////////
34 // 35 //
35 // BrowserAccessibility 36 // BrowserAccessibility
36 // 37 //
37 // Class implementing the cross platform interface for the Browser-Renderer 38 // Class implementing the cross platform interface for the Browser-Renderer
38 // communication of accessibility information, providing accessibility 39 // communication of accessibility information, providing accessibility
39 // to be used by screen readers and other assistive technology (AT). 40 // to be used by screen readers and other assistive technology (AT).
40 // 41 //
41 // An implementation for each platform handles platform specific accessibility 42 // An implementation for each platform handles platform specific accessibility
(...skipping 21 matching lines...) Expand all
63 // Returns true if this is a native platform-specific object, vs a 64 // Returns true if this is a native platform-specific object, vs a
64 // cross-platform generic object. 65 // cross-platform generic object.
65 virtual bool IsNative() const; 66 virtual bool IsNative() const;
66 67
67 // Initialize this object, reading attributes from |src|. Does not 68 // Initialize this object, reading attributes from |src|. Does not
68 // recurse into children of |src| and build the whole subtree. 69 // recurse into children of |src| and build the whole subtree.
69 void PreInitialize(BrowserAccessibilityManager* manager, 70 void PreInitialize(BrowserAccessibilityManager* manager,
70 BrowserAccessibility* parent, 71 BrowserAccessibility* parent,
71 int32 child_id, 72 int32 child_id,
72 int32 index_in_parent, 73 int32 index_in_parent,
73 const WebAccessibility& src); 74 const AccessibilityNodeData& src);
74 75
75 // Add a child of this object. 76 // Add a child of this object.
76 void AddChild(BrowserAccessibility* child); 77 void AddChild(BrowserAccessibility* child);
77 78
78 // Update the parent and index in parent if this node has been moved. 79 // Update the parent and index in parent if this node has been moved.
79 void UpdateParent(BrowserAccessibility* parent, int index_in_parent); 80 void UpdateParent(BrowserAccessibility* parent, int index_in_parent);
80 81
81 // Return true if this object is equal to or a descendant of |ancestor|. 82 // Return true if this object is equal to or a descendant of |ancestor|.
82 bool IsDescendantOf(BrowserAccessibility* ancestor); 83 bool IsDescendantOf(BrowserAccessibility* ancestor);
83 84
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 #if defined(OS_MACOSX) && __OBJC__ 197 #if defined(OS_MACOSX) && __OBJC__
197 BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa(); 198 BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa();
198 #elif defined(OS_WIN) 199 #elif defined(OS_WIN)
199 BrowserAccessibilityWin* ToBrowserAccessibilityWin(); 200 BrowserAccessibilityWin* ToBrowserAccessibilityWin();
200 #elif defined(TOOLKIT_GTK) 201 #elif defined(TOOLKIT_GTK)
201 BrowserAccessibilityGtk* ToBrowserAccessibilityGtk(); 202 BrowserAccessibilityGtk* ToBrowserAccessibilityGtk();
202 #endif 203 #endif
203 204
204 // Retrieve the value of a bool attribute from the bool attribute 205 // Retrieve the value of a bool attribute from the bool attribute
205 // map and returns true if found. 206 // map and returns true if found.
206 bool GetBoolAttribute(WebAccessibility::BoolAttribute attr, bool* value) 207 bool GetBoolAttribute(AccessibilityNodeData::BoolAttribute attr, bool* value)
207 const; 208 const;
208 209
209 // Retrieve the value of a float attribute from the float attribute 210 // Retrieve the value of a float attribute from the float attribute
210 // map and returns true if found. 211 // map and returns true if found.
211 bool GetFloatAttribute(WebAccessibility::FloatAttribute attr, float* value) 212 bool GetFloatAttribute(AccessibilityNodeData::FloatAttribute attr,
212 const; 213 float* value) const;
213 214
214 // Retrieve the value of an integer attribute from the integer attribute 215 // Retrieve the value of an integer attribute from the integer attribute
215 // map and returns true if found. 216 // map and returns true if found.
216 bool GetIntAttribute(WebAccessibility::IntAttribute attribute, int* value) 217 bool GetIntAttribute(AccessibilityNodeData::IntAttribute attribute,
217 const; 218 int* value) const;
218 219
219 // Retrieve the value of a string attribute from the attribute map and 220 // Retrieve the value of a string attribute from the attribute map and
220 // returns true if found. 221 // returns true if found.
221 bool GetStringAttribute(WebAccessibility::StringAttribute attribute, 222 bool GetStringAttribute(AccessibilityNodeData::StringAttribute attribute,
222 string16* value) const; 223 string16* value) const;
223 224
224 // Retrieve the value of a html attribute from the attribute map and 225 // Retrieve the value of a html attribute from the attribute map and
225 // returns true if found. 226 // returns true if found.
226 bool GetHtmlAttribute(const char* attr, string16* value) const; 227 bool GetHtmlAttribute(const char* attr, string16* value) const;
227 228
228 // Utility method to handle special cases for ARIA booleans, tristates and 229 // Utility method to handle special cases for ARIA booleans, tristates and
229 // booleans which have a "mixed" state. 230 // booleans which have a "mixed" state.
230 // 231 //
231 // Warning: the term "Tristate" is used loosely by the spec and here, 232 // Warning: the term "Tristate" is used loosely by the spec and here,
232 // as some attributes support a 4th state. 233 // as some attributes support a 4th state.
233 // 234 //
234 // The following attributes are appropriate to use with this method: 235 // The following attributes are appropriate to use with this method:
235 // aria-selected (selectable) 236 // aria-selected (selectable)
236 // aria-grabbed (grabbable) 237 // aria-grabbed (grabbable)
237 // aria-expanded (expandable) 238 // aria-expanded (expandable)
238 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state 239 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state
239 // aria-checked (checkable) -- supports 4th "mixed state" 240 // aria-checked (checkable) -- supports 4th "mixed state"
240 bool GetAriaTristate(const char* attr_name, 241 bool GetAriaTristate(const char* attr_name,
241 bool* is_defined, 242 bool* is_defined,
242 bool* is_mixed) const; 243 bool* is_mixed) const;
243 244
244 // Returns true if the bit corresponding to the given state enum is 1. 245 // Returns true if the bit corresponding to the given state enum is 1.
245 bool HasState(WebAccessibility::State state_enum) const; 246 bool HasState(AccessibilityNodeData::State state_enum) const;
246 247
247 // Returns true if this node is an editable text field of any kind. 248 // Returns true if this node is an editable text field of any kind.
248 bool IsEditableText() const; 249 bool IsEditableText() const;
249 250
250 // Append the text from this node and its children. 251 // Append the text from this node and its children.
251 string16 GetTextRecursive() const; 252 string16 GetTextRecursive() const;
252 253
253 protected: 254 protected:
254 // Perform platform specific initialization. This can be called multiple times 255 // Perform platform specific initialization. This can be called multiple times
255 // during the lifetime of this instance after the members of this base object 256 // during the lifetime of this instance after the members of this base object
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // tree, a client may still be holding onto a pointer to this object, so 304 // tree, a client may still be holding onto a pointer to this object, so
304 // we mark it as inactive so that calls to any of this object's methods 305 // we mark it as inactive so that calls to any of this object's methods
305 // immediately return failure. 306 // immediately return failure.
306 bool instance_active_; 307 bool instance_active_;
307 308
308 private: 309 private:
309 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 310 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
310 }; 311 };
311 312
312 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 313 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698