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> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 virtual void NativeAddReference() { } | 187 virtual void NativeAddReference() { } |
188 | 188 |
189 // Subclasses should override this to support platform reference counting. | 189 // Subclasses should override this to support platform reference counting. |
190 virtual void NativeReleaseReference(); | 190 virtual void NativeReleaseReference(); |
191 | 191 |
192 // | 192 // |
193 // Accessors | 193 // Accessors |
194 // | 194 // |
195 | 195 |
196 BrowserAccessibilityManager* manager() const { return manager_; } | 196 BrowserAccessibilityManager* manager() const { return manager_; } |
197 bool instance_active() const { return node_ != NULL; } | 197 bool instance_active() const { return node_ && manager_; } |
198 ui::AXNode* node() const { return node_; } | 198 ui::AXNode* node() const { return node_; } |
199 int32_t unique_id() const { return unique_id_; } | 199 int32_t unique_id() const { return unique_id_; } |
200 | 200 |
201 // These access the internal accessibility tree, which doesn't necessarily | 201 // These access the internal accessibility tree, which doesn't necessarily |
202 // reflect the accessibility tree that should be exposed on each platform. | 202 // reflect the accessibility tree that should be exposed on each platform. |
203 // Use PlatformChildCount and PlatformGetChild to implement platform | 203 // Use PlatformChildCount and PlatformGetChild to implement platform |
204 // accessibility APIs. | 204 // accessibility APIs. |
205 uint32_t InternalChildCount() const; | 205 uint32_t InternalChildCount() const; |
206 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; | 206 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; |
207 BrowserAccessibility* InternalGetParent() const; | 207 BrowserAccessibility* InternalGetParent() const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // either std::string or base::string16, for convenience. | 239 // either std::string or base::string16, for convenience. |
240 | 240 |
241 bool HasBoolAttribute(ui::AXBoolAttribute attr) const; | 241 bool HasBoolAttribute(ui::AXBoolAttribute attr) const; |
242 bool GetBoolAttribute(ui::AXBoolAttribute attr) const; | 242 bool GetBoolAttribute(ui::AXBoolAttribute attr) const; |
243 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const; | 243 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const; |
244 | 244 |
245 bool HasFloatAttribute(ui::AXFloatAttribute attr) const; | 245 bool HasFloatAttribute(ui::AXFloatAttribute attr) const; |
246 float GetFloatAttribute(ui::AXFloatAttribute attr) const; | 246 float GetFloatAttribute(ui::AXFloatAttribute attr) const; |
247 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const; | 247 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const; |
248 | 248 |
| 249 bool HasInheritedStringAttribute(ui::AXStringAttribute attribute) const; |
| 250 const std::string& GetInheritedStringAttribute( |
| 251 ui::AXStringAttribute attribute) const; |
| 252 bool GetInheritedStringAttribute(ui::AXStringAttribute attribute, |
| 253 std::string* value) const; |
| 254 |
| 255 base::string16 GetInheritedString16Attribute( |
| 256 ui::AXStringAttribute attribute) const; |
| 257 bool GetInheritedString16Attribute(ui::AXStringAttribute attribute, |
| 258 base::string16* value) const; |
| 259 |
249 bool HasIntAttribute(ui::AXIntAttribute attribute) const; | 260 bool HasIntAttribute(ui::AXIntAttribute attribute) const; |
250 int GetIntAttribute(ui::AXIntAttribute attribute) const; | 261 int GetIntAttribute(ui::AXIntAttribute attribute) const; |
251 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const; | 262 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const; |
252 | 263 |
253 bool HasStringAttribute( | 264 bool HasStringAttribute( |
254 ui::AXStringAttribute attribute) const; | 265 ui::AXStringAttribute attribute) const; |
255 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; | 266 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; |
256 bool GetStringAttribute(ui::AXStringAttribute attribute, | 267 bool GetStringAttribute(ui::AXStringAttribute attribute, |
257 std::string* value) const; | 268 std::string* value) const; |
258 | 269 |
| 270 base::string16 GetString16Attribute( |
| 271 ui::AXStringAttribute attribute) const; |
259 bool GetString16Attribute(ui::AXStringAttribute attribute, | 272 bool GetString16Attribute(ui::AXStringAttribute attribute, |
260 base::string16* value) const; | 273 base::string16* value) const; |
261 base::string16 GetString16Attribute( | |
262 ui::AXStringAttribute attribute) const; | |
263 | 274 |
264 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; | 275 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; |
265 const std::vector<int32_t>& GetIntListAttribute( | 276 const std::vector<int32_t>& GetIntListAttribute( |
266 ui::AXIntListAttribute attribute) const; | 277 ui::AXIntListAttribute attribute) const; |
267 bool GetIntListAttribute(ui::AXIntListAttribute attribute, | 278 bool GetIntListAttribute(ui::AXIntListAttribute attribute, |
268 std::vector<int32_t>* value) const; | 279 std::vector<int32_t>* value) const; |
269 | 280 |
270 // Retrieve the value of a html attribute from the attribute map and | 281 // Retrieve the value of a html attribute from the attribute map and |
271 // returns true if found. | 282 // returns true if found. |
272 bool GetHtmlAttribute(const char* attr, base::string16* value) const; | 283 bool GetHtmlAttribute(const char* attr, base::string16* value) const; |
273 bool GetHtmlAttribute(const char* attr, std::string* value) const; | 284 bool GetHtmlAttribute(const char* attr, std::string* value) const; |
274 | 285 |
275 // Utility method to handle special cases for ARIA booleans, tristates and | 286 // Utility method to handle special cases for ARIA booleans, tristates and |
276 // booleans which have a "mixed" state. | 287 // booleans which have a "mixed" state. |
277 // | 288 // |
278 // Warning: the term "Tristate" is used loosely by the spec and here, | 289 // Warning: the term "Tristate" is used loosely by the spec and here, |
279 // as some attributes support a 4th state. | 290 // as some attributes support a 4th state. |
280 // | 291 // |
281 // The following attributes are appropriate to use with this method: | 292 // The following attributes are appropriate to use with this method: |
282 // aria-selected (selectable) | 293 // aria-selected (selectable) |
283 // aria-grabbed (grabbable) | 294 // aria-grabbed (grabbable) |
284 // aria-expanded (expandable) | 295 // aria-expanded (expandable) |
285 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state | 296 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state |
286 // aria-checked (checkable) -- supports 4th "mixed state" | 297 // aria-checked (checkable) -- supports 4th "mixed state" |
287 bool GetAriaTristate(const char* attr_name, | 298 bool GetAriaTristate(const char* attr_name, |
288 bool* is_defined, | 299 bool* is_defined, |
289 bool* is_mixed) const; | 300 bool* is_mixed) const; |
290 | 301 |
| 302 base::string16 GetFontFamily() const; |
| 303 base::string16 GetLanguage() const; |
291 virtual base::string16 GetText() const; | 304 virtual base::string16 GetText() const; |
292 | 305 |
293 // Returns true if the bit corresponding to the given state enum is 1. | 306 // Returns true if the bit corresponding to the given state enum is 1. |
294 bool HasState(ui::AXState state_enum) const; | 307 bool HasState(ui::AXState state_enum) const; |
295 | 308 |
296 // Returns true if this node is an cell or an table header. | 309 // Returns true if this node is an cell or an table header. |
297 bool IsCellOrTableHeaderRole() const; | 310 bool IsCellOrTableHeaderRole() const; |
298 | 311 |
299 // Returns true if the caret is active on this object. | 312 // Returns true if the caret is active on this object. |
300 bool HasCaret() const; | 313 bool HasCaret() const; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // its nearest scrollable ancestor) to local bounds (which are relative | 356 // its nearest scrollable ancestor) to local bounds (which are relative |
344 // to the top of the web accessibility tree). | 357 // to the top of the web accessibility tree). |
345 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; | 358 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; |
346 | 359 |
347 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 360 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
348 }; | 361 }; |
349 | 362 |
350 } // namespace content | 363 } // namespace content |
351 | 364 |
352 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 365 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
OLD | NEW |