OLD | NEW |
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 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <utility> | 11 #include <utility> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/basictypes.h" | 14 #include "base/macros.h" |
13 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
14 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
15 #include "build/build_config.h" | 17 #include "build/build_config.h" |
16 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
17 #include "third_party/WebKit/public/web/WebAXEnums.h" | 19 #include "third_party/WebKit/public/web/WebAXEnums.h" |
18 #include "ui/accessibility/ax_node.h" | 20 #include "ui/accessibility/ax_node.h" |
19 #include "ui/accessibility/ax_node_data.h" | 21 #include "ui/accessibility/ax_node_data.h" |
20 #include "ui/accessibility/ax_text_utils.h" | 22 #include "ui/accessibility/ax_text_utils.h" |
21 | 23 |
22 // Set PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL if this platform has | 24 // Set PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL if this platform has |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Returns true if this is a leaf node on this platform, meaning any | 98 // Returns true if this is a leaf node on this platform, meaning any |
97 // children should not be exposed to this platform's native accessibility | 99 // children should not be exposed to this platform's native accessibility |
98 // layer. Each platform subclass should implement this itself. | 100 // layer. Each platform subclass should implement this itself. |
99 // The definition of a leaf may vary depending on the platform, | 101 // The definition of a leaf may vary depending on the platform, |
100 // but a leaf node should never have children that are focusable or | 102 // but a leaf node should never have children that are focusable or |
101 // that might send notifications. | 103 // that might send notifications. |
102 virtual bool PlatformIsLeaf() const; | 104 virtual bool PlatformIsLeaf() const; |
103 | 105 |
104 // Returns the number of children of this object, or 0 if PlatformIsLeaf() | 106 // Returns the number of children of this object, or 0 if PlatformIsLeaf() |
105 // returns true. | 107 // returns true. |
106 uint32 PlatformChildCount() const; | 108 uint32_t PlatformChildCount() const; |
107 | 109 |
108 // Return a pointer to the child at the given index, or NULL for an | 110 // Return a pointer to the child at the given index, or NULL for an |
109 // invalid index. Returns NULL if PlatformIsLeaf() returns true. | 111 // invalid index. Returns NULL if PlatformIsLeaf() returns true. |
110 BrowserAccessibility* PlatformGetChild(uint32 child_index) const; | 112 BrowserAccessibility* PlatformGetChild(uint32_t child_index) const; |
111 | 113 |
112 // Returns true if an ancestor of this node (not including itself) is a | 114 // Returns true if an ancestor of this node (not including itself) is a |
113 // leaf node, meaning that this node is not actually exposed to the | 115 // leaf node, meaning that this node is not actually exposed to the |
114 // platform. | 116 // platform. |
115 bool PlatformIsChildOfLeaf() const; | 117 bool PlatformIsChildOfLeaf() const; |
116 | 118 |
117 BrowserAccessibility* GetPreviousSibling() const; | 119 BrowserAccessibility* GetPreviousSibling() const; |
118 BrowserAccessibility* GetNextSibling() const; | 120 BrowserAccessibility* GetNextSibling() const; |
119 | 121 |
120 // Returns nullptr if there are no children. | 122 // Returns nullptr if there are no children. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // | 183 // |
182 | 184 |
183 BrowserAccessibilityManager* manager() const { return manager_; } | 185 BrowserAccessibilityManager* manager() const { return manager_; } |
184 bool instance_active() const { return node_ != NULL; } | 186 bool instance_active() const { return node_ != NULL; } |
185 ui::AXNode* node() const { return node_; } | 187 ui::AXNode* node() const { return node_; } |
186 | 188 |
187 // These access the internal accessibility tree, which doesn't necessarily | 189 // These access the internal accessibility tree, which doesn't necessarily |
188 // reflect the accessibility tree that should be exposed on each platform. | 190 // reflect the accessibility tree that should be exposed on each platform. |
189 // Use PlatformChildCount and PlatformGetChild to implement platform | 191 // Use PlatformChildCount and PlatformGetChild to implement platform |
190 // accessibility APIs. | 192 // accessibility APIs. |
191 uint32 InternalChildCount() const; | 193 uint32_t InternalChildCount() const; |
192 BrowserAccessibility* InternalGetChild(uint32 child_index) const; | 194 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; |
193 BrowserAccessibility* InternalGetParent() const; | 195 BrowserAccessibility* InternalGetParent() const; |
194 | 196 |
195 BrowserAccessibility* GetParent() const; | 197 BrowserAccessibility* GetParent() const; |
196 int32 GetIndexInParent() const; | 198 int32_t GetIndexInParent() const; |
197 | 199 |
198 int32 GetId() const; | 200 int32_t GetId() const; |
199 const ui::AXNodeData& GetData() const; | 201 const ui::AXNodeData& GetData() const; |
200 gfx::Rect GetLocation() const; | 202 gfx::Rect GetLocation() const; |
201 int32 GetRole() const; | 203 int32_t GetRole() const; |
202 int32 GetState() const; | 204 int32_t GetState() const; |
203 | 205 |
204 typedef base::StringPairs HtmlAttributes; | 206 typedef base::StringPairs HtmlAttributes; |
205 const HtmlAttributes& GetHtmlAttributes() const; | 207 const HtmlAttributes& GetHtmlAttributes() const; |
206 | 208 |
207 // Returns true if this is a native platform-specific object, vs a | 209 // Returns true if this is a native platform-specific object, vs a |
208 // cross-platform generic object. Don't call ToBrowserAccessibilityXXX if | 210 // cross-platform generic object. Don't call ToBrowserAccessibilityXXX if |
209 // IsNative returns false. | 211 // IsNative returns false. |
210 virtual bool IsNative() const; | 212 virtual bool IsNative() const; |
211 | 213 |
212 #if defined(OS_MACOSX) && __OBJC__ | 214 #if defined(OS_MACOSX) && __OBJC__ |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; | 254 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; |
253 bool GetStringAttribute(ui::AXStringAttribute attribute, | 255 bool GetStringAttribute(ui::AXStringAttribute attribute, |
254 std::string* value) const; | 256 std::string* value) const; |
255 | 257 |
256 bool GetString16Attribute(ui::AXStringAttribute attribute, | 258 bool GetString16Attribute(ui::AXStringAttribute attribute, |
257 base::string16* value) const; | 259 base::string16* value) const; |
258 base::string16 GetString16Attribute( | 260 base::string16 GetString16Attribute( |
259 ui::AXStringAttribute attribute) const; | 261 ui::AXStringAttribute attribute) const; |
260 | 262 |
261 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; | 263 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; |
262 const std::vector<int32>& GetIntListAttribute( | 264 const std::vector<int32_t>& GetIntListAttribute( |
263 ui::AXIntListAttribute attribute) const; | 265 ui::AXIntListAttribute attribute) const; |
264 bool GetIntListAttribute(ui::AXIntListAttribute attribute, | 266 bool GetIntListAttribute(ui::AXIntListAttribute attribute, |
265 std::vector<int32>* value) const; | 267 std::vector<int32_t>* value) const; |
266 | 268 |
267 // Retrieve the value of a html attribute from the attribute map and | 269 // Retrieve the value of a html attribute from the attribute map and |
268 // returns true if found. | 270 // returns true if found. |
269 bool GetHtmlAttribute(const char* attr, base::string16* value) const; | 271 bool GetHtmlAttribute(const char* attr, base::string16* value) const; |
270 bool GetHtmlAttribute(const char* attr, std::string* value) const; | 272 bool GetHtmlAttribute(const char* attr, std::string* value) const; |
271 | 273 |
272 // Utility method to handle special cases for ARIA booleans, tristates and | 274 // Utility method to handle special cases for ARIA booleans, tristates and |
273 // booleans which have a "mixed" state. | 275 // booleans which have a "mixed" state. |
274 // | 276 // |
275 // Warning: the term "Tristate" is used loosely by the spec and here, | 277 // Warning: the term "Tristate" is used loosely by the spec and here, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // its nearest scrollable ancestor) to local bounds (which are relative | 334 // its nearest scrollable ancestor) to local bounds (which are relative |
333 // to the top of the web accessibility tree). | 335 // to the top of the web accessibility tree). |
334 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; | 336 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; |
335 | 337 |
336 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 338 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
337 }; | 339 }; |
338 | 340 |
339 } // namespace content | 341 } // namespace content |
340 | 342 |
341 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 343 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
OLD | NEW |