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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // Returns true if the bit corresponding to the given state enum is 1. | 267 // Returns true if the bit corresponding to the given state enum is 1. |
273 bool HasState(WebAccessibility::State state_enum) const; | 268 bool HasState(WebAccessibility::State state_enum) const; |
274 | 269 |
275 // Returns true if this node is an editable text field of any kind. | 270 // Returns true if this node is an editable text field of any kind. |
276 bool IsEditableText() const; | 271 bool IsEditableText() const; |
277 | 272 |
278 // Append the text from this node and its children. | 273 // Append the text from this node and its children. |
279 string16 GetTextRecursive() const; | 274 string16 GetTextRecursive() const; |
280 | 275 |
281 protected: | 276 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 |
282 BrowserAccessibility(); | 283 BrowserAccessibility(); |
283 | 284 |
284 // The manager of this tree of accessibility objects; needed for | 285 // The manager of this tree of accessibility objects; needed for |
285 // global operations like focus tracking. | 286 // global operations like focus tracking. |
286 BrowserAccessibilityManager* manager_; | 287 BrowserAccessibilityManager* manager_; |
287 | 288 |
288 // The parent of this object, may be NULL if we're the root object. | 289 // The parent of this object, may be NULL if we're the root object. |
289 BrowserAccessibility* parent_; | 290 BrowserAccessibility* parent_; |
290 | 291 |
291 // The ID of this object; globally unique within the browser process. | 292 // The ID of this object; globally unique within the browser process. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // tree, a client may still be holding onto a pointer to this object, so | 326 // tree, a client may still be holding onto a pointer to this object, so |
326 // we mark it as inactive so that calls to any of this object's methods | 327 // we mark it as inactive so that calls to any of this object's methods |
327 // immediately return failure. | 328 // immediately return failure. |
328 bool instance_active_; | 329 bool instance_active_; |
329 | 330 |
330 private: | 331 private: |
331 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 332 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
332 }; | 333 }; |
333 | 334 |
334 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 335 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
OLD | NEW |