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

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.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, 3 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_WIN_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_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 21 matching lines...) Expand all
32 // to be used by screen readers and other assistive technology (AT). 32 // to be used by screen readers and other assistive technology (AT).
33 // 33 //
34 //////////////////////////////////////////////////////////////////////////////// 34 ////////////////////////////////////////////////////////////////////////////////
35 class BrowserAccessibilityWin 35 class BrowserAccessibilityWin
36 : public BrowserAccessibility, 36 : public BrowserAccessibility,
37 public CComObjectRootEx<CComMultiThreadModel>, 37 public CComObjectRootEx<CComMultiThreadModel>,
38 public IDispatchImpl<IAccessible2, &IID_IAccessible2, 38 public IDispatchImpl<IAccessible2, &IID_IAccessible2,
39 &LIBID_IAccessible2Lib>, 39 &LIBID_IAccessible2Lib>,
40 public IAccessibleImage, 40 public IAccessibleImage,
41 public IAccessibleTable, 41 public IAccessibleTable,
42 public IAccessibleTable2,
42 public IAccessibleTableCell, 43 public IAccessibleTableCell,
43 public IAccessibleText, 44 public IAccessibleText,
45 public IAccessibleValue,
44 public IServiceProvider, 46 public IServiceProvider,
45 public ISimpleDOMDocument, 47 public ISimpleDOMDocument,
46 public ISimpleDOMNode, 48 public ISimpleDOMNode,
47 public ISimpleDOMText { 49 public ISimpleDOMText {
48 public: 50 public:
49 BEGIN_COM_MAP(BrowserAccessibilityWin) 51 BEGIN_COM_MAP(BrowserAccessibilityWin)
50 COM_INTERFACE_ENTRY2(IDispatch, IAccessible2) 52 COM_INTERFACE_ENTRY2(IDispatch, IAccessible2)
51 COM_INTERFACE_ENTRY2(IAccessible, IAccessible2) 53 COM_INTERFACE_ENTRY2(IAccessible, IAccessible2)
52 COM_INTERFACE_ENTRY(IAccessible2) 54 COM_INTERFACE_ENTRY(IAccessible2)
53 COM_INTERFACE_ENTRY(IAccessibleImage) 55 COM_INTERFACE_ENTRY(IAccessibleImage)
54 COM_INTERFACE_ENTRY(IAccessibleTable) 56 COM_INTERFACE_ENTRY(IAccessibleTable)
57 COM_INTERFACE_ENTRY(IAccessibleTable2)
55 COM_INTERFACE_ENTRY(IAccessibleTableCell) 58 COM_INTERFACE_ENTRY(IAccessibleTableCell)
56 COM_INTERFACE_ENTRY(IAccessibleText) 59 COM_INTERFACE_ENTRY(IAccessibleText)
60 COM_INTERFACE_ENTRY(IAccessibleValue)
57 COM_INTERFACE_ENTRY(IServiceProvider) 61 COM_INTERFACE_ENTRY(IServiceProvider)
58 COM_INTERFACE_ENTRY(ISimpleDOMDocument) 62 COM_INTERFACE_ENTRY(ISimpleDOMDocument)
59 COM_INTERFACE_ENTRY(ISimpleDOMNode) 63 COM_INTERFACE_ENTRY(ISimpleDOMNode)
60 COM_INTERFACE_ENTRY(ISimpleDOMText) 64 COM_INTERFACE_ENTRY(ISimpleDOMText)
61 END_COM_MAP() 65 END_COM_MAP()
62 66
63 BrowserAccessibilityWin(); 67 BrowserAccessibilityWin();
64 68
65 virtual ~BrowserAccessibilityWin(); 69 virtual ~BrowserAccessibilityWin();
66 70
67 // 71 //
68 // BrowserAccessibility methods. 72 // BrowserAccessibility methods.
69 // 73 //
70 virtual void Initialize(); 74 virtual void Initialize();
75 virtual void SendNodeUpdateEvents();
71 virtual void NativeAddReference(); 76 virtual void NativeAddReference();
72 virtual void NativeReleaseReference(); 77 virtual void NativeReleaseReference();
73 78
74 // 79 //
75 // IAccessible methods. 80 // IAccessible methods.
76 // 81 //
77 82
78 // Performs the default action on a given object. 83 // Performs the default action on a given object.
79 STDMETHODIMP accDoDefaultAction(VARIANT var_id); 84 STDMETHODIMP accDoDefaultAction(VARIANT var_id);
80 85
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 330
326 STDMETHODIMP unselectColumn(long column) { 331 STDMETHODIMP unselectColumn(long column) {
327 return E_NOTIMPL; 332 return E_NOTIMPL;
328 } 333 }
329 334
330 STDMETHODIMP get_modelChange(IA2TableModelChange* model_change) { 335 STDMETHODIMP get_modelChange(IA2TableModelChange* model_change) {
331 return E_NOTIMPL; 336 return E_NOTIMPL;
332 } 337 }
333 338
334 // 339 //
340 // IAccessibleTable2 methods.
341 //
342 // (Most of these are duplicates of IAccessibleTable methods, only the
343 // unique ones are included here.)
344 //
345
346 STDMETHODIMP get_cellAt(long row,
347 long column,
348 IUnknown** cell);
349
350 STDMETHODIMP get_nSelectedCells(long* cell_count);
351
352 STDMETHODIMP get_selectedCells(IUnknown*** cells,
353 long* n_selected_cells);
354
355 STDMETHODIMP get_selectedColumns(long** columns,
356 long* n_columns);
357
358 STDMETHODIMP get_selectedRows(long** rows,
359 long* n_rows);
360
361 //
335 // IAccessibleTableCell methods. 362 // IAccessibleTableCell methods.
336 // 363 //
337 364
338 STDMETHODIMP get_columnExtent(long* n_columns_spanned); 365 STDMETHODIMP get_columnExtent(long* n_columns_spanned);
339 366
340 STDMETHODIMP get_columnHeaderCells(IUnknown*** cell_accessibles, 367 STDMETHODIMP get_columnHeaderCells(IUnknown*** cell_accessibles,
341 long* n_column_header_cells); 368 long* n_column_header_cells);
342 369
343 STDMETHODIMP get_columnIndex(long* column_index); 370 STDMETHODIMP get_columnIndex(long* column_index);
344 371
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 STDMETHODIMP get_textBeforeOffset(LONG offset, 410 STDMETHODIMP get_textBeforeOffset(LONG offset,
384 enum IA2TextBoundaryType boundary_type, 411 enum IA2TextBoundaryType boundary_type,
385 LONG* start_offset, LONG* end_offset, 412 LONG* start_offset, LONG* end_offset,
386 BSTR* text); 413 BSTR* text);
387 414
388 STDMETHODIMP get_textAfterOffset(LONG offset, 415 STDMETHODIMP get_textAfterOffset(LONG offset,
389 enum IA2TextBoundaryType boundary_type, 416 enum IA2TextBoundaryType boundary_type,
390 LONG* start_offset, LONG* end_offset, 417 LONG* start_offset, LONG* end_offset,
391 BSTR* text); 418 BSTR* text);
392 419
420 STDMETHODIMP get_newText(IA2TextSegment* new_text);
421
422 STDMETHODIMP get_oldText(IA2TextSegment* old_text);
423
424 STDMETHODIMP get_offsetAtPoint(LONG x, LONG y,
425 enum IA2CoordinateType coord_type,
426 LONG* offset);
427
393 // IAccessibleText methods not implemented. 428 // IAccessibleText methods not implemented.
394 STDMETHODIMP addSelection(LONG start_offset, LONG end_offset) { 429 STDMETHODIMP addSelection(LONG start_offset, LONG end_offset) {
395 return E_NOTIMPL; 430 return E_NOTIMPL;
396 } 431 }
397 STDMETHODIMP get_attributes(LONG offset, LONG* start_offset, LONG* end_offset, 432 STDMETHODIMP get_attributes(LONG offset, LONG* start_offset, LONG* end_offset,
398 BSTR* text_attributes) { 433 BSTR* text_attributes) {
399 return E_NOTIMPL; 434 return E_NOTIMPL;
400 } 435 }
401 STDMETHODIMP get_characterExtents(LONG offset, 436 STDMETHODIMP get_characterExtents(LONG offset,
402 enum IA2CoordinateType coord_type, 437 enum IA2CoordinateType coord_type,
403 LONG* x, LONG* y, 438 LONG* x, LONG* y,
404 LONG* width, LONG* height) { 439 LONG* width, LONG* height) {
405 return E_NOTIMPL; 440 return E_NOTIMPL;
406 } 441 }
407 STDMETHODIMP get_offsetAtPoint(LONG x, LONG y,
408 enum IA2CoordinateType coord_type,
409 LONG* offset) {
410 return E_NOTIMPL;
411 }
412 STDMETHODIMP removeSelection(LONG selection_index) { 442 STDMETHODIMP removeSelection(LONG selection_index) {
413 return E_NOTIMPL; 443 return E_NOTIMPL;
414 } 444 }
415 STDMETHODIMP setCaretOffset(LONG offset) { 445 STDMETHODIMP setCaretOffset(LONG offset) {
416 return E_NOTIMPL; 446 return E_NOTIMPL;
417 } 447 }
418 STDMETHODIMP setSelection(LONG selection_index, 448 STDMETHODIMP setSelection(LONG selection_index,
419 LONG start_offset, 449 LONG start_offset,
420 LONG end_offset) { 450 LONG end_offset) {
421 return E_NOTIMPL; 451 return E_NOTIMPL;
422 } 452 }
423 STDMETHODIMP scrollSubstringTo(LONG start_index, 453 STDMETHODIMP scrollSubstringTo(LONG start_index,
424 LONG end_index, 454 LONG end_index,
425 enum IA2ScrollType scroll_type) { 455 enum IA2ScrollType scroll_type) {
426 return E_NOTIMPL; 456 return E_NOTIMPL;
427 } 457 }
428 STDMETHODIMP scrollSubstringToPoint(LONG start_index, LONG end_index, 458 STDMETHODIMP scrollSubstringToPoint(LONG start_index, LONG end_index,
429 enum IA2CoordinateType coordinate_type, 459 enum IA2CoordinateType coordinate_type,
430 LONG x, LONG y) { 460 LONG x, LONG y) {
431 return E_NOTIMPL; 461 return E_NOTIMPL;
432 } 462 }
433 STDMETHODIMP get_newText(IA2TextSegment* new_text) { 463
434 return E_NOTIMPL; 464 //
435 } 465 // IAccessibleValue methods.
436 STDMETHODIMP get_oldText(IA2TextSegment* old_text) { 466 //
437 return E_NOTIMPL; 467
438 } 468 STDMETHODIMP get_currentValue(VARIANT* value);
469
470 STDMETHODIMP get_minimumValue(VARIANT* value);
471
472 STDMETHODIMP get_maximumValue(VARIANT* value);
473
474 STDMETHODIMP setCurrentValue(VARIANT new_value);
439 475
440 // 476 //
441 // ISimpleDOMDocument methods. 477 // ISimpleDOMDocument methods.
442 // 478 //
443 479
444 STDMETHODIMP get_URL(BSTR* url); 480 STDMETHODIMP get_URL(BSTR* url);
445 481
446 STDMETHODIMP get_title(BSTR* title); 482 STDMETHODIMP get_title(BSTR* title);
447 483
448 STDMETHODIMP get_mimeType(BSTR* mime_type); 484 STDMETHODIMP get_mimeType(BSTR* mime_type);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // Initialize the role and state metadata from the role enum and state 627 // Initialize the role and state metadata from the role enum and state
592 // bitmasks defined in webkit/glue/webaccessibility.h. 628 // bitmasks defined in webkit/glue/webaccessibility.h.
593 void InitRoleAndState(); 629 void InitRoleAndState();
594 630
595 // Retrieve the value of an attribute from the string attribute map and 631 // Retrieve the value of an attribute from the string attribute map and
596 // if found and nonempty, allocate a new BSTR (with SysAllocString) 632 // if found and nonempty, allocate a new BSTR (with SysAllocString)
597 // and return S_OK. If not found or empty, return S_FALSE. 633 // and return S_OK. If not found or empty, return S_FALSE.
598 HRESULT GetStringAttributeAsBstr( 634 HRESULT GetStringAttributeAsBstr(
599 WebAccessibility::StringAttribute attribute, BSTR* value_bstr); 635 WebAccessibility::StringAttribute attribute, BSTR* value_bstr);
600 636
637 // If the string attribute |attribute| is present, add its value as an
638 // IAccessible2 attribute with the name |ia2_attr|.
639 void StringAttributeToIA2(
640 WebAccessibility::StringAttribute attribute, const char* ia2_attr);
641
642 // If the bool attribute |attribute| is present, add its value as an
643 // IAccessible2 attribute with the name |ia2_attr|.
644 void BoolAttributeToIA2(
645 WebAccessibility::BoolAttribute attribute, const char* ia2_attr);
646
647 // If the int attribute |attribute| is present, add its value as an
648 // IAccessible2 attribute with the name |ia2_attr|.
649 void IntAttributeToIA2(
650 WebAccessibility::IntAttribute attribute, const char* ia2_attr);
651
601 // Escape a string like it would be escaped for a URL or HTML form. 652 // Escape a string like it would be escaped for a URL or HTML form.
602 string16 Escape(const string16& str); 653 string16 Escape(const string16& str);
603 654
604 // Get the text of this node for the purposes of IAccessibleText - it may 655 // Get the text of this node for the purposes of IAccessibleText - it may
605 // be the name, it may be the value, etc. depending on the role. 656 // be the name, it may be the value, etc. depending on the role.
606 const string16& TextForIAccessibleText(); 657 const string16& TextForIAccessibleText();
607 658
608 // If offset is a member of IA2TextSpecialOffsets this function updates the 659 // If offset is a member of IA2TextSpecialOffsets this function updates the
609 // value of offset and returns, otherwise offset remains unchanged. 660 // value of offset and returns, otherwise offset remains unchanged.
610 void HandleSpecialTextOffset(const string16& text, LONG* offset); 661 void HandleSpecialTextOffset(const string16& text, LONG* offset);
(...skipping 11 matching lines...) Expand all
622 BrowserAccessibilityWin* GetFromRendererID(int32 renderer_id); 673 BrowserAccessibilityWin* GetFromRendererID(int32 renderer_id);
623 674
624 // IAccessible role and state. 675 // IAccessible role and state.
625 int32 ia_role_; 676 int32 ia_role_;
626 int32 ia_state_; 677 int32 ia_state_;
627 678
628 // IAccessible2 role and state. 679 // IAccessible2 role and state.
629 int32 ia2_role_; 680 int32 ia2_role_;
630 int32 ia2_state_; 681 int32 ia2_state_;
631 682
683 // IAccessible2 attributes.
684 std::vector<string16> ia2_attributes_;
685
686 // True in Initialize when the object is first created, and false
687 // subsequent times.
688 bool first_time_;
689
690 // The previous text, before the last update to this object.
691 string16 previous_text_;
692
693 // The old text to return in IAccessibleText::get_oldText - this is like
694 // previous_text_ except that it's NOT updated when the object
695 // is initialized again but the text doesn't change.
696 string16 old_text_;
697
632 // Give BrowserAccessibility::Create access to our constructor. 698 // Give BrowserAccessibility::Create access to our constructor.
633 friend class BrowserAccessibility; 699 friend class BrowserAccessibility;
634 700
635 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); 701 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin);
636 }; 702 };
637 703
638 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ 704 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698