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

Side by Side Diff: chrome/browser/browser_accessibility.h

Issue 2121004: Windows accessibility improvements: 1. All WebKit roles are now passed to the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_ 5 #ifndef CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_
6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_ 6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_
7 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 #include <oleacc.h> 10 #include <oleacc.h>
(...skipping 13 matching lines...) Expand all
24 // 24 //
25 // Class implementing the MSAA IAccessible COM interface for the 25 // Class implementing the MSAA IAccessible COM interface for the
26 // Browser-Renderer communication of MSAA information, providing accessibility 26 // Browser-Renderer communication of MSAA information, providing accessibility
27 // to be used by screen readers and other assistive technology (AT). 27 // to be used by screen readers and other assistive technology (AT).
28 // 28 //
29 //////////////////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////////////////
30 class ATL_NO_VTABLE BrowserAccessibility 30 class ATL_NO_VTABLE BrowserAccessibility
31 : public CComObjectRootEx<CComMultiThreadModel>, 31 : public CComObjectRootEx<CComMultiThreadModel>,
32 public IDispatchImpl<IAccessible2, &IID_IAccessible2, 32 public IDispatchImpl<IAccessible2, &IID_IAccessible2,
33 &LIBID_IAccessible2Lib>, 33 &LIBID_IAccessible2Lib>,
34 public IAccessibleImage,
35 public IAccessibleText,
34 public IServiceProvider { 36 public IServiceProvider {
35 public: 37 public:
36 BEGIN_COM_MAP(BrowserAccessibility) 38 BEGIN_COM_MAP(BrowserAccessibility)
37 COM_INTERFACE_ENTRY2(IDispatch, IAccessible2) 39 COM_INTERFACE_ENTRY2(IDispatch, IAccessible2)
38 COM_INTERFACE_ENTRY2(IAccessible, IAccessible2) 40 COM_INTERFACE_ENTRY2(IAccessible, IAccessible2)
39 COM_INTERFACE_ENTRY(IAccessible2) 41 COM_INTERFACE_ENTRY(IAccessible2)
42 COM_INTERFACE_ENTRY(IAccessibleImage)
43 COM_INTERFACE_ENTRY(IAccessibleText)
40 COM_INTERFACE_ENTRY(IServiceProvider) 44 COM_INTERFACE_ENTRY(IServiceProvider)
41 END_COM_MAP() 45 END_COM_MAP()
42 46
43 BrowserAccessibility(); 47 BrowserAccessibility();
44 48
45 virtual ~BrowserAccessibility(); 49 virtual ~BrowserAccessibility();
46 50
47 // Initialize this object and mark it as active. 51 // Initialize this object and mark it as active.
48 void Initialize(BrowserAccessibilityManager* manager, 52 void Initialize(BrowserAccessibilityManager* manager,
49 BrowserAccessibility* parent, 53 BrowserAccessibility* parent,
(...skipping 14 matching lines...) Expand all
64 68
65 // Return the previous sibling of this object, or NULL if it's the first 69 // Return the previous sibling of this object, or NULL if it's the first
66 // child of its parent. 70 // child of its parent.
67 BrowserAccessibility* GetPreviousSibling(); 71 BrowserAccessibility* GetPreviousSibling();
68 72
69 // Return the next sibling of this object, or NULL if it's the last child 73 // Return the next sibling of this object, or NULL if it's the last child
70 // of its parent. 74 // of its parent.
71 BrowserAccessibility* GetNextSibling(); 75 BrowserAccessibility* GetNextSibling();
72 76
73 // Accessors 77 // Accessors
74 LONG child_id() { return child_id_; } 78 LONG child_id() const { return child_id_; }
79 int32 renderer_id() const { return renderer_id_; }
75 80
76 // Add one to the reference count and return the same object. Always 81 // Add one to the reference count and return the same object. Always
77 // use this method when returning a BrowserAccessibility object as 82 // use this method when returning a BrowserAccessibility object as
78 // an output parameter to a COM interface, never use it otherwise. 83 // an output parameter to a COM interface, never use it otherwise.
79 BrowserAccessibility* NewReference(); 84 BrowserAccessibility* NewReference();
80 85
81 // 86 //
82 // IAccessible methods. 87 // IAccessible methods.
83 // 88 //
84 89
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // 159 //
155 // IAccessible2 methods. 160 // IAccessible2 methods.
156 // 161 //
157 162
158 // Returns role from a longer list of possible roles. 163 // Returns role from a longer list of possible roles.
159 STDMETHODIMP role(LONG* role); 164 STDMETHODIMP role(LONG* role);
160 165
161 // Returns the state bitmask from a larger set of possible states. 166 // Returns the state bitmask from a larger set of possible states.
162 STDMETHODIMP get_states(AccessibleStates* states); 167 STDMETHODIMP get_states(AccessibleStates* states);
163 168
169 // Returns the attributes specific to this IAccessible2 object,
170 // such as a cell's formula.
171 STDMETHODIMP get_attributes(BSTR* attributes);
172
164 // Get the unique ID of this object so that the client knows if it's 173 // Get the unique ID of this object so that the client knows if it's
165 // been encountered previously. 174 // been encountered previously.
166 STDMETHODIMP get_uniqueID(LONG* unique_id); 175 STDMETHODIMP get_uniqueID(LONG* unique_id);
167 176
168 // Get the window handle of the enclosing window. 177 // Get the window handle of the enclosing window.
169 STDMETHODIMP get_windowHandle(HWND* window_handle); 178 STDMETHODIMP get_windowHandle(HWND* window_handle);
170 179
171 // Get this object's index in its parent object. 180 // Get this object's index in its parent object.
172 STDMETHODIMP get_indexInParent(LONG* index_in_parent); 181 STDMETHODIMP get_indexInParent(LONG* index_in_parent);
173 182
174 // IAccessible2 methods not implemented. 183 // IAccessible2 methods not implemented.
175 STDMETHODIMP get_extendedRole(BSTR* extended_role) { 184 STDMETHODIMP get_extendedRole(BSTR* extended_role) {
176 return E_NOTIMPL; 185 return E_NOTIMPL;
177 } 186 }
178 STDMETHODIMP get_nRelations(LONG* n_relations) { 187 STDMETHODIMP get_nRelations(LONG* n_relations) {
179 return E_NOTIMPL; 188 return E_NOTIMPL;
180 } 189 }
181 STDMETHODIMP get_relation(LONG relation_index, 190 STDMETHODIMP get_relation(LONG relation_index,
182 IAccessibleRelation** relation) { 191 IAccessibleRelation** relation) {
183 return E_NOTIMPL; 192 return E_NOTIMPL;
184 } 193 }
185 STDMETHODIMP get_relations(LONG max_relations, 194 STDMETHODIMP get_relations(LONG max_relations,
186 IAccessibleRelation** relations, 195 IAccessibleRelation** relations,
187 LONG *n_relations) { 196 LONG* n_relations) {
188 return E_NOTIMPL; 197 return E_NOTIMPL;
189 } 198 }
190 STDMETHODIMP scrollTo(enum IA2ScrollType scroll_type) { 199 STDMETHODIMP scrollTo(enum IA2ScrollType scroll_type) {
191 return E_NOTIMPL; 200 return E_NOTIMPL;
192 } 201 }
193 STDMETHODIMP scrollToPoint(enum IA2CoordinateType coordinate_type, 202 STDMETHODIMP scrollToPoint(enum IA2CoordinateType coordinate_type,
194 LONG x, 203 LONG x,
195 LONG y) { 204 LONG y) {
196 return E_NOTIMPL; 205 return E_NOTIMPL;
197 } 206 }
(...skipping 14 matching lines...) Expand all
212 return E_NOTIMPL; 221 return E_NOTIMPL;
213 } 222 }
214 STDMETHODIMP get_localizedExtendedStates(LONG max_localized_extended_states, 223 STDMETHODIMP get_localizedExtendedStates(LONG max_localized_extended_states,
215 BSTR** localized_extended_states, 224 BSTR** localized_extended_states,
216 LONG* n_localized_extended_states) { 225 LONG* n_localized_extended_states) {
217 return E_NOTIMPL; 226 return E_NOTIMPL;
218 } 227 }
219 STDMETHODIMP get_locale(IA2Locale* locale) { 228 STDMETHODIMP get_locale(IA2Locale* locale) {
220 return E_NOTIMPL; 229 return E_NOTIMPL;
221 } 230 }
222 STDMETHODIMP get_attributes(BSTR* attributes) { 231
232 //
233 // IAccessibleImage methods.
234 //
235
236 STDMETHODIMP get_description(BSTR* description);
237
238 STDMETHODIMP get_imagePosition(enum IA2CoordinateType coordinate_type,
239 long* x, long* y);
240
241 STDMETHODIMP get_imageSize(long* height, long* width);
242
243 //
244 // IAccessibleText methods.
245 //
246
247 STDMETHODIMP get_nCharacters(long* n_characters);
248
249 STDMETHODIMP get_text(long start_offset, long end_offset, BSTR* text);
250
251 STDMETHODIMP get_caretOffset(long* offset);
252
253 // IAccessibleText methods not implemented.
254 STDMETHODIMP addSelection(long start_offset, long end_offset) {
255 return E_NOTIMPL;
256 }
257 STDMETHODIMP get_attributes(long offset, long* start_offset, long* end_offset,
258 BSTR* text_attributes) {
259 return E_NOTIMPL;
260 }
261 STDMETHODIMP get_characterExtents(long offset,
262 enum IA2CoordinateType coord_type,
263 long* x, long* y,
264 long* width, long* height) {
265 return E_NOTIMPL;
266 }
267 STDMETHODIMP get_nSelections(long* n_selections) {
268 return E_NOTIMPL;
269 }
270 STDMETHODIMP get_offsetAtPoint(long x, long y,
271 enum IA2CoordinateType coord_type,
272 long* offset) {
273 return E_NOTIMPL;
274 }
275 STDMETHODIMP get_selection(long selection_index,
276 long* start_offset,
277 long* end_offset) {
278 return E_NOTIMPL;
279 }
280 STDMETHODIMP get_textBeforeOffset(long offset,
281 enum IA2TextBoundaryType boundary_type,
282 long* start_offset, long* end_offset,
283 BSTR* text) {
284 return E_NOTIMPL;
285 }
286 STDMETHODIMP get_textAfterOffset(long offset,
287 enum IA2TextBoundaryType boundary_type,
288 long* start_offset, long* end_offset,
289 BSTR* text) {
290 return E_NOTIMPL;
291 }
292 STDMETHODIMP get_textAtOffset(long offset,
293 enum IA2TextBoundaryType boundary_type,
294 long* start_offset, long* end_offset,
295 BSTR* text) {
296 return E_NOTIMPL;
297 }
298 STDMETHODIMP removeSelection(long selection_index) {
299 return E_NOTIMPL;
300 }
301 STDMETHODIMP setCaretOffset(long offset) {
302 return E_NOTIMPL;
303 }
304 STDMETHODIMP setSelection(long selection_index,
305 long start_offset,
306 long end_offset) {
307 return E_NOTIMPL;
308 }
309 STDMETHODIMP scrollSubstringTo(long start_index,
310 long end_index,
311 enum IA2ScrollType scroll_type) {
312 return E_NOTIMPL;
313 }
314 STDMETHODIMP scrollSubstringToPoint(long start_index, long end_index,
315 enum IA2CoordinateType coordinate_type,
316 long x, long y) {
317 return E_NOTIMPL;
318 }
319 STDMETHODIMP get_newText(IA2TextSegment* new_text) {
320 return E_NOTIMPL;
321 }
322 STDMETHODIMP get_oldText(IA2TextSegment* old_text) {
223 return E_NOTIMPL; 323 return E_NOTIMPL;
224 } 324 }
225 325
226 // 326 //
227 // IServiceProvider methods. 327 // IServiceProvider methods.
228 // 328 //
229 329
230 STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** object); 330 STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** object);
231 331
332 //
333 // CComObjectRootEx methods.
334 //
335
336 HRESULT WINAPI InternalQueryInterface(void* this_ptr,
337 const _ATL_INTMAP_ENTRY* entries,
338 REFIID iid,
339 void** object);
340
232 private: 341 private:
233 // Many MSAA methods take a var_id parameter indicating that the operation 342 // Many MSAA methods take a var_id parameter indicating that the operation
234 // should be performed on a particular child ID, rather than this object. 343 // should be performed on a particular child ID, rather than this object.
235 // This method tries to figure out the target object from |var_id| and 344 // This method tries to figure out the target object from |var_id| and
236 // returns a pointer to the target object if it exists, otherwise NULL. 345 // returns a pointer to the target object if it exists, otherwise NULL.
237 // Does not return a new reference. 346 // Does not return a new reference.
238 BrowserAccessibility* GetTargetFromChildID(const VARIANT& var_id); 347 BrowserAccessibility* GetTargetFromChildID(const VARIANT& var_id);
239 348
240 // Returns a conversion from the BrowserAccessibilityRole (as defined in 349 // Initialize the role and state metadata from the role enum and state
241 // webkit/glue/webaccessibility.h) to an MSAA role. 350 // bitmasks defined in webkit/glue/webaccessibility.h.
242 LONG MSAARole(LONG browser_accessibility_role); 351 void InitRoleAndState(LONG web_accessibility_role,
352 LONG web_accessibility_state);
243 353
244 // Returns a conversion from the BrowserAccessibilityState (as defined in 354 // Return true if this attribute is in the attributes map.
245 // webkit/glue/webaccessibility.h) to MSAA states set. 355 bool HasAttribute(WebAccessibility::Attribute attribute);
246 LONG MSAAState(LONG browser_accessibility_state); 356
357 // Retrieve the string value of an attribute from the attribute map and
358 // returns true if found.
359 bool GetAttribute(WebAccessibility::Attribute attribute, string16* value);
247 360
248 // The manager of this tree of accessibility objects; needed for 361 // The manager of this tree of accessibility objects; needed for
249 // global operations like focus tracking. 362 // global operations like focus tracking.
250 BrowserAccessibilityManager* manager_; 363 BrowserAccessibilityManager* manager_;
251 // The parent of this object, may be NULL if we're the root object. 364 // The parent of this object, may be NULL if we're the root object.
252 BrowserAccessibility* parent_; 365 BrowserAccessibility* parent_;
253 // The ID of this object; globally unique within the browser process. 366 // The ID of this object; globally unique within the browser process.
254 LONG child_id_; 367 LONG child_id_;
255 // The index of this within its parent object. 368 // The index of this within its parent object.
256 LONG index_in_parent_; 369 LONG index_in_parent_;
257 // The ID of this object in the renderer process. 370 // The ID of this object in the renderer process.
258 int32 renderer_id_; 371 int32 renderer_id_;
259 372
260 // The children of this object. 373 // The children of this object.
261 std::vector<BrowserAccessibility*> children_; 374 std::vector<BrowserAccessibility*> children_;
262 375
263 // Accessibility metadata from the renderer, used to respond to MSAA 376 // Accessibility metadata from the renderer, used to respond to MSAA
264 // events. 377 // events.
265 string16 name_; 378 string16 name_;
266 string16 value_; 379 string16 value_;
267 string16 action_; 380 std::map<int32, string16> attributes_;
268 string16 description_; 381
269 string16 help_;
270 string16 shortcut_;
271 LONG role_; 382 LONG role_;
272 LONG state_; 383 LONG state_;
384 string16 role_name_;
385 LONG ia2_role_;
386 LONG ia2_state_;
273 WebKit::WebRect location_; 387 WebKit::WebRect location_;
274 388
275 // COM objects are reference-counted. When we're done with this object 389 // COM objects are reference-counted. When we're done with this object
276 // and it's removed from our accessibility tree, a client may still be 390 // and it's removed from our accessibility tree, a client may still be
277 // holding onto a pointer to this object, so we mark it as inactive 391 // holding onto a pointer to this object, so we mark it as inactive
278 // so that calls to any of this object's methods immediately return 392 // so that calls to any of this object's methods immediately return
279 // failure. 393 // failure.
280 bool instance_active_; 394 bool instance_active_;
281 395
282 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 396 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
283 }; 397 };
284 398
285 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_ 399 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698