| OLD | NEW |
| 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_WIN_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_ACCESSIBILITY_WIN_H_ |
| 6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_WIN_H_ | 6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <atlbase.h> | 9 #include <atlbase.h> |
| 10 #include <atlcom.h> | 10 #include <atlcom.h> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // 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|. |
| 77 bool IsDescendantOf(BrowserAccessibility* ancestor); | 77 bool IsDescendantOf(BrowserAccessibility* ancestor); |
| 78 | 78 |
| 79 // Returns the parent of this object, or NULL if it's the BrowserAccessibility | 79 // Returns the parent of this object, or NULL if it's the BrowserAccessibility |
| 80 // root. | 80 // root. |
| 81 BrowserAccessibility* GetParent(); | 81 BrowserAccessibility* GetParent(); |
| 82 | 82 |
| 83 // Returns the number of children of this BrowserAccessibility object. | 83 // Returns the number of children of this BrowserAccessibility object. |
| 84 uint32 GetChildCount(); | 84 uint32 GetChildCount(); |
| 85 | 85 |
| 86 // Return a pointer to the child with the given index. |
| 87 BrowserAccessibility* GetChild(uint32 child_index); |
| 88 |
| 86 // Return the previous sibling of this object, or NULL if it's the first | 89 // Return the previous sibling of this object, or NULL if it's the first |
| 87 // child of its parent. | 90 // child of its parent. |
| 88 BrowserAccessibility* GetPreviousSibling(); | 91 BrowserAccessibility* GetPreviousSibling(); |
| 89 | 92 |
| 90 // Return the next sibling of this object, or NULL if it's the last child | 93 // Return the next sibling of this object, or NULL if it's the last child |
| 91 // of its parent. | 94 // of its parent. |
| 92 BrowserAccessibility* GetNextSibling(); | 95 BrowserAccessibility* GetNextSibling(); |
| 93 | 96 |
| 94 // Replace a child BrowserAccessibility object. Used when updating the | 97 // Replace a child BrowserAccessibility object. Used when updating the |
| 95 // accessibility tree. | 98 // accessibility tree. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return E_NOTIMPL; | 255 return E_NOTIMPL; |
| 253 } | 256 } |
| 254 | 257 |
| 255 // | 258 // |
| 256 // IAccessibleImage methods. | 259 // IAccessibleImage methods. |
| 257 // | 260 // |
| 258 | 261 |
| 259 STDMETHODIMP get_description(BSTR* description); | 262 STDMETHODIMP get_description(BSTR* description); |
| 260 | 263 |
| 261 STDMETHODIMP get_imagePosition(enum IA2CoordinateType coordinate_type, | 264 STDMETHODIMP get_imagePosition(enum IA2CoordinateType coordinate_type, |
| 262 long* x, long* y); | 265 LONG* x, LONG* y); |
| 263 | 266 |
| 264 STDMETHODIMP get_imageSize(long* height, long* width); | 267 STDMETHODIMP get_imageSize(LONG* height, LONG* width); |
| 265 | 268 |
| 266 // | 269 // |
| 267 // IAccessibleText methods. | 270 // IAccessibleText methods. |
| 268 // | 271 // |
| 269 | 272 |
| 270 STDMETHODIMP get_nCharacters(long* n_characters); | 273 STDMETHODIMP get_nCharacters(LONG* n_characters); |
| 271 | 274 |
| 272 STDMETHODIMP get_text(long start_offset, long end_offset, BSTR* text); | 275 STDMETHODIMP get_text(LONG start_offset, LONG end_offset, BSTR* text); |
| 273 | 276 |
| 274 STDMETHODIMP get_caretOffset(long* offset); | 277 STDMETHODIMP get_caretOffset(LONG* offset); |
| 278 |
| 279 STDMETHODIMP get_nSelections(LONG* n_selections); |
| 280 |
| 281 STDMETHODIMP get_selection(LONG selection_index, |
| 282 LONG* start_offset, |
| 283 LONG* end_offset); |
| 275 | 284 |
| 276 // IAccessibleText methods not implemented. | 285 // IAccessibleText methods not implemented. |
| 277 STDMETHODIMP addSelection(long start_offset, long end_offset) { | 286 STDMETHODIMP addSelection(LONG start_offset, LONG end_offset) { |
| 278 return E_NOTIMPL; | 287 return E_NOTIMPL; |
| 279 } | 288 } |
| 280 STDMETHODIMP get_attributes(long offset, long* start_offset, long* end_offset, | 289 STDMETHODIMP get_attributes(LONG offset, LONG* start_offset, LONG* end_offset, |
| 281 BSTR* text_attributes) { | 290 BSTR* text_attributes) { |
| 282 return E_NOTIMPL; | 291 return E_NOTIMPL; |
| 283 } | 292 } |
| 284 STDMETHODIMP get_characterExtents(long offset, | 293 STDMETHODIMP get_characterExtents(LONG offset, |
| 285 enum IA2CoordinateType coord_type, | 294 enum IA2CoordinateType coord_type, |
| 286 long* x, long* y, | 295 LONG* x, LONG* y, |
| 287 long* width, long* height) { | 296 LONG* width, LONG* height) { |
| 288 return E_NOTIMPL; | 297 return E_NOTIMPL; |
| 289 } | 298 } |
| 290 STDMETHODIMP get_nSelections(long* n_selections) { | 299 STDMETHODIMP get_offsetAtPoint(LONG x, LONG y, |
| 300 enum IA2CoordinateType coord_type, |
| 301 LONG* offset) { |
| 291 return E_NOTIMPL; | 302 return E_NOTIMPL; |
| 292 } | 303 } |
| 293 STDMETHODIMP get_offsetAtPoint(long x, long y, | 304 STDMETHODIMP get_textBeforeOffset(LONG offset, |
| 294 enum IA2CoordinateType coord_type, | 305 enum IA2TextBoundaryType boundary_type, |
| 295 long* offset) { | 306 LONG* start_offset, LONG* end_offset, |
| 307 BSTR* text) { |
| 296 return E_NOTIMPL; | 308 return E_NOTIMPL; |
| 297 } | 309 } |
| 298 STDMETHODIMP get_selection(long selection_index, | 310 STDMETHODIMP get_textAfterOffset(LONG offset, |
| 299 long* start_offset, | 311 enum IA2TextBoundaryType boundary_type, |
| 300 long* end_offset) { | 312 LONG* start_offset, LONG* end_offset, |
| 313 BSTR* text) { |
| 301 return E_NOTIMPL; | 314 return E_NOTIMPL; |
| 302 } | 315 } |
| 303 STDMETHODIMP get_textBeforeOffset(long offset, | 316 STDMETHODIMP get_textAtOffset(LONG offset, |
| 304 enum IA2TextBoundaryType boundary_type, | 317 enum IA2TextBoundaryType boundary_type, |
| 305 long* start_offset, long* end_offset, | 318 LONG* start_offset, LONG* end_offset, |
| 306 BSTR* text) { | 319 BSTR* text) { |
| 307 return E_NOTIMPL; | 320 return E_NOTIMPL; |
| 308 } | 321 } |
| 309 STDMETHODIMP get_textAfterOffset(long offset, | 322 STDMETHODIMP removeSelection(LONG selection_index) { |
| 310 enum IA2TextBoundaryType boundary_type, | |
| 311 long* start_offset, long* end_offset, | |
| 312 BSTR* text) { | |
| 313 return E_NOTIMPL; | 323 return E_NOTIMPL; |
| 314 } | 324 } |
| 315 STDMETHODIMP get_textAtOffset(long offset, | 325 STDMETHODIMP setCaretOffset(LONG offset) { |
| 316 enum IA2TextBoundaryType boundary_type, | |
| 317 long* start_offset, long* end_offset, | |
| 318 BSTR* text) { | |
| 319 return E_NOTIMPL; | 326 return E_NOTIMPL; |
| 320 } | 327 } |
| 321 STDMETHODIMP removeSelection(long selection_index) { | 328 STDMETHODIMP setSelection(LONG selection_index, |
| 329 LONG start_offset, |
| 330 LONG end_offset) { |
| 322 return E_NOTIMPL; | 331 return E_NOTIMPL; |
| 323 } | 332 } |
| 324 STDMETHODIMP setCaretOffset(long offset) { | 333 STDMETHODIMP scrollSubstringTo(LONG start_index, |
| 325 return E_NOTIMPL; | 334 LONG end_index, |
| 326 } | |
| 327 STDMETHODIMP setSelection(long selection_index, | |
| 328 long start_offset, | |
| 329 long end_offset) { | |
| 330 return E_NOTIMPL; | |
| 331 } | |
| 332 STDMETHODIMP scrollSubstringTo(long start_index, | |
| 333 long end_index, | |
| 334 enum IA2ScrollType scroll_type) { | 335 enum IA2ScrollType scroll_type) { |
| 335 return E_NOTIMPL; | 336 return E_NOTIMPL; |
| 336 } | 337 } |
| 337 STDMETHODIMP scrollSubstringToPoint(long start_index, long end_index, | 338 STDMETHODIMP scrollSubstringToPoint(LONG start_index, LONG end_index, |
| 338 enum IA2CoordinateType coordinate_type, | 339 enum IA2CoordinateType coordinate_type, |
| 339 long x, long y) { | 340 LONG x, LONG y) { |
| 340 return E_NOTIMPL; | 341 return E_NOTIMPL; |
| 341 } | 342 } |
| 342 STDMETHODIMP get_newText(IA2TextSegment* new_text) { | 343 STDMETHODIMP get_newText(IA2TextSegment* new_text) { |
| 343 return E_NOTIMPL; | 344 return E_NOTIMPL; |
| 344 } | 345 } |
| 345 STDMETHODIMP get_oldText(IA2TextSegment* old_text) { | 346 STDMETHODIMP get_oldText(IA2TextSegment* old_text) { |
| 346 return E_NOTIMPL; | 347 return E_NOTIMPL; |
| 347 } | 348 } |
| 348 | 349 |
| 349 // | 350 // |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Retrieve the string value of an attribute from the attribute map and | 504 // Retrieve the string value of an attribute from the attribute map and |
| 504 // returns true if found. | 505 // returns true if found. |
| 505 bool GetAttribute(WebAccessibility::Attribute attribute, string16* value); | 506 bool GetAttribute(WebAccessibility::Attribute attribute, string16* value); |
| 506 | 507 |
| 507 // Retrieve the string value of an attribute from the attribute map and | 508 // Retrieve the string value of an attribute from the attribute map and |
| 508 // if found and nonempty, allocate a new BSTR (with SysAllocString) | 509 // if found and nonempty, allocate a new BSTR (with SysAllocString) |
| 509 // and return S_OK. If not found or empty, return S_FALSE. | 510 // and return S_OK. If not found or empty, return S_FALSE. |
| 510 HRESULT GetAttributeAsBstr( | 511 HRESULT GetAttributeAsBstr( |
| 511 WebAccessibility::Attribute attribute, BSTR* value_bstr); | 512 WebAccessibility::Attribute attribute, BSTR* value_bstr); |
| 512 | 513 |
| 514 // Retrieve the value of an attribute from the attribute map and |
| 515 // if found and nonempty, try to convert it to an integer. |
| 516 // Returns true only if both the attribute was found and it was successfully |
| 517 // converted to an integer. |
| 518 bool GetAttributeAsInt( |
| 519 WebAccessibility::Attribute attribute, int* value_int); |
| 520 |
| 513 // Escape a string like it would be escaped for a URL or HTML form. | 521 // Escape a string like it would be escaped for a URL or HTML form. |
| 514 string16 Escape(string16 str); | 522 string16 Escape(string16 str); |
| 515 | 523 |
| 516 // The manager of this tree of accessibility objects; needed for | 524 // The manager of this tree of accessibility objects; needed for |
| 517 // global operations like focus tracking. | 525 // global operations like focus tracking. |
| 518 BrowserAccessibilityManager* manager_; | 526 BrowserAccessibilityManager* manager_; |
| 519 // The parent of this object, may be NULL if we're the root object. | 527 // The parent of this object, may be NULL if we're the root object. |
| 520 BrowserAccessibility* parent_; | 528 BrowserAccessibility* parent_; |
| 521 // The ID of this object; globally unique within the browser process. | 529 // The ID of this object; globally unique within the browser process. |
| 522 LONG child_id_; | 530 LONG child_id_; |
| 523 // The index of this within its parent object. | 531 // The index of this within its parent object. |
| 524 LONG index_in_parent_; | 532 LONG index_in_parent_; |
| 525 // The ID of this object in the renderer process. | 533 // The ID of this object in the renderer process. |
| 526 int32 renderer_id_; | 534 int32 renderer_id_; |
| 527 | 535 |
| 528 // The children of this object. | 536 // The children of this object. |
| 529 std::vector<BrowserAccessibility*> children_; | 537 std::vector<BrowserAccessibility*> children_; |
| 530 | 538 |
| 531 // Accessibility metadata from the renderer, used to respond to MSAA | 539 // Accessibility metadata from the renderer, used to respond to MSAA |
| 532 // events. | 540 // events. |
| 533 string16 name_; | 541 string16 name_; |
| 534 string16 value_; | 542 string16 value_; |
| 535 std::map<int32, string16> attributes_; | 543 std::map<int32, string16> attributes_; |
| 536 std::vector<std::pair<string16, string16> > html_attributes_; | 544 std::vector<std::pair<string16, string16> > html_attributes_; |
| 537 | 545 |
| 546 int src_role_; |
| 538 LONG role_; | 547 LONG role_; |
| 539 LONG state_; | 548 LONG state_; |
| 540 string16 role_name_; | 549 string16 role_name_; |
| 541 LONG ia2_role_; | 550 LONG ia2_role_; |
| 542 LONG ia2_state_; | 551 LONG ia2_state_; |
| 543 WebKit::WebRect location_; | 552 WebKit::WebRect location_; |
| 544 | 553 |
| 545 // COM objects are reference-counted. When we're done with this object | 554 // COM objects are reference-counted. When we're done with this object |
| 546 // and it's removed from our accessibility tree, a client may still be | 555 // and it's removed from our accessibility tree, a client may still be |
| 547 // holding onto a pointer to this object, so we mark it as inactive | 556 // holding onto a pointer to this object, so we mark it as inactive |
| 548 // so that calls to any of this object's methods immediately return | 557 // so that calls to any of this object's methods immediately return |
| 549 // failure. | 558 // failure. |
| 550 bool instance_active_; | 559 bool instance_active_; |
| 551 | 560 |
| 552 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 561 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 553 }; | 562 }; |
| 554 | 563 |
| 555 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_WIN_H_ | 564 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_WIN_H_ |
| OLD | NEW |