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

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: More Mac compile errors 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
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 typedef std::map<content::AccessibilityNodeData::BoolAttribute, bool>
28 typedef std::map<WebAccessibility::BoolAttribute, bool> BoolAttrMap; 28 BoolAttrMap;
29 typedef std::map<WebAccessibility::FloatAttribute, float> FloatAttrMap; 29 typedef std::map<content::AccessibilityNodeData::FloatAttribute, float>
30 typedef std::map<WebAccessibility::IntAttribute, int> IntAttrMap; 30 FloatAttrMap;
31 typedef std::map<WebAccessibility::StringAttribute, string16> StringAttrMap; 31 typedef std::map<content::AccessibilityNodeData::IntAttribute, int>
32 IntAttrMap;
33 typedef std::map<content::AccessibilityNodeData::StringAttribute, string16>
34 StringAttrMap;
32 35
33 //////////////////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////////////////
34 // 37 //
35 // BrowserAccessibility 38 // BrowserAccessibility
36 // 39 //
37 // Class implementing the cross platform interface for the Browser-Renderer 40 // Class implementing the cross platform interface for the Browser-Renderer
38 // communication of accessibility information, providing accessibility 41 // communication of accessibility information, providing accessibility
39 // to be used by screen readers and other assistive technology (AT). 42 // to be used by screen readers and other assistive technology (AT).
40 // 43 //
41 // An implementation for each platform handles platform specific accessibility 44 // 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 66 // Returns true if this is a native platform-specific object, vs a
64 // cross-platform generic object. 67 // cross-platform generic object.
65 virtual bool IsNative() const; 68 virtual bool IsNative() const;
66 69
67 // Initialize this object, reading attributes from |src|. Does not 70 // Initialize this object, reading attributes from |src|. Does not
68 // recurse into children of |src| and build the whole subtree. 71 // recurse into children of |src| and build the whole subtree.
69 void PreInitialize(BrowserAccessibilityManager* manager, 72 void PreInitialize(BrowserAccessibilityManager* manager,
70 BrowserAccessibility* parent, 73 BrowserAccessibility* parent,
71 int32 child_id, 74 int32 child_id,
72 int32 index_in_parent, 75 int32 index_in_parent,
73 const WebAccessibility& src); 76 const content::AccessibilityNodeData& src);
74 77
75 // Add a child of this object. 78 // Add a child of this object.
76 void AddChild(BrowserAccessibility* child); 79 void AddChild(BrowserAccessibility* child);
77 80
78 // Update the parent and index in parent if this node has been moved. 81 // Update the parent and index in parent if this node has been moved.
79 void UpdateParent(BrowserAccessibility* parent, int index_in_parent); 82 void UpdateParent(BrowserAccessibility* parent, int index_in_parent);
80 83
81 // Return true if this object is equal to or a descendant of |ancestor|. 84 // Return true if this object is equal to or a descendant of |ancestor|.
82 bool IsDescendantOf(BrowserAccessibility* ancestor); 85 bool IsDescendantOf(BrowserAccessibility* ancestor);
83 86
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 #if defined(OS_MACOSX) && __OBJC__ 199 #if defined(OS_MACOSX) && __OBJC__
197 BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa(); 200 BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa();
198 #elif defined(OS_WIN) 201 #elif defined(OS_WIN)
199 BrowserAccessibilityWin* ToBrowserAccessibilityWin(); 202 BrowserAccessibilityWin* ToBrowserAccessibilityWin();
200 #elif defined(TOOLKIT_GTK) 203 #elif defined(TOOLKIT_GTK)
201 BrowserAccessibilityGtk* ToBrowserAccessibilityGtk(); 204 BrowserAccessibilityGtk* ToBrowserAccessibilityGtk();
202 #endif 205 #endif
203 206
204 // Retrieve the value of a bool attribute from the bool attribute 207 // Retrieve the value of a bool attribute from the bool attribute
205 // map and returns true if found. 208 // map and returns true if found.
206 bool GetBoolAttribute(WebAccessibility::BoolAttribute attr, bool* value) 209 bool GetBoolAttribute(
207 const; 210 content::AccessibilityNodeData::BoolAttribute attr, bool* value) const;
208 211
209 // Retrieve the value of a float attribute from the float attribute 212 // Retrieve the value of a float attribute from the float attribute
210 // map and returns true if found. 213 // map and returns true if found.
211 bool GetFloatAttribute(WebAccessibility::FloatAttribute attr, float* value) 214 bool GetFloatAttribute(content::AccessibilityNodeData::FloatAttribute attr,
212 const; 215 float* value) const;
213 216
214 // Retrieve the value of an integer attribute from the integer attribute 217 // Retrieve the value of an integer attribute from the integer attribute
215 // map and returns true if found. 218 // map and returns true if found.
216 bool GetIntAttribute(WebAccessibility::IntAttribute attribute, int* value) 219 bool GetIntAttribute(content::AccessibilityNodeData::IntAttribute attribute,
217 const; 220 int* value) const;
218 221
219 // Retrieve the value of a string attribute from the attribute map and 222 // Retrieve the value of a string attribute from the attribute map and
220 // returns true if found. 223 // returns true if found.
221 bool GetStringAttribute(WebAccessibility::StringAttribute attribute, 224 bool GetStringAttribute(
222 string16* value) const; 225 content::AccessibilityNodeData::StringAttribute attribute,
226 string16* value) const;
223 227
224 // Retrieve the value of a html attribute from the attribute map and 228 // Retrieve the value of a html attribute from the attribute map and
225 // returns true if found. 229 // returns true if found.
226 bool GetHtmlAttribute(const char* attr, string16* value) const; 230 bool GetHtmlAttribute(const char* attr, string16* value) const;
227 231
228 // Utility method to handle special cases for ARIA booleans, tristates and 232 // Utility method to handle special cases for ARIA booleans, tristates and
229 // booleans which have a "mixed" state. 233 // booleans which have a "mixed" state.
230 // 234 //
231 // Warning: the term "Tristate" is used loosely by the spec and here, 235 // Warning: the term "Tristate" is used loosely by the spec and here,
232 // as some attributes support a 4th state. 236 // as some attributes support a 4th state.
233 // 237 //
234 // The following attributes are appropriate to use with this method: 238 // The following attributes are appropriate to use with this method:
235 // aria-selected (selectable) 239 // aria-selected (selectable)
236 // aria-grabbed (grabbable) 240 // aria-grabbed (grabbable)
237 // aria-expanded (expandable) 241 // aria-expanded (expandable)
238 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state 242 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state
239 // aria-checked (checkable) -- supports 4th "mixed state" 243 // aria-checked (checkable) -- supports 4th "mixed state"
240 bool GetAriaTristate(const char* attr_name, 244 bool GetAriaTristate(const char* attr_name,
241 bool* is_defined, 245 bool* is_defined,
242 bool* is_mixed) const; 246 bool* is_mixed) const;
243 247
244 // Returns true if the bit corresponding to the given state enum is 1. 248 // Returns true if the bit corresponding to the given state enum is 1.
245 bool HasState(WebAccessibility::State state_enum) const; 249 bool HasState(content::AccessibilityNodeData::State state_enum) const;
246 250
247 // Returns true if this node is an editable text field of any kind. 251 // Returns true if this node is an editable text field of any kind.
248 bool IsEditableText() const; 252 bool IsEditableText() const;
249 253
250 // Append the text from this node and its children. 254 // Append the text from this node and its children.
251 string16 GetTextRecursive() const; 255 string16 GetTextRecursive() const;
252 256
253 protected: 257 protected:
254 // Perform platform specific initialization. This can be called multiple times 258 // Perform platform specific initialization. This can be called multiple times
255 // during the lifetime of this instance after the members of this base object 259 // 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 307 // 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 308 // we mark it as inactive so that calls to any of this object's methods
305 // immediately return failure. 309 // immediately return failure.
306 bool instance_active_; 310 bool instance_active_;
307 311
308 private: 312 private:
309 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 313 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
310 }; 314 };
311 315
312 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 316 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698