Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: content/browser/accessibility/browser_accessibility.h

Issue 848653002: Re-land: Send Windows accessibility events based on tree updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implicit_1_tests
Patch Set: Remove logging Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 virtual ~BrowserAccessibility(); 50 virtual ~BrowserAccessibility();
51 51
52 // Called only once, immediately after construction. The constructor doesn't 52 // Called only once, immediately after construction. The constructor doesn't
53 // take any arguments because in the Windows subclass we use a special 53 // take any arguments because in the Windows subclass we use a special
54 // function to construct a COM object. 54 // function to construct a COM object.
55 virtual void Init(BrowserAccessibilityManager* manager, ui::AXNode* node); 55 virtual void Init(BrowserAccessibilityManager* manager, ui::AXNode* node);
56 56
57 // Called after the object is first initialized and again every time 57 // Called after the object is first initialized and again every time
58 // its data changes. 58 // its data changes.
59 virtual void OnDataChanged(); 59 virtual void OnDataChanged() {}
60 60
61 // Called after an atomic update to the tree finished and this object 61 // Called after an atomic update to the tree finished and this object
62 // was created or changed in this update. 62 // was created or changed in this update.
63 virtual void OnUpdateFinished() {} 63 virtual void OnUpdateFinished() {}
64 64
65 virtual void OnSubtreeWillBeDeleted() {}
66
67 virtual void OnSubtreeCreationFinished() {}
68
65 // Returns true if this is a native platform-specific object, vs a 69 // Returns true if this is a native platform-specific object, vs a
66 // cross-platform generic object. 70 // cross-platform generic object.
67 virtual bool IsNative() const; 71 virtual bool IsNative() const;
68 72
69 // Called when the location changed. 73 // Called when the location changed.
70 virtual void OnLocationChanged() {} 74 virtual void OnLocationChanged() {}
71 75
72 // Return true if this object is equal to or a descendant of |ancestor|. 76 // Return true if this object is equal to or a descendant of |ancestor|.
73 bool IsDescendantOf(BrowserAccessibility* ancestor); 77 bool IsDescendantOf(BrowserAccessibility* ancestor);
74 78
75 // Returns true if this is a leaf node on this platform, meaning any 79 // Returns true if this is a leaf node on this platform, meaning any
76 // children should not be exposed to this platform's native accessibility 80 // children should not be exposed to this platform's native accessibility
77 // layer. Each platform subclass should implement this itself. 81 // layer. Each platform subclass should implement this itself.
78 // The definition of a leaf may vary depending on the platform, 82 // The definition of a leaf may vary depending on the platform,
79 // but a leaf node should never have children that are focusable or 83 // but a leaf node should never have children that are focusable or
80 // that might send notifications. 84 // that might send notifications.
81 virtual bool PlatformIsLeaf() const; 85 virtual bool PlatformIsLeaf() const;
82 86
83 // Returns the number of children of this object, or 0 if PlatformIsLeaf() 87 // Returns the number of children of this object, or 0 if PlatformIsLeaf()
84 // returns true. 88 // returns true.
85 uint32 PlatformChildCount() const; 89 uint32 PlatformChildCount() const;
86 90
87 // Return a pointer to the child at the given index, or NULL for an 91 // Return a pointer to the child at the given index, or NULL for an
88 // invalid index. Returns NULL if PlatformIsLeaf() returns true. 92 // invalid index. Returns NULL if PlatformIsLeaf() returns true.
89 BrowserAccessibility* PlatformGetChild(uint32 child_index) const; 93 BrowserAccessibility* PlatformGetChild(uint32 child_index) const;
90 94
95 // Returns true if an ancestor of this node (not including itself) is a
96 // leaf node, meaning that this node is not actually exposed to the
97 // platform.
98 bool PlatformIsChildOfLeaf() const;
99
91 // Return the previous sibling of this object, or NULL if it's the first 100 // Return the previous sibling of this object, or NULL if it's the first
92 // child of its parent. 101 // child of its parent.
93 BrowserAccessibility* GetPreviousSibling(); 102 BrowserAccessibility* GetPreviousSibling();
94 103
95 // Return the next sibling of this object, or NULL if it's the last child 104 // Return the next sibling of this object, or NULL if it's the last child
96 // of its parent. 105 // of its parent.
97 BrowserAccessibility* GetNextSibling(); 106 BrowserAccessibility* GetNextSibling();
98 107
99 // Returns the bounds of this object in coordinates relative to the 108 // Returns the bounds of this object in coordinates relative to the
100 // top-left corner of the overall web area. 109 // top-left corner of the overall web area.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Subclasses should override this to support platform reference counting. 142 // Subclasses should override this to support platform reference counting.
134 virtual void NativeReleaseReference(); 143 virtual void NativeReleaseReference();
135 144
136 // 145 //
137 // Accessors 146 // Accessors
138 // 147 //
139 148
140 BrowserAccessibilityManager* manager() const { return manager_; } 149 BrowserAccessibilityManager* manager() const { return manager_; }
141 bool instance_active() const { return node_ != NULL; } 150 bool instance_active() const { return node_ != NULL; }
142 ui::AXNode* node() const { return node_; } 151 ui::AXNode* node() const { return node_; }
143 const std::string& name() const { return name_; }
144 const std::string& value() const { return value_; }
145 void set_name(const std::string& name) { name_ = name; }
146 void set_value(const std::string& value) { value_ = value; }
147 152
148 // These access the internal accessibility tree, which doesn't necessarily 153 // These access the internal accessibility tree, which doesn't necessarily
149 // reflect the accessibility tree that should be exposed on each platform. 154 // reflect the accessibility tree that should be exposed on each platform.
150 // Use PlatformChildCount and PlatformGetChild to implement platform 155 // Use PlatformChildCount and PlatformGetChild to implement platform
151 // accessibility APIs. 156 // accessibility APIs.
152 uint32 InternalChildCount() const; 157 uint32 InternalChildCount() const;
153 BrowserAccessibility* InternalGetChild(uint32 child_index) const; 158 BrowserAccessibility* InternalGetChild(uint32 child_index) const;
154 159
155 BrowserAccessibility* GetParent() const; 160 BrowserAccessibility* GetParent() const;
156 int32 GetIndexInParent() const; 161 int32 GetIndexInParent() const;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 base::string16* value) const; 212 base::string16* value) const;
208 base::string16 GetString16Attribute( 213 base::string16 GetString16Attribute(
209 ui::AXStringAttribute attribute) const; 214 ui::AXStringAttribute attribute) const;
210 215
211 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; 216 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const;
212 const std::vector<int32>& GetIntListAttribute( 217 const std::vector<int32>& GetIntListAttribute(
213 ui::AXIntListAttribute attribute) const; 218 ui::AXIntListAttribute attribute) const;
214 bool GetIntListAttribute(ui::AXIntListAttribute attribute, 219 bool GetIntListAttribute(ui::AXIntListAttribute attribute,
215 std::vector<int32>* value) const; 220 std::vector<int32>* value) const;
216 221
217 void SetStringAttribute(ui::AXStringAttribute attribute,
218 const std::string& value);
219
220 // Retrieve the value of a html attribute from the attribute map and 222 // Retrieve the value of a html attribute from the attribute map and
221 // returns true if found. 223 // returns true if found.
222 bool GetHtmlAttribute(const char* attr, base::string16* value) const; 224 bool GetHtmlAttribute(const char* attr, base::string16* value) const;
223 bool GetHtmlAttribute(const char* attr, std::string* value) const; 225 bool GetHtmlAttribute(const char* attr, std::string* value) const;
224 226
225 // Utility method to handle special cases for ARIA booleans, tristates and 227 // Utility method to handle special cases for ARIA booleans, tristates and
226 // booleans which have a "mixed" state. 228 // booleans which have a "mixed" state.
227 // 229 //
228 // Warning: the term "Tristate" is used loosely by the spec and here, 230 // Warning: the term "Tristate" is used loosely by the spec and here,
229 // as some attributes support a 4th state. 231 // as some attributes support a 4th state.
(...skipping 13 matching lines...) Expand all
243 245
244 // Returns true if this node is an cell or an table header. 246 // Returns true if this node is an cell or an table header.
245 bool IsCellOrTableHeaderRole() const; 247 bool IsCellOrTableHeaderRole() const;
246 248
247 // Returns true if this node is an editable text field of any kind. 249 // Returns true if this node is an editable text field of any kind.
248 bool IsEditableText() const; 250 bool IsEditableText() const;
249 251
250 // True if this is a web area, and its grandparent is a presentational iframe. 252 // True if this is a web area, and its grandparent is a presentational iframe.
251 bool IsWebAreaForPresentationalIframe() const; 253 bool IsWebAreaForPresentationalIframe() const;
252 254
253 // Append the text from this node and its children.
254 std::string GetTextRecursive() const;
255
256 protected: 255 protected:
257 BrowserAccessibility(); 256 BrowserAccessibility();
258 257
259 // The manager of this tree of accessibility objects. 258 // The manager of this tree of accessibility objects.
260 BrowserAccessibilityManager* manager_; 259 BrowserAccessibilityManager* manager_;
261 260
262 // The underlying node. 261 // The underlying node.
263 ui::AXNode* node_; 262 ui::AXNode* node_;
264 263
265 private: 264 private:
266 // Return the sum of the lengths of all static text descendants, 265 // Return the sum of the lengths of all static text descendants,
267 // including this object if it's static text. 266 // including this object if it's static text.
268 int GetStaticTextLenRecursive() const; 267 int GetStaticTextLenRecursive() const;
269 268
270 std::string name_;
271 std::string value_;
272
273 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 269 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
274 }; 270 };
275 271
276 } // namespace content 272 } // namespace content
277 273
278 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 274 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698