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 virtual void Initialize(); | 58 // Child dependent initialization can be done here. |
59 | 59 virtual void PostInitialize() {} |
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() {} | |
65 | 60 |
66 // Initialize this object, reading attributes from |src|. Does not | 61 // Initialize this object, reading attributes from |src|. Does not |
67 // recurse into children of |src| and build the whole subtree. | 62 // recurse into children of |src| and build the whole subtree. |
68 void Initialize(BrowserAccessibilityManager* manager, | 63 void PreInitialize(BrowserAccessibilityManager* manager, |
69 BrowserAccessibility* parent, | 64 BrowserAccessibility* parent, |
70 int32 child_id, | 65 int32 child_id, |
71 int32 index_in_parent, | 66 int32 index_in_parent, |
72 const WebAccessibility& src); | 67 const WebAccessibility& src); |
73 | 68 |
74 // Add a child of this object. | 69 // Add a child of this object. |
75 void AddChild(BrowserAccessibility* child); | 70 void AddChild(BrowserAccessibility* child); |
76 | 71 |
77 // Update the parent and index in parent if this node has been moved. | 72 // Update the parent and index in parent if this node has been moved. |
78 void UpdateParent(BrowserAccessibility* parent, int index_in_parent); | 73 void UpdateParent(BrowserAccessibility* parent, int index_in_parent); |
79 | 74 |
80 // Return true if this object is equal to or a descendant of |ancestor|. | 75 // Return true if this object is equal to or a descendant of |ancestor|. |
81 bool IsDescendantOf(BrowserAccessibility* ancestor); | 76 bool IsDescendantOf(BrowserAccessibility* ancestor); |
82 | 77 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // returns true if found. | 212 // returns true if found. |
218 bool GetHtmlAttribute(const char* attr, string16* value) const; | 213 bool GetHtmlAttribute(const char* attr, string16* value) const; |
219 | 214 |
220 // Returns true if this node is an editable text field of any kind. | 215 // Returns true if this node is an editable text field of any kind. |
221 bool IsEditableText() const; | 216 bool IsEditableText() const; |
222 | 217 |
223 // Append the text from this node and its children. | 218 // Append the text from this node and its children. |
224 string16 GetTextRecursive() const; | 219 string16 GetTextRecursive() const; |
225 | 220 |
226 protected: | 221 protected: |
| 222 // Perform platform specific initialization. This can be called multiple times |
| 223 // during the lifetime of this instance after the members of this base object |
| 224 // have been reset with new values from the renderer process. |
| 225 // Perform child independent initialization in this method. |
| 226 virtual void PreInitialize(); |
| 227 |
227 BrowserAccessibility(); | 228 BrowserAccessibility(); |
228 | 229 |
229 // The manager of this tree of accessibility objects; needed for | 230 // The manager of this tree of accessibility objects; needed for |
230 // global operations like focus tracking. | 231 // global operations like focus tracking. |
231 BrowserAccessibilityManager* manager_; | 232 BrowserAccessibilityManager* manager_; |
232 | 233 |
233 // The parent of this object, may be NULL if we're the root object. | 234 // The parent of this object, may be NULL if we're the root object. |
234 BrowserAccessibility* parent_; | 235 BrowserAccessibility* parent_; |
235 | 236 |
236 // The ID of this object; globally unique within the browser process. | 237 // The ID of this object; globally unique within the browser process. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // tree, a client may still be holding onto a pointer to this object, so | 271 // tree, a client may still be holding onto a pointer to this object, so |
271 // we mark it as inactive so that calls to any of this object's methods | 272 // we mark it as inactive so that calls to any of this object's methods |
272 // immediately return failure. | 273 // immediately return failure. |
273 bool instance_active_; | 274 bool instance_active_; |
274 | 275 |
275 private: | 276 private: |
276 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 277 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
277 }; | 278 }; |
278 | 279 |
279 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 280 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
OLD | NEW |