| 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 <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // but only a few tend to apply to any one object, so we store them | 185 // but only a few tend to apply to any one object, so we store them |
| 186 // in sparse arrays of <attribute id, attribute value> pairs, organized | 186 // in sparse arrays of <attribute id, attribute value> pairs, organized |
| 187 // by type (bool, int, float, string, int list). | 187 // by type (bool, int, float, string, int list). |
| 188 // | 188 // |
| 189 // There are three accessors for each type of attribute: one that returns | 189 // There are three accessors for each type of attribute: one that returns |
| 190 // true if the attribute is present and false if not, one that takes a | 190 // true if the attribute is present and false if not, one that takes a |
| 191 // pointer argument and returns true if the attribute is present (if you | 191 // pointer argument and returns true if the attribute is present (if you |
| 192 // need to distinguish between the default value and a missing attribute), | 192 // need to distinguish between the default value and a missing attribute), |
| 193 // and another that returns the default value for that type if the | 193 // and another that returns the default value for that type if the |
| 194 // attribute is not present. In addition, strings can be returned as | 194 // attribute is not present. In addition, strings can be returned as |
| 195 // either std::string or string16, for convenience. | 195 // either std::string or base::string16, for convenience. |
| 196 | 196 |
| 197 bool HasBoolAttribute(AccessibilityNodeData::BoolAttribute attr) const; | 197 bool HasBoolAttribute(AccessibilityNodeData::BoolAttribute attr) const; |
| 198 bool GetBoolAttribute(AccessibilityNodeData::BoolAttribute attr) const; | 198 bool GetBoolAttribute(AccessibilityNodeData::BoolAttribute attr) const; |
| 199 bool GetBoolAttribute(AccessibilityNodeData::BoolAttribute attr, | 199 bool GetBoolAttribute(AccessibilityNodeData::BoolAttribute attr, |
| 200 bool* value) const; | 200 bool* value) const; |
| 201 | 201 |
| 202 bool HasFloatAttribute(AccessibilityNodeData::FloatAttribute attr) const; | 202 bool HasFloatAttribute(AccessibilityNodeData::FloatAttribute attr) const; |
| 203 float GetFloatAttribute(AccessibilityNodeData::FloatAttribute attr) const; | 203 float GetFloatAttribute(AccessibilityNodeData::FloatAttribute attr) const; |
| 204 bool GetFloatAttribute(AccessibilityNodeData::FloatAttribute attr, | 204 bool GetFloatAttribute(AccessibilityNodeData::FloatAttribute attr, |
| 205 float* value) const; | 205 float* value) const; |
| 206 | 206 |
| 207 bool HasIntAttribute(AccessibilityNodeData::IntAttribute attribute) const; | 207 bool HasIntAttribute(AccessibilityNodeData::IntAttribute attribute) const; |
| 208 int GetIntAttribute(AccessibilityNodeData::IntAttribute attribute) const; | 208 int GetIntAttribute(AccessibilityNodeData::IntAttribute attribute) const; |
| 209 bool GetIntAttribute(AccessibilityNodeData::IntAttribute attribute, | 209 bool GetIntAttribute(AccessibilityNodeData::IntAttribute attribute, |
| 210 int* value) const; | 210 int* value) const; |
| 211 | 211 |
| 212 bool HasStringAttribute( | 212 bool HasStringAttribute( |
| 213 AccessibilityNodeData::StringAttribute attribute) const; | 213 AccessibilityNodeData::StringAttribute attribute) const; |
| 214 const std::string& GetStringAttribute( | 214 const std::string& GetStringAttribute( |
| 215 AccessibilityNodeData::StringAttribute attribute) const; | 215 AccessibilityNodeData::StringAttribute attribute) const; |
| 216 bool GetStringAttribute(AccessibilityNodeData::StringAttribute attribute, | 216 bool GetStringAttribute(AccessibilityNodeData::StringAttribute attribute, |
| 217 std::string* value) const; | 217 std::string* value) const; |
| 218 | 218 |
| 219 bool GetString16Attribute(AccessibilityNodeData::StringAttribute attribute, | 219 bool GetString16Attribute(AccessibilityNodeData::StringAttribute attribute, |
| 220 string16* value) const; | 220 base::string16* value) const; |
| 221 string16 GetString16Attribute( | 221 base::string16 GetString16Attribute( |
| 222 AccessibilityNodeData::StringAttribute attribute) const; | 222 AccessibilityNodeData::StringAttribute attribute) const; |
| 223 | 223 |
| 224 bool HasIntListAttribute( | 224 bool HasIntListAttribute( |
| 225 AccessibilityNodeData::IntListAttribute attribute) const; | 225 AccessibilityNodeData::IntListAttribute attribute) const; |
| 226 const std::vector<int32>& GetIntListAttribute( | 226 const std::vector<int32>& GetIntListAttribute( |
| 227 AccessibilityNodeData::IntListAttribute attribute) const; | 227 AccessibilityNodeData::IntListAttribute attribute) const; |
| 228 bool GetIntListAttribute(AccessibilityNodeData::IntListAttribute attribute, | 228 bool GetIntListAttribute(AccessibilityNodeData::IntListAttribute attribute, |
| 229 std::vector<int32>* value) const; | 229 std::vector<int32>* value) const; |
| 230 | 230 |
| 231 void SetStringAttribute( | 231 void SetStringAttribute( |
| 232 AccessibilityNodeData::StringAttribute attribute, | 232 AccessibilityNodeData::StringAttribute attribute, |
| 233 const std::string& value); | 233 const std::string& value); |
| 234 | 234 |
| 235 // Retrieve the value of a html attribute from the attribute map and | 235 // Retrieve the value of a html attribute from the attribute map and |
| 236 // returns true if found. | 236 // returns true if found. |
| 237 bool GetHtmlAttribute(const char* attr, string16* value) const; | 237 bool GetHtmlAttribute(const char* attr, base::string16* value) const; |
| 238 bool GetHtmlAttribute(const char* attr, std::string* value) const; | 238 bool GetHtmlAttribute(const char* attr, std::string* value) const; |
| 239 | 239 |
| 240 // Utility method to handle special cases for ARIA booleans, tristates and | 240 // Utility method to handle special cases for ARIA booleans, tristates and |
| 241 // booleans which have a "mixed" state. | 241 // booleans which have a "mixed" state. |
| 242 // | 242 // |
| 243 // Warning: the term "Tristate" is used loosely by the spec and here, | 243 // Warning: the term "Tristate" is used loosely by the spec and here, |
| 244 // as some attributes support a 4th state. | 244 // as some attributes support a 4th state. |
| 245 // | 245 // |
| 246 // The following attributes are appropriate to use with this method: | 246 // The following attributes are appropriate to use with this method: |
| 247 // aria-selected (selectable) | 247 // aria-selected (selectable) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // immediately return failure. | 313 // immediately return failure. |
| 314 bool instance_active_; | 314 bool instance_active_; |
| 315 | 315 |
| 316 private: | 316 private: |
| 317 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 317 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 318 }; | 318 }; |
| 319 | 319 |
| 320 } // namespace content | 320 } // namespace content |
| 321 | 321 |
| 322 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 322 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| OLD | NEW |