| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 virtual ~BrowserAccessibility(); | 49 virtual ~BrowserAccessibility(); |
| 50 | 50 |
| 51 // Detach all descendants of this subtree and push all of the node pointers, | 51 // Detach all descendants of this subtree and push all of the node pointers, |
| 52 // including this node, onto the end of |nodes|. | 52 // including this node, onto the end of |nodes|. |
| 53 virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes); | 53 virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes); |
| 54 | 54 |
| 55 // Perform platform specific initialization. This can be called multiple times | 55 // Perform platform specific initialization. This can be called multiple times |
| 56 // during the lifetime of this instance after the members of this base object | 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. | 57 // have been reset with new values from the renderer process. |
| 58 // Child dependent initialization can be done here. | 58 virtual void Initialize(); |
| 59 virtual void PostInitialize() {} | 59 |
| 60 // Optionally send events triggered simply by the fact that this node |
| 61 // has been created or modified (and has been attached to the tree). |
| 62 // This can include "show" events, "text changed" events in live regions, |
| 63 // or "alert" events. |
| 64 virtual void SendNodeUpdateEvents() {} |
| 60 | 65 |
| 61 // Initialize this object, reading attributes from |src|. Does not | 66 // Initialize this object, reading attributes from |src|. Does not |
| 62 // recurse into children of |src| and build the whole subtree. | 67 // recurse into children of |src| and build the whole subtree. |
| 63 void PreInitialize(BrowserAccessibilityManager* manager, | 68 void Initialize(BrowserAccessibilityManager* manager, |
| 64 BrowserAccessibility* parent, | 69 BrowserAccessibility* parent, |
| 65 int32 child_id, | 70 int32 child_id, |
| 66 int32 index_in_parent, | 71 int32 index_in_parent, |
| 67 const WebAccessibility& src); | 72 const WebAccessibility& src); |
| 68 | 73 |
| 69 // Add a child of this object. | 74 // Add a child of this object. |
| 70 void AddChild(BrowserAccessibility* child); | 75 void AddChild(BrowserAccessibility* child); |
| 71 | 76 |
| 72 // Update the parent and index in parent if this node has been moved. | 77 // Update the parent and index in parent if this node has been moved. |
| 73 void UpdateParent(BrowserAccessibility* parent, int index_in_parent); | 78 void UpdateParent(BrowserAccessibility* parent, int index_in_parent); |
| 74 | 79 |
| 75 // Return true if this object is equal to or a descendant of |ancestor|. | 80 // Return true if this object is equal to or a descendant of |ancestor|. |
| 76 bool IsDescendantOf(BrowserAccessibility* ancestor); | 81 bool IsDescendantOf(BrowserAccessibility* ancestor); |
| 77 | 82 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // Returns true if the bit corresponding to the given state enum is 1. | 272 // Returns true if the bit corresponding to the given state enum is 1. |
| 268 bool HasState(WebAccessibility::State state_enum) const; | 273 bool HasState(WebAccessibility::State state_enum) const; |
| 269 | 274 |
| 270 // Returns true if this node is an editable text field of any kind. | 275 // Returns true if this node is an editable text field of any kind. |
| 271 bool IsEditableText() const; | 276 bool IsEditableText() const; |
| 272 | 277 |
| 273 // Append the text from this node and its children. | 278 // Append the text from this node and its children. |
| 274 string16 GetTextRecursive() const; | 279 string16 GetTextRecursive() const; |
| 275 | 280 |
| 276 protected: | 281 protected: |
| 277 // Perform platform specific initialization. This can be called multiple times | |
| 278 // during the lifetime of this instance after the members of this base object | |
| 279 // have been reset with new values from the renderer process. | |
| 280 // Perform child independent initialization in this method. | |
| 281 virtual void PreInitialize(); | |
| 282 | |
| 283 BrowserAccessibility(); | 282 BrowserAccessibility(); |
| 284 | 283 |
| 285 // The manager of this tree of accessibility objects; needed for | 284 // The manager of this tree of accessibility objects; needed for |
| 286 // global operations like focus tracking. | 285 // global operations like focus tracking. |
| 287 BrowserAccessibilityManager* manager_; | 286 BrowserAccessibilityManager* manager_; |
| 288 | 287 |
| 289 // The parent of this object, may be NULL if we're the root object. | 288 // The parent of this object, may be NULL if we're the root object. |
| 290 BrowserAccessibility* parent_; | 289 BrowserAccessibility* parent_; |
| 291 | 290 |
| 292 // The ID of this object; globally unique within the browser process. | 291 // The ID of this object; globally unique within the browser process. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // tree, a client may still be holding onto a pointer to this object, so | 325 // tree, a client may still be holding onto a pointer to this object, so |
| 327 // we mark it as inactive so that calls to any of this object's methods | 326 // we mark it as inactive so that calls to any of this object's methods |
| 328 // immediately return failure. | 327 // immediately return failure. |
| 329 bool instance_active_; | 328 bool instance_active_; |
| 330 | 329 |
| 331 private: | 330 private: |
| 332 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 331 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 333 }; | 332 }; |
| 334 | 333 |
| 335 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 334 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| OLD | NEW |