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

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

Issue 880523002: Revert of Send Windows accessibility events based on tree updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implicit_1_tests
Patch Set: 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
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {} 65 // Returns true if this is a native platform-specific object, vs a
66 66 // cross-platform generic object.
67 virtual void OnSubtreeCreationFinished() {} 67 virtual bool IsNative() const;
68 68
69 // Called when the location changed. 69 // Called when the location changed.
70 virtual void OnLocationChanged() {} 70 virtual void OnLocationChanged() {}
71 71
72 // Return true if this object is equal to or a descendant of |ancestor|. 72 // Return true if this object is equal to or a descendant of |ancestor|.
73 bool IsDescendantOf(BrowserAccessibility* ancestor); 73 bool IsDescendantOf(BrowserAccessibility* ancestor);
74 74
75 // Returns true if this is a leaf node on this platform, meaning any 75 // 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 76 // children should not be exposed to this platform's native accessibility
77 // layer. Each platform subclass should implement this itself. 77 // layer. Each platform subclass should implement this itself.
78 // The definition of a leaf may vary depending on the platform, 78 // The definition of a leaf may vary depending on the platform,
79 // but a leaf node should never have children that are focusable or 79 // but a leaf node should never have children that are focusable or
80 // that might send notifications. 80 // that might send notifications.
81 virtual bool PlatformIsLeaf() const; 81 virtual bool PlatformIsLeaf() const;
82 82
83 // Returns the number of children of this object, or 0 if PlatformIsLeaf() 83 // Returns the number of children of this object, or 0 if PlatformIsLeaf()
84 // returns true. 84 // returns true.
85 uint32 PlatformChildCount() const; 85 uint32 PlatformChildCount() const;
86 86
87 // Return a pointer to the child at the given index, or NULL for an 87 // Return a pointer to the child at the given index, or NULL for an
88 // invalid index. Returns NULL if PlatformIsLeaf() returns true. 88 // invalid index. Returns NULL if PlatformIsLeaf() returns true.
89 BrowserAccessibility* PlatformGetChild(uint32 child_index) const; 89 BrowserAccessibility* PlatformGetChild(uint32 child_index) const;
90 90
91 // Returns true if an ancestor of this node (not including itself) is a
92 // leaf node, meaning that this node is not actually exposed to the
93 // platform.
94 bool PlatformIsChildOfLeaf() const;
95
96 // Return the previous sibling of this object, or NULL if it's the first 91 // Return the previous sibling of this object, or NULL if it's the first
97 // child of its parent. 92 // child of its parent.
98 BrowserAccessibility* GetPreviousSibling(); 93 BrowserAccessibility* GetPreviousSibling();
99 94
100 // Return the next sibling of this object, or NULL if it's the last child 95 // Return the next sibling of this object, or NULL if it's the last child
101 // of its parent. 96 // of its parent.
102 BrowserAccessibility* GetNextSibling(); 97 BrowserAccessibility* GetNextSibling();
103 98
104 // Returns the bounds of this object in coordinates relative to the 99 // Returns the bounds of this object in coordinates relative to the
105 // top-left corner of the overall web area. 100 // top-left corner of the overall web area.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Subclasses should override this to support platform reference counting. 133 // Subclasses should override this to support platform reference counting.
139 virtual void NativeReleaseReference(); 134 virtual void NativeReleaseReference();
140 135
141 // 136 //
142 // Accessors 137 // Accessors
143 // 138 //
144 139
145 BrowserAccessibilityManager* manager() const { return manager_; } 140 BrowserAccessibilityManager* manager() const { return manager_; }
146 bool instance_active() const { return node_ != NULL; } 141 bool instance_active() const { return node_ != NULL; }
147 ui::AXNode* node() const { return node_; } 142 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; }
148 147
149 // These access the internal accessibility tree, which doesn't necessarily 148 // These access the internal accessibility tree, which doesn't necessarily
150 // reflect the accessibility tree that should be exposed on each platform. 149 // reflect the accessibility tree that should be exposed on each platform.
151 // Use PlatformChildCount and PlatformGetChild to implement platform 150 // Use PlatformChildCount and PlatformGetChild to implement platform
152 // accessibility APIs. 151 // accessibility APIs.
153 uint32 InternalChildCount() const; 152 uint32 InternalChildCount() const;
154 BrowserAccessibility* InternalGetChild(uint32 child_index) const; 153 BrowserAccessibility* InternalGetChild(uint32 child_index) const;
155 154
156 BrowserAccessibility* GetParent() const; 155 BrowserAccessibility* GetParent() const;
157 int32 GetIndexInParent() const; 156 int32 GetIndexInParent() const;
158 157
159 int32 GetId() const; 158 int32 GetId() const;
160 const ui::AXNodeData& GetData() const; 159 const ui::AXNodeData& GetData() const;
161 gfx::Rect GetLocation() const; 160 gfx::Rect GetLocation() const;
162 int32 GetRole() const; 161 int32 GetRole() const;
163 int32 GetState() const; 162 int32 GetState() const;
164 163
165 typedef base::StringPairs HtmlAttributes; 164 typedef base::StringPairs HtmlAttributes;
166 const HtmlAttributes& GetHtmlAttributes() const; 165 const HtmlAttributes& GetHtmlAttributes() const;
167 166
168
169 // Returns true if this is a native platform-specific object, vs a
170 // cross-platform generic object. Don't call ToBrowserAccessibilityXXX if
171 // IsNative returns false.
172 virtual bool IsNative() const;
173
174 #if defined(OS_MACOSX) && __OBJC__ 167 #if defined(OS_MACOSX) && __OBJC__
175 BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa(); 168 BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa();
176 #elif defined(OS_WIN) 169 #elif defined(OS_WIN)
177 BrowserAccessibilityWin* ToBrowserAccessibilityWin(); 170 BrowserAccessibilityWin* ToBrowserAccessibilityWin();
178 #endif 171 #endif
179 172
180 // Accessing accessibility attributes: 173 // Accessing accessibility attributes:
181 // 174 //
182 // There are dozens of possible attributes for an accessibility node, 175 // There are dozens of possible attributes for an accessibility node,
183 // but only a few tend to apply to any one object, so we store them 176 // but only a few tend to apply to any one object, so we store them
(...skipping 30 matching lines...) Expand all
214 base::string16* value) const; 207 base::string16* value) const;
215 base::string16 GetString16Attribute( 208 base::string16 GetString16Attribute(
216 ui::AXStringAttribute attribute) const; 209 ui::AXStringAttribute attribute) const;
217 210
218 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; 211 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const;
219 const std::vector<int32>& GetIntListAttribute( 212 const std::vector<int32>& GetIntListAttribute(
220 ui::AXIntListAttribute attribute) const; 213 ui::AXIntListAttribute attribute) const;
221 bool GetIntListAttribute(ui::AXIntListAttribute attribute, 214 bool GetIntListAttribute(ui::AXIntListAttribute attribute,
222 std::vector<int32>* value) const; 215 std::vector<int32>* value) const;
223 216
217 void SetStringAttribute(ui::AXStringAttribute attribute,
218 const std::string& value);
219
224 // Retrieve the value of a html attribute from the attribute map and 220 // Retrieve the value of a html attribute from the attribute map and
225 // returns true if found. 221 // returns true if found.
226 bool GetHtmlAttribute(const char* attr, base::string16* value) const; 222 bool GetHtmlAttribute(const char* attr, base::string16* value) const;
227 bool GetHtmlAttribute(const char* attr, std::string* value) const; 223 bool GetHtmlAttribute(const char* attr, std::string* value) const;
228 224
229 // Utility method to handle special cases for ARIA booleans, tristates and 225 // Utility method to handle special cases for ARIA booleans, tristates and
230 // booleans which have a "mixed" state. 226 // booleans which have a "mixed" state.
231 // 227 //
232 // Warning: the term "Tristate" is used loosely by the spec and here, 228 // Warning: the term "Tristate" is used loosely by the spec and here,
233 // as some attributes support a 4th state. 229 // as some attributes support a 4th state.
(...skipping 13 matching lines...) Expand all
247 243
248 // Returns true if this node is an cell or an table header. 244 // Returns true if this node is an cell or an table header.
249 bool IsCellOrTableHeaderRole() const; 245 bool IsCellOrTableHeaderRole() const;
250 246
251 // Returns true if this node is an editable text field of any kind. 247 // Returns true if this node is an editable text field of any kind.
252 bool IsEditableText() const; 248 bool IsEditableText() const;
253 249
254 // True if this is a web area, and its grandparent is a presentational iframe. 250 // True if this is a web area, and its grandparent is a presentational iframe.
255 bool IsWebAreaForPresentationalIframe() const; 251 bool IsWebAreaForPresentationalIframe() const;
256 252
253 // Append the text from this node and its children.
254 std::string GetTextRecursive() const;
255
257 protected: 256 protected:
258 BrowserAccessibility(); 257 BrowserAccessibility();
259 258
260 // The manager of this tree of accessibility objects. 259 // The manager of this tree of accessibility objects.
261 BrowserAccessibilityManager* manager_; 260 BrowserAccessibilityManager* manager_;
262 261
263 // The underlying node. 262 // The underlying node.
264 ui::AXNode* node_; 263 ui::AXNode* node_;
265 264
266 private: 265 private:
267 // Return the sum of the lengths of all static text descendants, 266 // Return the sum of the lengths of all static text descendants,
268 // including this object if it's static text. 267 // including this object if it's static text.
269 int GetStaticTextLenRecursive() const; 268 int GetStaticTextLenRecursive() const;
270 269
271 // Similar to GetParent(), but includes nodes that are the host of a 270 // Similar to GetParent(), but includes nodes that are the host of a
272 // subtree rather than skipping over them - because they contain important 271 // subtree rather than skipping over them - because they contain important
273 // bounds offsets. 272 // bounds offsets.
274 BrowserAccessibility* GetParentForBoundsCalculation() const; 273 BrowserAccessibility* GetParentForBoundsCalculation() const;
275 274
275 std::string name_;
276 std::string value_;
277
276 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 278 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
277 }; 279 };
278 280
279 } // namespace content 281 } // namespace content
280 282
281 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 283 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698