| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "webkit/glue/webaccessibility.h" | 16 #include "webkit/glue/webaccessibility.h" |
| 17 | 17 |
| 18 class BrowserAccessibilityManager; | 18 class BrowserAccessibilityManager; |
| 19 #if defined(OS_MACOSX) && __OBJC__ | 19 #if defined(OS_MACOSX) && __OBJC__ |
| 20 @class BrowserAccessibilityCocoa; | 20 @class BrowserAccessibilityCocoa; |
| 21 #elif defined(OS_WIN) | 21 #elif defined(OS_WIN) |
| 22 class BrowserAccessibilityWin; | 22 class BrowserAccessibilityWin; |
| 23 #elif defined(TOOLKIT_GTK) |
| 24 class BrowserAccessibilityGtk; |
| 23 #endif | 25 #endif |
| 24 | 26 |
| 25 using webkit_glue::WebAccessibility; | 27 using webkit_glue::WebAccessibility; |
| 26 typedef std::map<WebAccessibility::BoolAttribute, bool> BoolAttrMap; | 28 typedef std::map<WebAccessibility::BoolAttribute, bool> BoolAttrMap; |
| 27 typedef std::map<WebAccessibility::FloatAttribute, float> FloatAttrMap; | 29 typedef std::map<WebAccessibility::FloatAttribute, float> FloatAttrMap; |
| 28 typedef std::map<WebAccessibility::IntAttribute, int> IntAttrMap; | 30 typedef std::map<WebAccessibility::IntAttribute, int> IntAttrMap; |
| 29 typedef std::map<WebAccessibility::StringAttribute, string16> StringAttrMap; | 31 typedef std::map<WebAccessibility::StringAttribute, string16> StringAttrMap; |
| 30 | 32 |
| 31 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 32 // | 34 // |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 // Detach all descendants of this subtree and push all of the node pointers, | 53 // Detach all descendants of this subtree and push all of the node pointers, |
| 52 // including this node, onto the end of |nodes|. | 54 // including this node, onto the end of |nodes|. |
| 53 virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes); | 55 virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes); |
| 54 | 56 |
| 55 // Perform platform specific initialization. This can be called multiple times | 57 // Perform platform specific initialization. This can be called multiple times |
| 56 // during the lifetime of this instance after the members of this base object | 58 // during the lifetime of this instance after the members of this base object |
| 57 // have been reset with new values from the renderer process. | 59 // have been reset with new values from the renderer process. |
| 58 // Child dependent initialization can be done here. | 60 // Child dependent initialization can be done here. |
| 59 virtual void PostInitialize() {} | 61 virtual void PostInitialize() {} |
| 60 | 62 |
| 63 // Returns true if this is a native platform-specific object, vs a |
| 64 // cross-platform generic object. |
| 65 virtual bool IsNative() const; |
| 66 |
| 61 // Initialize this object, reading attributes from |src|. Does not | 67 // Initialize this object, reading attributes from |src|. Does not |
| 62 // recurse into children of |src| and build the whole subtree. | 68 // recurse into children of |src| and build the whole subtree. |
| 63 void PreInitialize(BrowserAccessibilityManager* manager, | 69 void PreInitialize(BrowserAccessibilityManager* manager, |
| 64 BrowserAccessibility* parent, | 70 BrowserAccessibility* parent, |
| 65 int32 child_id, | 71 int32 child_id, |
| 66 int32 index_in_parent, | 72 int32 index_in_parent, |
| 67 const WebAccessibility& src); | 73 const WebAccessibility& src); |
| 68 | 74 |
| 69 // Add a child of this object. | 75 // Add a child of this object. |
| 70 void AddChild(BrowserAccessibility* child); | 76 void AddChild(BrowserAccessibility* child); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 const string16& name() const { return name_; } | 187 const string16& name() const { return name_; } |
| 182 int32 renderer_id() const { return renderer_id_; } | 188 int32 renderer_id() const { return renderer_id_; } |
| 183 int32 role() const { return role_; } | 189 int32 role() const { return role_; } |
| 184 const string16& role_name() const { return role_name_; } | 190 const string16& role_name() const { return role_name_; } |
| 185 int32 state() const { return state_; } | 191 int32 state() const { return state_; } |
| 186 const string16& value() const { return value_; } | 192 const string16& value() const { return value_; } |
| 187 bool instance_active() const { return instance_active_; } | 193 bool instance_active() const { return instance_active_; } |
| 188 int32 ref_count() const { return ref_count_; } | 194 int32 ref_count() const { return ref_count_; } |
| 189 | 195 |
| 190 #if defined(OS_MACOSX) && __OBJC__ | 196 #if defined(OS_MACOSX) && __OBJC__ |
| 191 BrowserAccessibilityCocoa* toBrowserAccessibilityCocoa(); | 197 BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa(); |
| 192 #elif defined(OS_WIN) | 198 #elif defined(OS_WIN) |
| 193 BrowserAccessibilityWin* toBrowserAccessibilityWin(); | 199 BrowserAccessibilityWin* ToBrowserAccessibilityWin(); |
| 200 #elif defined(TOOLKIT_GTK) |
| 201 BrowserAccessibilityGtk* ToBrowserAccessibilityGtk(); |
| 194 #endif | 202 #endif |
| 195 | 203 |
| 196 // Retrieve the value of a bool attribute from the bool attribute | 204 // Retrieve the value of a bool attribute from the bool attribute |
| 197 // map and returns true if found. | 205 // map and returns true if found. |
| 198 bool GetBoolAttribute(WebAccessibility::BoolAttribute attr, bool* value) | 206 bool GetBoolAttribute(WebAccessibility::BoolAttribute attr, bool* value) |
| 199 const; | 207 const; |
| 200 | 208 |
| 201 // Retrieve the value of a float attribute from the float attribute | 209 // Retrieve the value of a float attribute from the float attribute |
| 202 // map and returns true if found. | 210 // map and returns true if found. |
| 203 bool GetFloatAttribute(WebAccessibility::FloatAttribute attr, float* value) | 211 bool GetFloatAttribute(WebAccessibility::FloatAttribute attr, float* value) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // tree, a client may still be holding onto a pointer to this object, so | 303 // tree, a client may still be holding onto a pointer to this object, so |
| 296 // we mark it as inactive so that calls to any of this object's methods | 304 // we mark it as inactive so that calls to any of this object's methods |
| 297 // immediately return failure. | 305 // immediately return failure. |
| 298 bool instance_active_; | 306 bool instance_active_; |
| 299 | 307 |
| 300 private: | 308 private: |
| 301 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 309 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 302 }; | 310 }; |
| 303 | 311 |
| 304 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 312 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| OLD | NEW |