[email protected] | eaf8a342 | 2012-01-24 23:35:31 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | ba1fa65 | 2011-06-25 05:16:22 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| 6 | #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 7 | |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 8 | #include <map> |
| 9 | #include <utility> |
| 10 | #include <vector> |
| 11 | |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 12 | #include "base/basictypes.h" |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 13 | #include "base/strings/string16.h" |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 14 | #include "build/build_config.h" |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 15 | #include "content/common/content_export.h" |
[email protected] | 10760e4a | 2013-09-04 23:32:20 | [diff] [blame] | 16 | #include "third_party/WebKit/public/web/WebAXEnums.h" |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 17 | #include "ui/accessibility/ax_node_data.h" |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 18 | |
[email protected] | 95b3f544 | 2012-05-06 17:10:07 | [diff] [blame] | 19 | #if defined(OS_MACOSX) && __OBJC__ |
| 20 | @class BrowserAccessibilityCocoa; |
[email protected] | e6b3487 | 2012-10-24 20:51:32 | [diff] [blame] | 21 | #endif |
| 22 | |
| 23 | namespace content { |
| 24 | class BrowserAccessibilityManager; |
| 25 | #if defined(OS_WIN) |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 26 | class BrowserAccessibilityWin; |
[email protected] | cd3e2d90 | 2012-05-09 07:05:20 | [diff] [blame] | 27 | #elif defined(TOOLKIT_GTK) |
| 28 | class BrowserAccessibilityGtk; |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 29 | #endif |
| 30 | |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 31 | //////////////////////////////////////////////////////////////////////////////// |
| 32 | // |
| 33 | // BrowserAccessibility |
| 34 | // |
| 35 | // Class implementing the cross platform interface for the Browser-Renderer |
| 36 | // communication of accessibility information, providing accessibility |
| 37 | // to be used by screen readers and other assistive technology (AT). |
| 38 | // |
| 39 | // An implementation for each platform handles platform specific accessibility |
| 40 | // APIs. |
| 41 | // |
| 42 | //////////////////////////////////////////////////////////////////////////////// |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 43 | class CONTENT_EXPORT BrowserAccessibility { |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 44 | public: |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 45 | // Creates a platform specific BrowserAccessibility. Ownership passes to the |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 46 | // caller. |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 47 | static BrowserAccessibility* Create(); |
| 48 | |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 49 | virtual ~BrowserAccessibility(); |
| 50 | |
[email protected] | b05cd54 | 2011-06-08 01:38:02 | [diff] [blame] | 51 | // Detach all descendants of this subtree and push all of the node pointers, |
| 52 | // including this node, onto the end of |nodes|. |
| 53 | virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes); |
| 54 | |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 55 | // Perform platform-specific initialization. This can be called multiple times |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 56 | // during the lifetime of this instance after the members of this base object |
| 57 | // have been reset with new values from the renderer process. |
[email protected] | a52aa41 | 2011-12-14 19:03:30 | [diff] [blame] | 58 | // Child dependent initialization can be done here. |
| 59 | virtual void PostInitialize() {} |
[email protected] | ee84512 | 2011-09-01 08:44:16 | [diff] [blame] | 60 | |
[email protected] | cd3e2d90 | 2012-05-09 07:05:20 | [diff] [blame] | 61 | // Returns true if this is a native platform-specific object, vs a |
| 62 | // cross-platform generic object. |
| 63 | virtual bool IsNative() const; |
| 64 | |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 65 | // Initialize the tree structure of this object. |
| 66 | void InitializeTreeStructure( |
| 67 | BrowserAccessibilityManager* manager, |
[email protected] | a52aa41 | 2011-12-14 19:03:30 | [diff] [blame] | 68 | BrowserAccessibility* parent, |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 69 | int32 renderer_id, |
| 70 | int32 index_in_parent); |
| 71 | |
| 72 | // Initialize this object's data. |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 73 | void InitializeData(const ui::AXNodeData& src); |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 74 | |
[email protected] | 26aef30 | 2013-03-14 22:43:51 | [diff] [blame] | 75 | virtual void SwapChildren(std::vector<BrowserAccessibility*>& children); |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 76 | |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 77 | // Update the parent and index in parent if this node has been moved. |
| 78 | void UpdateParent(BrowserAccessibility* parent, int index_in_parent); |
| 79 | |
[email protected] | a10a5f8 | 2013-05-06 05:24:56 | [diff] [blame] | 80 | // Update this node's location, leaving everything else the same. |
| 81 | virtual void SetLocation(const gfx::Rect& new_location); |
| 82 | |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 83 | // Return true if this object is equal to or a descendant of |ancestor|. |
| 84 | bool IsDescendantOf(BrowserAccessibility* ancestor); |
| 85 | |
| 86 | // Returns the parent of this object, or NULL if it's the root. |
[email protected] | 7f2d9f6b | 2013-06-13 22:57:01 | [diff] [blame] | 87 | BrowserAccessibility* parent() const { return parent_; } |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 88 | |
| 89 | // Returns the number of children of this object. |
[email protected] | 9c1a75a | 2011-03-10 02:38:12 | [diff] [blame] | 90 | uint32 child_count() const { return children_.size(); } |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 91 | |
[email protected] | 933af8c | 2013-11-01 17:59:40 | [diff] [blame] | 92 | // Returns true if this is a leaf node on this platform, meaning any |
| 93 | // children should not be exposed to this platform's native accessibility |
| 94 | // layer. Each platform subclass should implement this itself. |
| 95 | // The definition of a leaf may vary depending on the platform, |
| 96 | // but a leaf node should never have children that are focusable or |
| 97 | // that might send notifications. |
| 98 | virtual bool PlatformIsLeaf() const; |
| 99 | |
| 100 | // Returns the number of children of this object, or 0 if PlatformIsLeaf() |
| 101 | // returns true. |
| 102 | uint32 PlatformChildCount() const; |
| 103 | |
| 104 | // Return a pointer to the child at the given index, or NULL for an |
| 105 | // invalid index. Returns NULL if PlatformIsLeaf() returns true. |
| 106 | BrowserAccessibility* PlatformGetChild(uint32 child_index) const; |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 107 | |
| 108 | // Return the previous sibling of this object, or NULL if it's the first |
| 109 | // child of its parent. |
| 110 | BrowserAccessibility* GetPreviousSibling(); |
| 111 | |
| 112 | // Return the next sibling of this object, or NULL if it's the last child |
| 113 | // of its parent. |
| 114 | BrowserAccessibility* GetNextSibling(); |
| 115 | |
[email protected] | 9052cca | 2011-11-30 23:59:31 | [diff] [blame] | 116 | // Returns the bounds of this object in coordinates relative to the |
| 117 | // top-left corner of the overall web area. |
[email protected] | 7f2d9f6b | 2013-06-13 22:57:01 | [diff] [blame] | 118 | gfx::Rect GetLocalBoundsRect() const; |
[email protected] | 02747d4e | 2010-11-03 19:10:00 | [diff] [blame] | 119 | |
[email protected] | 9052cca | 2011-11-30 23:59:31 | [diff] [blame] | 120 | // Returns the bounds of this object in screen coordinates. |
[email protected] | 7f2d9f6b | 2013-06-13 22:57:01 | [diff] [blame] | 121 | gfx::Rect GetGlobalBoundsRect() const; |
[email protected] | 9052cca | 2011-11-30 23:59:31 | [diff] [blame] | 122 | |
[email protected] | 516c16a | 2013-11-04 21:32:20 | [diff] [blame] | 123 | // Returns the bounds of the given range in coordinates relative to the |
| 124 | // top-left corner of the overall web area. Only valid when the |
| 125 | // role is WebAXRoleStaticText. |
| 126 | gfx::Rect GetLocalBoundsForRange(int start, int len) const; |
| 127 | |
| 128 | // Same as GetLocalBoundsForRange, in screen coordinates. Only valid when |
| 129 | // the role is WebAXRoleStaticText. |
| 130 | gfx::Rect GetGlobalBoundsForRange(int start, int len) const; |
| 131 | |
[email protected] | 9052cca | 2011-11-30 23:59:31 | [diff] [blame] | 132 | // Returns the deepest descendant that contains the specified point |
| 133 | // (in global screen coordinates). |
[email protected] | 02747d4e | 2010-11-03 19:10:00 | [diff] [blame] | 134 | BrowserAccessibility* BrowserAccessibilityForPoint(const gfx::Point& point); |
| 135 | |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 136 | // Marks this object for deletion, releases our reference to it, and |
| 137 | // recursively calls Destroy() on its children. May not delete |
| 138 | // immediately due to reference counting. |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 139 | // |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 140 | // Reference counting is used on some platforms because the |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 141 | // operating system may hold onto a reference to a BrowserAccessibility |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 142 | // object even after we're through with it. When a BrowserAccessibility |
| 143 | // has had Destroy() called but its reference count is not yet zero, |
| 144 | // queries on this object return failure |
| 145 | virtual void Destroy(); |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 146 | |
| 147 | // Subclasses should override this to support platform reference counting. |
| 148 | virtual void NativeAddReference() { } |
| 149 | |
| 150 | // Subclasses should override this to support platform reference counting. |
[email protected] | 402da9f | 2011-03-08 19:45:41 | [diff] [blame] | 151 | virtual void NativeReleaseReference(); |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 152 | |
| 153 | // |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 154 | // Accessors |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 155 | // |
| 156 | |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 157 | const std::vector<BrowserAccessibility*>& children() const { |
| 158 | return children_; |
| 159 | } |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 160 | const std::vector<std::pair<std::string, std::string> >& |
| 161 | html_attributes() const { |
[email protected] | 0d7dad6 | 2010-10-19 21:18:50 | [diff] [blame] | 162 | return html_attributes_; |
| 163 | } |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 164 | int32 index_in_parent() const { return index_in_parent_; } |
[email protected] | 0aed2f5 | 2011-03-23 18:06:36 | [diff] [blame] | 165 | gfx::Rect location() const { return location_; } |
[email protected] | 0d7dad6 | 2010-10-19 21:18:50 | [diff] [blame] | 166 | BrowserAccessibilityManager* manager() const { return manager_; } |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 167 | const std::string& name() const { return name_; } |
[email protected] | 99d408f | 2013-12-04 07:19:43 | [diff] [blame] | 168 | const std::string& value() const { return value_; } |
[email protected] | 0d7dad6 | 2010-10-19 21:18:50 | [diff] [blame] | 169 | int32 renderer_id() const { return renderer_id_; } |
| 170 | int32 role() const { return role_; } |
[email protected] | 0d7dad6 | 2010-10-19 21:18:50 | [diff] [blame] | 171 | int32 state() const { return state_; } |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 172 | bool instance_active() const { return instance_active_; } |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 173 | |
[email protected] | 99d408f | 2013-12-04 07:19:43 | [diff] [blame] | 174 | void set_name(const std::string& name) { name_ = name; } |
| 175 | void set_value(const std::string& value) { value_ = value; } |
| 176 | |
[email protected] | 95b3f544 | 2012-05-06 17:10:07 | [diff] [blame] | 177 | #if defined(OS_MACOSX) && __OBJC__ |
[email protected] | cd3e2d90 | 2012-05-09 07:05:20 | [diff] [blame] | 178 | BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa(); |
[email protected] | 1dbadbd | 2010-10-13 18:50:10 | [diff] [blame] | 179 | #elif defined(OS_WIN) |
[email protected] | cd3e2d90 | 2012-05-09 07:05:20 | [diff] [blame] | 180 | BrowserAccessibilityWin* ToBrowserAccessibilityWin(); |
| 181 | #elif defined(TOOLKIT_GTK) |
| 182 | BrowserAccessibilityGtk* ToBrowserAccessibilityGtk(); |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 183 | #endif |
| 184 | |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 185 | // Accessing accessibility attributes: |
| 186 | // |
| 187 | // There are dozens of possible attributes for an accessibility node, |
| 188 | // but only a few tend to apply to any one object, so we store them |
| 189 | // in sparse arrays of <attribute id, attribute value> pairs, organized |
| 190 | // by type (bool, int, float, string, int list). |
| 191 | // |
| 192 | // There are three accessors for each type of attribute: one that returns |
| 193 | // true if the attribute is present and false if not, one that takes a |
| 194 | // pointer argument and returns true if the attribute is present (if you |
| 195 | // need to distinguish between the default value and a missing attribute), |
| 196 | // and another that returns the default value for that type if the |
| 197 | // attribute is not present. In addition, strings can be returned as |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 198 | // either std::string or base::string16, for convenience. |
[email protected] | ee84512 | 2011-09-01 08:44:16 | [diff] [blame] | 199 | |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 200 | bool HasBoolAttribute(ui::AXBoolAttribute attr) const; |
| 201 | bool GetBoolAttribute(ui::AXBoolAttribute attr) const; |
| 202 | bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 203 | |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 204 | bool HasFloatAttribute(ui::AXFloatAttribute attr) const; |
| 205 | float GetFloatAttribute(ui::AXFloatAttribute attr) const; |
| 206 | bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const; |
[email protected] | 02747d4e | 2010-11-03 19:10:00 | [diff] [blame] | 207 | |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 208 | bool HasIntAttribute(ui::AXIntAttribute attribute) const; |
| 209 | int GetIntAttribute(ui::AXIntAttribute attribute) const; |
| 210 | bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const; |
[email protected] | ee84512 | 2011-09-01 08:44:16 | [diff] [blame] | 211 | |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 212 | bool HasStringAttribute( |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 213 | ui::AXStringAttribute attribute) const; |
| 214 | const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; |
| 215 | bool GetStringAttribute(ui::AXStringAttribute attribute, |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 216 | std::string* value) const; |
| 217 | |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 218 | bool GetString16Attribute(ui::AXStringAttribute attribute, |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 219 | base::string16* value) const; |
| 220 | base::string16 GetString16Attribute( |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 221 | ui::AXStringAttribute attribute) const; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 222 | |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 223 | bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 224 | const std::vector<int32>& GetIntListAttribute( |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 225 | ui::AXIntListAttribute attribute) const; |
| 226 | bool GetIntListAttribute(ui::AXIntListAttribute attribute, |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 227 | std::vector<int32>* value) const; |
| 228 | |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 229 | void SetStringAttribute(ui::AXStringAttribute attribute, |
| 230 | const std::string& value); |
[email protected] | ee84512 | 2011-09-01 08:44:16 | [diff] [blame] | 231 | |
| 232 | // Retrieve the value of a html attribute from the attribute map and |
| 233 | // returns true if found. |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 234 | bool GetHtmlAttribute(const char* attr, base::string16* value) const; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 235 | bool GetHtmlAttribute(const char* attr, std::string* value) const; |
[email protected] | ee84512 | 2011-09-01 08:44:16 | [diff] [blame] | 236 | |
[email protected] | 38f1e3b05 | 2012-02-10 21:46:07 | [diff] [blame] | 237 | // Utility method to handle special cases for ARIA booleans, tristates and |
| 238 | // booleans which have a "mixed" state. |
| 239 | // |
| 240 | // Warning: the term "Tristate" is used loosely by the spec and here, |
| 241 | // as some attributes support a 4th state. |
| 242 | // |
| 243 | // The following attributes are appropriate to use with this method: |
| 244 | // aria-selected (selectable) |
| 245 | // aria-grabbed (grabbable) |
| 246 | // aria-expanded (expandable) |
| 247 | // aria-pressed (toggleable/pressable) -- supports 4th "mixed" state |
| 248 | // aria-checked (checkable) -- supports 4th "mixed state" |
| 249 | bool GetAriaTristate(const char* attr_name, |
| 250 | bool* is_defined, |
| 251 | bool* is_mixed) const; |
| 252 | |
[email protected] | c43b0dc | 2011-12-03 04:31:13 | [diff] [blame] | 253 | // Returns true if the bit corresponding to the given state enum is 1. |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 254 | bool HasState(ui::AXState state_enum) const; |
[email protected] | c43b0dc | 2011-12-03 04:31:13 | [diff] [blame] | 255 | |
[email protected] | ee84512 | 2011-09-01 08:44:16 | [diff] [blame] | 256 | // Returns true if this node is an editable text field of any kind. |
| 257 | bool IsEditableText() const; |
[email protected] | 02747d4e | 2010-11-03 19:10:00 | [diff] [blame] | 258 | |
[email protected] | d1029c5 | 2011-10-21 21:59:51 | [diff] [blame] | 259 | // Append the text from this node and its children. |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 260 | std::string GetTextRecursive() const; |
[email protected] | d1029c5 | 2011-10-21 21:59:51 | [diff] [blame] | 261 | |
[email protected] | aa50cea8 | 2010-11-05 23:02:38 | [diff] [blame] | 262 | protected: |
[email protected] | a52aa41 | 2011-12-14 19:03:30 | [diff] [blame] | 263 | // Perform platform specific initialization. This can be called multiple times |
| 264 | // during the lifetime of this instance after the members of this base object |
| 265 | // have been reset with new values from the renderer process. |
| 266 | // Perform child independent initialization in this method. |
[email protected] | c47754096 | 2013-03-07 00:43:10 | [diff] [blame] | 267 | virtual void PreInitialize() {} |
[email protected] | a52aa41 | 2011-12-14 19:03:30 | [diff] [blame] | 268 | |
[email protected] | aa50cea8 | 2010-11-05 23:02:38 | [diff] [blame] | 269 | BrowserAccessibility(); |
| 270 | |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 271 | // The manager of this tree of accessibility objects; needed for |
| 272 | // global operations like focus tracking. |
| 273 | BrowserAccessibilityManager* manager_; |
| 274 | |
| 275 | // The parent of this object, may be NULL if we're the root object. |
| 276 | BrowserAccessibility* parent_; |
| 277 | |
[email protected] | 99d408f | 2013-12-04 07:19:43 | [diff] [blame] | 278 | private: |
[email protected] | 3dba3ed | 2013-12-17 21:24:01 | [diff] [blame] | 279 | // Return the sum of the lengths of all static text descendants, |
| 280 | // including this object if it's static text. |
| 281 | int GetStaticTextLenRecursive() const; |
| 282 | |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 283 | // The index of this within its parent object. |
| 284 | int32 index_in_parent_; |
| 285 | |
| 286 | // The ID of this object in the renderer process. |
| 287 | int32 renderer_id_; |
| 288 | |
| 289 | // The children of this object. |
| 290 | std::vector<BrowserAccessibility*> children_; |
| 291 | |
| 292 | // Accessibility metadata from the renderer |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 293 | std::string name_; |
| 294 | std::string value_; |
| 295 | std::vector<std::pair< |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 296 | ui::AXBoolAttribute, bool> > bool_attributes_; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 297 | std::vector<std::pair< |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 298 | ui::AXFloatAttribute, float> > float_attributes_; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 299 | std::vector<std::pair< |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 300 | ui::AXIntAttribute, int> > int_attributes_; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 301 | std::vector<std::pair< |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 302 | ui::AXStringAttribute, std::string> > string_attributes_; |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 303 | std::vector<std::pair< |
[email protected] | 5eec2f5 | 2014-01-06 22:30:54 | [diff] [blame^] | 304 | ui::AXIntListAttribute, std::vector<int32> > > |
[email protected] | eecf89f0 | 2013-08-20 23:41:51 | [diff] [blame] | 305 | intlist_attributes_; |
| 306 | std::vector<std::pair<std::string, std::string> > html_attributes_; |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 307 | int32 role_; |
| 308 | int32 state_; |
[email protected] | 0aed2f5 | 2011-03-23 18:06:36 | [diff] [blame] | 309 | gfx::Rect location_; |
[email protected] | 8368e3c | 2011-03-08 19:26:24 | [diff] [blame] | 310 | |
| 311 | // BrowserAccessibility objects are reference-counted on some platforms. |
| 312 | // When we're done with this object and it's removed from our accessibility |
| 313 | // tree, a client may still be holding onto a pointer to this object, so |
| 314 | // we mark it as inactive so that calls to any of this object's methods |
| 315 | // immediately return failure. |
| 316 | bool instance_active_; |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 317 | |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 318 | private: |
| 319 | DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 320 | }; |
| 321 | |
[email protected] | e6b3487 | 2012-10-24 20:51:32 | [diff] [blame] | 322 | } // namespace content |
| 323 | |
[email protected] | ba1fa65 | 2011-06-25 05:16:22 | [diff] [blame] | 324 | #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |