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

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

Issue 7745035: Add a big grab bag of missing web accessibility functionality... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Detach all descendants of this subtree and push all of the node pointers, 46 // Detach all descendants of this subtree and push all of the node pointers,
47 // including this node, onto the end of |nodes|. 47 // including this node, onto the end of |nodes|.
48 virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes); 48 virtual void DetachTree(std::vector<BrowserAccessibility*>* nodes);
49 49
50 // Perform platform specific initialization. This can be called multiple times 50 // Perform platform specific initialization. This can be called multiple times
51 // during the lifetime of this instance after the members of this base object 51 // during the lifetime of this instance after the members of this base object
52 // have been reset with new values from the renderer process. 52 // have been reset with new values from the renderer process.
53 virtual void Initialize(); 53 virtual void Initialize();
54 54
55 // Optionally send events triggered simply by the fact that this node
56 // has been created or modified (and has been attached to the tree).
57 // This can include "show" events, "text changed" events in live regions,
58 // or "alert" events.
59 virtual void SendNodeUpdateEvents() {}
60
55 // Initialize this object, reading attributes from |src|. Does not 61 // Initialize this object, reading attributes from |src|. Does not
56 // recurse into children of |src| and build the whole subtree. 62 // recurse into children of |src| and build the whole subtree.
57 void Initialize(BrowserAccessibilityManager* manager, 63 void Initialize(BrowserAccessibilityManager* manager,
58 BrowserAccessibility* parent, 64 BrowserAccessibility* parent,
59 int32 child_id, 65 int32 child_id,
60 int32 index_in_parent, 66 int32 index_in_parent,
61 const WebAccessibility& src); 67 const WebAccessibility& src);
62 68
63 // Add a child of this object. 69 // Add a child of this object.
64 void AddChild(BrowserAccessibility* child); 70 void AddChild(BrowserAccessibility* child);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const std::map<WebAccessibility::StringAttribute, string16>& 138 const std::map<WebAccessibility::StringAttribute, string16>&
133 string_attributes() const { 139 string_attributes() const {
134 return string_attributes_; 140 return string_attributes_;
135 } 141 }
136 142
137 const std::map<WebAccessibility::IntAttribute, int32>& 143 const std::map<WebAccessibility::IntAttribute, int32>&
138 int_attributes() const { 144 int_attributes() const {
139 return int_attributes_; 145 return int_attributes_;
140 } 146 }
141 147
148 const std::map<WebAccessibility::FloatAttribute, float>&
149 float_attributes() const {
David Tseng 2011/08/26 16:14:37 Indent? (and below).
dmazzoni 2011/08/29 18:08:51 I think this may have been correct, but as a bette
150 return float_attributes_;
151 }
152
153 const std::map<WebAccessibility::BoolAttribute, bool>&
154 bool_attributes() const {
155 return bool_attributes_;
156 }
157
142 int32 child_id() const { return child_id_; } 158 int32 child_id() const { return child_id_; }
143 const std::vector<BrowserAccessibility*>& children() const { 159 const std::vector<BrowserAccessibility*>& children() const {
144 return children_; 160 return children_;
145 } 161 }
146 const std::vector<std::pair<string16, string16> >& html_attributes() const { 162 const std::vector<std::pair<string16, string16> >& html_attributes() const {
147 return html_attributes_; 163 return html_attributes_;
148 } 164 }
149 int32 index_in_parent() const { return index_in_parent_; } 165 int32 index_in_parent() const { return index_in_parent_; }
150 const std::vector<int32>& indirect_child_ids() const { 166 const std::vector<int32>& indirect_child_ids() const {
151 return indirect_child_ids_; 167 return indirect_child_ids_;
152 } 168 }
153 const std::vector<int32>& line_breaks() const { 169 const std::vector<int32>& line_breaks() const {
154 return line_breaks_; 170 return line_breaks_;
155 } 171 }
156 const std::vector<int32>& cell_ids() const { 172 const std::vector<int32>& cell_ids() const {
157 return cell_ids_; 173 return cell_ids_;
158 } 174 }
175 const std::vector<int32>& unique_cell_ids() const {
176 return unique_cell_ids_;
177 }
159 gfx::Rect location() const { return location_; } 178 gfx::Rect location() const { return location_; }
160 BrowserAccessibilityManager* manager() const { return manager_; } 179 BrowserAccessibilityManager* manager() const { return manager_; }
161 const string16& name() const { return name_; } 180 const string16& name() const { return name_; }
162 int32 renderer_id() const { return renderer_id_; } 181 int32 renderer_id() const { return renderer_id_; }
163 int32 role() const { return role_; } 182 int32 role() const { return role_; }
164 const string16& role_name() const { return role_name_; } 183 const string16& role_name() const { return role_name_; }
165 int32 state() const { return state_; } 184 int32 state() const { return state_; }
166 const string16& value() const { return value_; } 185 const string16& value() const { return value_; }
167 bool instance_active() const { return instance_active_; } 186 bool instance_active() const { return instance_active_; }
168 int32 ref_count() const { return ref_count_; } 187 int32 ref_count() const { return ref_count_; }
169 188
170 #if defined(OS_MACOSX) && __OBJC__ 189 #if defined(OS_MACOSX) && __OBJC__
171 BrowserAccessibilityCocoa* toBrowserAccessibilityCocoa(); 190 BrowserAccessibilityCocoa* toBrowserAccessibilityCocoa();
172 #elif defined(OS_WIN) 191 #elif defined(OS_WIN)
173 BrowserAccessibilityWin* toBrowserAccessibilityWin(); 192 BrowserAccessibilityWin* toBrowserAccessibilityWin();
174 #endif 193 #endif
175 194
176 // Retrieve the value of a string attribute from the attribute map and 195 // Retrieve the value of a string attribute from the attribute map and
177 // returns true if found. 196 // returns true if found.
178 bool GetStringAttribute(WebAccessibility::StringAttribute attribute, 197 bool GetStringAttribute(WebAccessibility::StringAttribute attribute,
179 string16* value); 198 string16* value);
180 199
181 // Retrieve the value of an integer attribute from the integer attribute 200 // Retrieve the value of an integer attribute from the integer attribute
182 // map and returns true if found. 201 // map and returns true if found.
183 bool GetIntAttribute(WebAccessibility::IntAttribute attribute, int* value); 202 bool GetIntAttribute(WebAccessibility::IntAttribute attribute, int* value);
184 203
204 // Retrieve the value of a float attribute from the float attribute
205 // map and returns true if found.
206 bool GetFloatAttribute(WebAccessibility::FloatAttribute attr, float* value);
207
208 // Retrieve the value of a bool attribute from the bool attribute
209 // map and returns true if found.
210 bool GetBoolAttribute(WebAccessibility::BoolAttribute attr, bool* value);
211
212 // Retrieve the value of a html attribute from the attribute map and
213 // returns true if found.
214 bool GetHtmlAttribute(const char* attr, string16* value);
215
216 // Returns true if this node is an editable text field of any kind.
217 bool IsEditableText();
218
185 protected: 219 protected:
186 BrowserAccessibility(); 220 BrowserAccessibility();
187 221
188 // The manager of this tree of accessibility objects; needed for 222 // The manager of this tree of accessibility objects; needed for
189 // global operations like focus tracking. 223 // global operations like focus tracking.
190 BrowserAccessibilityManager* manager_; 224 BrowserAccessibilityManager* manager_;
191 225
192 // The parent of this object, may be NULL if we're the root object. 226 // The parent of this object, may be NULL if we're the root object.
193 BrowserAccessibility* parent_; 227 BrowserAccessibility* parent_;
194 228
(...skipping 10 matching lines...) Expand all
205 std::vector<BrowserAccessibility*> children_; 239 std::vector<BrowserAccessibility*> children_;
206 240
207 // The number of internal references to this object. 241 // The number of internal references to this object.
208 int32 ref_count_; 242 int32 ref_count_;
209 243
210 // Accessibility metadata from the renderer 244 // Accessibility metadata from the renderer
211 string16 name_; 245 string16 name_;
212 string16 value_; 246 string16 value_;
213 std::map<WebAccessibility::StringAttribute, string16> string_attributes_; 247 std::map<WebAccessibility::StringAttribute, string16> string_attributes_;
214 std::map<WebAccessibility::IntAttribute, int32> int_attributes_; 248 std::map<WebAccessibility::IntAttribute, int32> int_attributes_;
249 std::map<WebAccessibility::FloatAttribute, float> float_attributes_;
250 std::map<WebAccessibility::BoolAttribute, bool> bool_attributes_;
215 std::vector<std::pair<string16, string16> > html_attributes_; 251 std::vector<std::pair<string16, string16> > html_attributes_;
216 int32 role_; 252 int32 role_;
217 int32 state_; 253 int32 state_;
218 string16 role_name_; 254 string16 role_name_;
219 gfx::Rect location_; 255 gfx::Rect location_;
220 std::vector<int32> indirect_child_ids_; 256 std::vector<int32> indirect_child_ids_;
221 std::vector<int32> line_breaks_; 257 std::vector<int32> line_breaks_;
222 std::vector<int32> cell_ids_; 258 std::vector<int32> cell_ids_;
259 std::vector<int32> unique_cell_ids_;
223 260
224 // BrowserAccessibility objects are reference-counted on some platforms. 261 // BrowserAccessibility objects are reference-counted on some platforms.
225 // When we're done with this object and it's removed from our accessibility 262 // When we're done with this object and it's removed from our accessibility
226 // tree, a client may still be holding onto a pointer to this object, so 263 // tree, a client may still be holding onto a pointer to this object, so
227 // we mark it as inactive so that calls to any of this object's methods 264 // we mark it as inactive so that calls to any of this object's methods
228 // immediately return failure. 265 // immediately return failure.
229 bool instance_active_; 266 bool instance_active_;
230 267
231 private: 268 private:
232 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 269 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
233 }; 270 };
234 271
235 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 272 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698