| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 virtual void NativeAddReference() { } | 185 virtual void NativeAddReference() { } |
| 186 | 186 |
| 187 // Subclasses should override this to support platform reference counting. | 187 // Subclasses should override this to support platform reference counting. |
| 188 virtual void NativeReleaseReference(); | 188 virtual void NativeReleaseReference(); |
| 189 | 189 |
| 190 // | 190 // |
| 191 // Accessors | 191 // Accessors |
| 192 // | 192 // |
| 193 | 193 |
| 194 BrowserAccessibilityManager* manager() const { return manager_; } | 194 BrowserAccessibilityManager* manager() const { return manager_; } |
| 195 bool instance_active() const { return node_ != NULL; } | 195 bool instance_active() const { return node_ && manager_; } |
| 196 ui::AXNode* node() const { return node_; } | 196 ui::AXNode* node() const { return node_; } |
| 197 | 197 |
| 198 // These access the internal accessibility tree, which doesn't necessarily | 198 // These access the internal accessibility tree, which doesn't necessarily |
| 199 // reflect the accessibility tree that should be exposed on each platform. | 199 // reflect the accessibility tree that should be exposed on each platform. |
| 200 // Use PlatformChildCount and PlatformGetChild to implement platform | 200 // Use PlatformChildCount and PlatformGetChild to implement platform |
| 201 // accessibility APIs. | 201 // accessibility APIs. |
| 202 uint32_t InternalChildCount() const; | 202 uint32_t InternalChildCount() const; |
| 203 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; | 203 BrowserAccessibility* InternalGetChild(uint32_t child_index) const; |
| 204 BrowserAccessibility* InternalGetParent() const; | 204 BrowserAccessibility* InternalGetParent() const; |
| 205 | 205 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // either std::string or base::string16, for convenience. | 247 // either std::string or base::string16, for convenience. |
| 248 | 248 |
| 249 bool HasBoolAttribute(ui::AXBoolAttribute attr) const; | 249 bool HasBoolAttribute(ui::AXBoolAttribute attr) const; |
| 250 bool GetBoolAttribute(ui::AXBoolAttribute attr) const; | 250 bool GetBoolAttribute(ui::AXBoolAttribute attr) const; |
| 251 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const; | 251 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const; |
| 252 | 252 |
| 253 bool HasFloatAttribute(ui::AXFloatAttribute attr) const; | 253 bool HasFloatAttribute(ui::AXFloatAttribute attr) const; |
| 254 float GetFloatAttribute(ui::AXFloatAttribute attr) const; | 254 float GetFloatAttribute(ui::AXFloatAttribute attr) const; |
| 255 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const; | 255 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const; |
| 256 | 256 |
| 257 bool HasInheritedStringAttribute(ui::AXStringAttribute attribute) const; |
| 258 std::string GetInheritedStringAttribute( |
| 259 ui::AXStringAttribute attribute) const; |
| 260 bool GetInheritedStringAttribute(ui::AXStringAttribute attribute, |
| 261 std::string* value) const; |
| 262 |
| 263 bool GetInheritedString16Attribute(ui::AXStringAttribute attribute, |
| 264 base::string16* value) const; |
| 265 base::string16 GetInheritedString16Attribute( |
| 266 ui::AXStringAttribute attribute) const; |
| 267 |
| 257 bool HasIntAttribute(ui::AXIntAttribute attribute) const; | 268 bool HasIntAttribute(ui::AXIntAttribute attribute) const; |
| 258 int GetIntAttribute(ui::AXIntAttribute attribute) const; | 269 int GetIntAttribute(ui::AXIntAttribute attribute) const; |
| 259 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const; | 270 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const; |
| 260 | 271 |
| 261 bool HasStringAttribute( | 272 bool HasStringAttribute( |
| 262 ui::AXStringAttribute attribute) const; | 273 ui::AXStringAttribute attribute) const; |
| 263 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; | 274 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; |
| 264 bool GetStringAttribute(ui::AXStringAttribute attribute, | 275 bool GetStringAttribute(ui::AXStringAttribute attribute, |
| 265 std::string* value) const; | 276 std::string* value) const; |
| 266 | 277 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 289 // The following attributes are appropriate to use with this method: | 300 // The following attributes are appropriate to use with this method: |
| 290 // aria-selected (selectable) | 301 // aria-selected (selectable) |
| 291 // aria-grabbed (grabbable) | 302 // aria-grabbed (grabbable) |
| 292 // aria-expanded (expandable) | 303 // aria-expanded (expandable) |
| 293 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state | 304 // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state |
| 294 // aria-checked (checkable) -- supports 4th "mixed state" | 305 // aria-checked (checkable) -- supports 4th "mixed state" |
| 295 bool GetAriaTristate(const char* attr_name, | 306 bool GetAriaTristate(const char* attr_name, |
| 296 bool* is_defined, | 307 bool* is_defined, |
| 297 bool* is_mixed) const; | 308 bool* is_mixed) const; |
| 298 | 309 |
| 310 base::string16 GetFontFamily() const; |
| 311 base::string16 GetLanguage() const; |
| 299 virtual base::string16 GetText() const; | 312 virtual base::string16 GetText() const; |
| 300 | 313 |
| 301 // Returns true if the bit corresponding to the given state enum is 1. | 314 // Returns true if the bit corresponding to the given state enum is 1. |
| 302 bool HasState(ui::AXState state_enum) const; | 315 bool HasState(ui::AXState state_enum) const; |
| 303 | 316 |
| 304 // Returns true if this node is an cell or an table header. | 317 // Returns true if this node is an cell or an table header. |
| 305 bool IsCellOrTableHeaderRole() const; | 318 bool IsCellOrTableHeaderRole() const; |
| 306 | 319 |
| 307 // Returns true if the caret is active on this object. | 320 // Returns true if the caret is active on this object. |
| 308 bool HasCaret() const; | 321 bool HasCaret() const; |
| 309 | 322 |
| 310 // True if this is a web area, and its grandparent is a presentational iframe. | 323 // True if this is a web area, and its grandparent is a presentational iframe. |
| 311 bool IsWebAreaForPresentationalIframe() const; | 324 bool IsWebAreaForPresentationalIframe() const; |
| 312 | 325 |
| 313 bool IsControl() const; | 326 bool IsControl() const; |
| 314 bool IsSimpleTextControl() const; | 327 bool IsSimpleTextControl() const; |
| 315 // Indicates if this object is at the root of a rich edit text control. | 328 // Indicates if this object is at the root of a rich edit text control. |
| 316 bool IsRichTextControl() const; | 329 bool IsRichTextControl() const; |
| 317 | 330 |
| 318 // If an object is focusable but has no accessible name, use this | 331 // If an object is focusable but has no accessible name, use this |
| 319 // to compute a name from its descendants. | 332 // to compute a name from its descendants. |
| 320 std::string ComputeAccessibleNameFromDescendants(); | 333 std::string ComputeAccessibleNameFromDescendants(); |
| 321 | 334 |
| 322 protected: | 335 protected: |
| 323 BrowserAccessibility(); | 336 BrowserAccessibility(); |
| 324 | 337 |
| 338 static void RGBAToColorValues(unsigned int color, |
| 339 unsigned int* red, |
| 340 unsigned int* green, |
| 341 unsigned int* blue, |
| 342 unsigned int* alpha); |
| 343 |
| 325 // The manager of this tree of accessibility objects. | 344 // The manager of this tree of accessibility objects. |
| 326 BrowserAccessibilityManager* manager_; | 345 BrowserAccessibilityManager* manager_; |
| 327 | 346 |
| 328 // The underlying node. | 347 // The underlying node. |
| 329 ui::AXNode* node_; | 348 ui::AXNode* node_; |
| 330 | 349 |
| 331 private: | 350 private: |
| 332 // |GetInnerText| recursively includes all the text from descendants such as | 351 // |GetInnerText| recursively includes all the text from descendants such as |
| 333 // text found in any embedded object. In contrast, |GetText| might include a | 352 // text found in any embedded object. In contrast, |GetText| might include a |
| 334 // special character in the place of every embedded object instead of its | 353 // special character in the place of every embedded object instead of its |
| (...skipping 10 matching lines...) Expand all Loading... |
| 345 // its nearest scrollable ancestor) to local bounds (which are relative | 364 // its nearest scrollable ancestor) to local bounds (which are relative |
| 346 // to the top of the web accessibility tree). | 365 // to the top of the web accessibility tree). |
| 347 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; | 366 gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const; |
| 348 | 367 |
| 349 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 368 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 350 }; | 369 }; |
| 351 | 370 |
| 352 } // namespace content | 371 } // namespace content |
| 353 | 372 |
| 354 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 373 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| OLD | NEW |