IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / browser / accessibility / browser_accessibility_win.h
blob713960ac244688d930ddd0b6c2d84fab407ca072
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <oleacc.h>
11 #include <UIAutomationCore.h>
13 #include <vector>
15 #include "base/compiler_specific.h"
16 #include "content/browser/accessibility/browser_accessibility.h"
17 #include "content/common/content_export.h"
18 #include "third_party/iaccessible2/ia2_api_all.h"
19 #include "third_party/isimpledom/ISimpleDOMDocument.h"
20 #include "third_party/isimpledom/ISimpleDOMNode.h"
21 #include "third_party/isimpledom/ISimpleDOMText.h"
23 namespace ui {
24 enum TextBoundaryDirection;
25 enum TextBoundaryType;
28 namespace content {
29 class BrowserAccessibilityRelation;
31 ////////////////////////////////////////////////////////////////////////////////
33 // BrowserAccessibilityWin
35 // Class implementing the windows accessible interface for the Browser-Renderer
36 // communication of accessibility information, providing accessibility
37 // to be used by screen readers and other assistive technology (AT).
39 ////////////////////////////////////////////////////////////////////////////////
40 class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79"))
41 BrowserAccessibilityWin
42 : public BrowserAccessibility,
43 public CComObjectRootEx<CComMultiThreadModel>,
44 public IDispatchImpl<IAccessible2, &IID_IAccessible2,
45 &LIBID_IAccessible2Lib>,
46 public IAccessibleApplication,
47 public IAccessibleHyperlink,
48 public IAccessibleHypertext,
49 public IAccessibleImage,
50 public IAccessibleTable,
51 public IAccessibleTable2,
52 public IAccessibleTableCell,
53 public IAccessibleValue,
54 public IServiceProvider,
55 public ISimpleDOMDocument,
56 public ISimpleDOMNode,
57 public ISimpleDOMText,
58 public IAccessibleEx,
59 public IRawElementProviderSimple {
60 public:
61 BEGIN_COM_MAP(BrowserAccessibilityWin)
62 COM_INTERFACE_ENTRY2(IDispatch, IAccessible2)
63 COM_INTERFACE_ENTRY2(IAccessible, IAccessible2)
64 COM_INTERFACE_ENTRY2(IAccessibleText, IAccessibleHypertext)
65 COM_INTERFACE_ENTRY(IAccessible2)
66 COM_INTERFACE_ENTRY(IAccessibleApplication)
67 COM_INTERFACE_ENTRY(IAccessibleHyperlink)
68 COM_INTERFACE_ENTRY(IAccessibleHypertext)
69 COM_INTERFACE_ENTRY(IAccessibleImage)
70 COM_INTERFACE_ENTRY(IAccessibleTable)
71 COM_INTERFACE_ENTRY(IAccessibleTable2)
72 COM_INTERFACE_ENTRY(IAccessibleTableCell)
73 COM_INTERFACE_ENTRY(IAccessibleValue)
74 COM_INTERFACE_ENTRY(IServiceProvider)
75 COM_INTERFACE_ENTRY(ISimpleDOMDocument)
76 COM_INTERFACE_ENTRY(ISimpleDOMNode)
77 COM_INTERFACE_ENTRY(ISimpleDOMText)
78 COM_INTERFACE_ENTRY(IAccessibleEx)
79 COM_INTERFACE_ENTRY(IRawElementProviderSimple)
80 END_COM_MAP()
82 // Represents a non-static text node in IAccessibleHypertext. This character
83 // is embedded in the response to IAccessibleText::get_text, indicating the
84 // position where a non-static text child object appears.
85 CONTENT_EXPORT static const base::char16 kEmbeddedCharacter[];
87 // Mappings from roles and states to human readable strings. Initialize
88 // with |InitializeStringMaps|.
89 static std::map<int32, base::string16> role_string_map;
90 static std::map<int32, base::string16> state_string_map;
92 CONTENT_EXPORT BrowserAccessibilityWin();
94 CONTENT_EXPORT virtual ~BrowserAccessibilityWin();
96 // The Windows-specific unique ID, used as the child ID for MSAA methods
97 // like NotifyWinEvent, and as the unique ID for IAccessible2 and ISimpleDOM.
98 LONG unique_id_win() const { return unique_id_win_; }
101 // BrowserAccessibility methods.
103 CONTENT_EXPORT virtual void PreInitialize() OVERRIDE;
104 CONTENT_EXPORT virtual void PostInitialize() OVERRIDE;
105 CONTENT_EXPORT virtual void NativeAddReference() OVERRIDE;
106 CONTENT_EXPORT virtual void NativeReleaseReference() OVERRIDE;
107 CONTENT_EXPORT virtual bool IsNative() const OVERRIDE;
108 CONTENT_EXPORT virtual void SetLocation(const gfx::Rect& new_location)
109 OVERRIDE;
112 // IAccessible methods.
115 // Performs the default action on a given object.
116 CONTENT_EXPORT STDMETHODIMP accDoDefaultAction(VARIANT var_id);
118 // Retrieves the child element or child object at a given point on the screen.
119 CONTENT_EXPORT STDMETHODIMP accHitTest(LONG x_left, LONG y_top,
120 VARIANT* child);
122 // Retrieves the specified object's current screen location.
123 CONTENT_EXPORT STDMETHODIMP accLocation(LONG* x_left,
124 LONG* y_top,
125 LONG* width,
126 LONG* height,
127 VARIANT var_id);
129 // Traverses to another UI element and retrieves the object.
130 CONTENT_EXPORT STDMETHODIMP accNavigate(LONG nav_dir, VARIANT start,
131 VARIANT* end);
133 // Retrieves an IDispatch interface pointer for the specified child.
134 CONTENT_EXPORT STDMETHODIMP get_accChild(VARIANT var_child,
135 IDispatch** disp_child);
137 // Retrieves the number of accessible children.
138 CONTENT_EXPORT STDMETHODIMP get_accChildCount(LONG* child_count);
140 // Retrieves a string that describes the object's default action.
141 CONTENT_EXPORT STDMETHODIMP get_accDefaultAction(VARIANT var_id,
142 BSTR* default_action);
144 // Retrieves the object's description.
145 CONTENT_EXPORT STDMETHODIMP get_accDescription(VARIANT var_id, BSTR* desc);
147 // Retrieves the object that has the keyboard focus.
148 CONTENT_EXPORT STDMETHODIMP get_accFocus(VARIANT* focus_child);
150 // Retrieves the help information associated with the object.
151 CONTENT_EXPORT STDMETHODIMP get_accHelp(VARIANT var_id, BSTR* heflp);
153 // Retrieves the specified object's shortcut.
154 CONTENT_EXPORT STDMETHODIMP get_accKeyboardShortcut(VARIANT var_id,
155 BSTR* access_key);
157 // Retrieves the name of the specified object.
158 CONTENT_EXPORT STDMETHODIMP get_accName(VARIANT var_id, BSTR* name);
160 // Retrieves the IDispatch interface of the object's parent.
161 CONTENT_EXPORT STDMETHODIMP get_accParent(IDispatch** disp_parent);
163 // Retrieves information describing the role of the specified object.
164 CONTENT_EXPORT STDMETHODIMP get_accRole(VARIANT var_id, VARIANT* role);
166 // Retrieves the current state of the specified object.
167 CONTENT_EXPORT STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state);
169 // Returns the value associated with the object.
170 CONTENT_EXPORT STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value);
172 // Make an object take focus or extend the selection.
173 CONTENT_EXPORT STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id);
175 CONTENT_EXPORT STDMETHODIMP get_accHelpTopic(BSTR* help_file,
176 VARIANT var_id,
177 LONG* topic_id);
179 CONTENT_EXPORT STDMETHODIMP get_accSelection(VARIANT* selected);
181 // Deprecated methods, not implemented.
182 CONTENT_EXPORT STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name) {
183 return E_NOTIMPL;
185 CONTENT_EXPORT STDMETHODIMP put_accValue(VARIANT var_id, BSTR put_val) {
186 return E_NOTIMPL;
190 // IAccessible2 methods.
193 // Returns role from a longer list of possible roles.
194 CONTENT_EXPORT STDMETHODIMP role(LONG* role);
196 // Returns the state bitmask from a larger set of possible states.
197 CONTENT_EXPORT STDMETHODIMP get_states(AccessibleStates* states);
199 // Returns the attributes specific to this IAccessible2 object,
200 // such as a cell's formula.
201 CONTENT_EXPORT STDMETHODIMP get_attributes(BSTR* attributes);
203 // Get the unique ID of this object so that the client knows if it's
204 // been encountered previously.
205 CONTENT_EXPORT STDMETHODIMP get_uniqueID(LONG* unique_id);
207 // Get the window handle of the enclosing window.
208 CONTENT_EXPORT STDMETHODIMP get_windowHandle(HWND* window_handle);
210 // Get this object's index in its parent object.
211 CONTENT_EXPORT STDMETHODIMP get_indexInParent(LONG* index_in_parent);
213 CONTENT_EXPORT STDMETHODIMP get_nRelations(LONG* n_relations);
215 CONTENT_EXPORT STDMETHODIMP get_relation(LONG relation_index,
216 IAccessibleRelation** relation);
218 CONTENT_EXPORT STDMETHODIMP get_relations(LONG max_relations,
219 IAccessibleRelation** relations,
220 LONG* n_relations);
222 CONTENT_EXPORT STDMETHODIMP scrollTo(enum IA2ScrollType scroll_type);
224 CONTENT_EXPORT STDMETHODIMP scrollToPoint(
225 enum IA2CoordinateType coordinate_type,
226 LONG x,
227 LONG y);
229 CONTENT_EXPORT STDMETHODIMP get_groupPosition(LONG* group_level,
230 LONG* similar_items_in_group,
231 LONG* position_in_group);
234 // IAccessibleEx methods not implemented.
236 CONTENT_EXPORT STDMETHODIMP get_extendedRole(BSTR* extended_role) {
237 return E_NOTIMPL;
239 CONTENT_EXPORT STDMETHODIMP get_localizedExtendedRole(
240 BSTR* localized_extended_role) {
241 return E_NOTIMPL;
243 CONTENT_EXPORT STDMETHODIMP get_nExtendedStates(LONG* n_extended_states) {
244 return E_NOTIMPL;
246 CONTENT_EXPORT STDMETHODIMP get_extendedStates(LONG max_extended_states,
247 BSTR** extended_states,
248 LONG* n_extended_states) {
249 return E_NOTIMPL;
251 CONTENT_EXPORT STDMETHODIMP get_localizedExtendedStates(
252 LONG max_localized_extended_states,
253 BSTR** localized_extended_states,
254 LONG* n_localized_extended_states) {
255 return E_NOTIMPL;
257 CONTENT_EXPORT STDMETHODIMP get_locale(IA2Locale* locale) {
258 return E_NOTIMPL;
262 // IAccessibleApplication methods.
264 CONTENT_EXPORT STDMETHODIMP get_appName(BSTR* app_name);
266 CONTENT_EXPORT STDMETHODIMP get_appVersion(BSTR* app_version);
268 CONTENT_EXPORT STDMETHODIMP get_toolkitName(BSTR* toolkit_name);
270 CONTENT_EXPORT STDMETHODIMP get_toolkitVersion(BSTR* toolkit_version);
273 // IAccessibleImage methods.
275 CONTENT_EXPORT STDMETHODIMP get_description(BSTR* description);
277 CONTENT_EXPORT STDMETHODIMP get_imagePosition(
278 enum IA2CoordinateType coordinate_type,
279 LONG* x,
280 LONG* y);
282 CONTENT_EXPORT STDMETHODIMP get_imageSize(LONG* height, LONG* width);
285 // IAccessibleTable methods.
288 // get_description - also used by IAccessibleImage
290 CONTENT_EXPORT STDMETHODIMP get_accessibleAt(long row,
291 long column,
292 IUnknown** accessible);
294 CONTENT_EXPORT STDMETHODIMP get_caption(IUnknown** accessible);
296 CONTENT_EXPORT STDMETHODIMP get_childIndex(long row_index,
297 long column_index,
298 long* cell_index);
300 CONTENT_EXPORT STDMETHODIMP get_columnDescription(long column,
301 BSTR* description);
303 CONTENT_EXPORT STDMETHODIMP get_columnExtentAt(long row,
304 long column,
305 long* n_columns_spanned);
307 CONTENT_EXPORT STDMETHODIMP get_columnHeader(
308 IAccessibleTable** accessible_table,
309 long* starting_row_index);
311 CONTENT_EXPORT STDMETHODIMP get_columnIndex(long cell_index,
312 long* column_index);
314 CONTENT_EXPORT STDMETHODIMP get_nColumns(long* column_count);
316 CONTENT_EXPORT STDMETHODIMP get_nRows(long* row_count);
318 CONTENT_EXPORT STDMETHODIMP get_nSelectedChildren(long* cell_count);
320 CONTENT_EXPORT STDMETHODIMP get_nSelectedColumns(long* column_count);
322 CONTENT_EXPORT STDMETHODIMP get_nSelectedRows(long *row_count);
324 CONTENT_EXPORT STDMETHODIMP get_rowDescription(long row,
325 BSTR* description);
327 CONTENT_EXPORT STDMETHODIMP get_rowExtentAt(long row,
328 long column,
329 long* n_rows_spanned);
331 CONTENT_EXPORT STDMETHODIMP get_rowHeader(IAccessibleTable** accessible_table,
332 long* starting_column_index);
334 CONTENT_EXPORT STDMETHODIMP get_rowIndex(long cell_index,
335 long* row_index);
337 CONTENT_EXPORT STDMETHODIMP get_selectedChildren(long max_children,
338 long** children,
339 long* n_children);
341 CONTENT_EXPORT STDMETHODIMP get_selectedColumns(long max_columns,
342 long** columns,
343 long* n_columns);
345 CONTENT_EXPORT STDMETHODIMP get_selectedRows(long max_rows,
346 long** rows,
347 long* n_rows);
349 CONTENT_EXPORT STDMETHODIMP get_summary(IUnknown** accessible);
351 CONTENT_EXPORT STDMETHODIMP get_isColumnSelected(long column,
352 boolean* is_selected);
354 CONTENT_EXPORT STDMETHODIMP get_isRowSelected(long row,
355 boolean* is_selected);
357 CONTENT_EXPORT STDMETHODIMP get_isSelected(long row,
358 long column,
359 boolean* is_selected);
361 CONTENT_EXPORT STDMETHODIMP get_rowColumnExtentsAtIndex(long index,
362 long* row,
363 long* column,
364 long* row_extents,
365 long* column_extents,
366 boolean* is_selected);
368 CONTENT_EXPORT STDMETHODIMP selectRow(long row) {
369 return E_NOTIMPL;
372 CONTENT_EXPORT STDMETHODIMP selectColumn(long column) {
373 return E_NOTIMPL;
376 CONTENT_EXPORT STDMETHODIMP unselectRow(long row) {
377 return E_NOTIMPL;
380 CONTENT_EXPORT STDMETHODIMP unselectColumn(long column) {
381 return E_NOTIMPL;
384 CONTENT_EXPORT STDMETHODIMP get_modelChange(
385 IA2TableModelChange* model_change) {
386 return E_NOTIMPL;
390 // IAccessibleTable2 methods.
392 // (Most of these are duplicates of IAccessibleTable methods, only the
393 // unique ones are included here.)
396 CONTENT_EXPORT STDMETHODIMP get_cellAt(long row,
397 long column,
398 IUnknown** cell);
400 CONTENT_EXPORT STDMETHODIMP get_nSelectedCells(long* cell_count);
402 CONTENT_EXPORT STDMETHODIMP get_selectedCells(IUnknown*** cells,
403 long* n_selected_cells);
405 CONTENT_EXPORT STDMETHODIMP get_selectedColumns(long** columns,
406 long* n_columns);
408 CONTENT_EXPORT STDMETHODIMP get_selectedRows(long** rows,
409 long* n_rows);
412 // IAccessibleTableCell methods.
415 CONTENT_EXPORT STDMETHODIMP get_columnExtent(long* n_columns_spanned);
417 CONTENT_EXPORT STDMETHODIMP get_columnHeaderCells(
418 IUnknown*** cell_accessibles,
419 long* n_column_header_cells);
421 CONTENT_EXPORT STDMETHODIMP get_columnIndex(long* column_index);
423 CONTENT_EXPORT STDMETHODIMP get_rowExtent(long* n_rows_spanned);
425 CONTENT_EXPORT STDMETHODIMP get_rowHeaderCells(IUnknown*** cell_accessibles,
426 long* n_row_header_cells);
428 CONTENT_EXPORT STDMETHODIMP get_rowIndex(long* row_index);
430 CONTENT_EXPORT STDMETHODIMP get_isSelected(boolean* is_selected);
432 CONTENT_EXPORT STDMETHODIMP get_rowColumnExtents(long* row,
433 long* column,
434 long* row_extents,
435 long* column_extents,
436 boolean* is_selected);
438 CONTENT_EXPORT STDMETHODIMP get_table(IUnknown** table);
441 // IAccessibleText methods.
444 CONTENT_EXPORT STDMETHODIMP get_nCharacters(LONG* n_characters);
446 CONTENT_EXPORT STDMETHODIMP get_caretOffset(LONG* offset);
448 CONTENT_EXPORT STDMETHODIMP get_characterExtents(
449 LONG offset,
450 enum IA2CoordinateType coord_type,
451 LONG* out_x,
452 LONG* out_y,
453 LONG* out_width,
454 LONG* out_height);
456 CONTENT_EXPORT STDMETHODIMP get_nSelections(LONG* n_selections);
458 CONTENT_EXPORT STDMETHODIMP get_selection(LONG selection_index,
459 LONG* start_offset,
460 LONG* end_offset);
462 CONTENT_EXPORT STDMETHODIMP get_text(LONG start_offset,
463 LONG end_offset,
464 BSTR* text);
466 CONTENT_EXPORT STDMETHODIMP get_textAtOffset(
467 LONG offset,
468 enum IA2TextBoundaryType boundary_type,
469 LONG* start_offset,
470 LONG* end_offset,
471 BSTR* text);
473 CONTENT_EXPORT STDMETHODIMP get_textBeforeOffset(
474 LONG offset,
475 enum IA2TextBoundaryType boundary_type,
476 LONG* start_offset,
477 LONG* end_offset,
478 BSTR* text);
480 CONTENT_EXPORT STDMETHODIMP get_textAfterOffset(
481 LONG offset,
482 enum IA2TextBoundaryType boundary_type,
483 LONG* start_offset,
484 LONG* end_offset,
485 BSTR* text);
487 CONTENT_EXPORT STDMETHODIMP get_newText(IA2TextSegment* new_text);
489 CONTENT_EXPORT STDMETHODIMP get_oldText(IA2TextSegment* old_text);
491 CONTENT_EXPORT STDMETHODIMP get_offsetAtPoint(
492 LONG x,
493 LONG y,
494 enum IA2CoordinateType coord_type,
495 LONG* offset);
497 CONTENT_EXPORT STDMETHODIMP scrollSubstringTo(
498 LONG start_index,
499 LONG end_index,
500 enum IA2ScrollType scroll_type);
502 CONTENT_EXPORT STDMETHODIMP scrollSubstringToPoint(
503 LONG start_index,
504 LONG end_index,
505 enum IA2CoordinateType coordinate_type,
506 LONG x, LONG y);
508 CONTENT_EXPORT STDMETHODIMP addSelection(LONG start_offset, LONG end_offset);
510 CONTENT_EXPORT STDMETHODIMP removeSelection(LONG selection_index);
512 CONTENT_EXPORT STDMETHODIMP setCaretOffset(LONG offset);
514 CONTENT_EXPORT STDMETHODIMP setSelection(LONG selection_index,
515 LONG start_offset,
516 LONG end_offset);
518 // IAccessibleText methods not implemented.
519 CONTENT_EXPORT STDMETHODIMP get_attributes(LONG offset, LONG* start_offset,
520 LONG* end_offset,
521 BSTR* text_attributes) {
522 return E_NOTIMPL;
526 // IAccessibleHypertext methods.
529 CONTENT_EXPORT STDMETHODIMP get_nHyperlinks(long* hyperlink_count);
531 CONTENT_EXPORT STDMETHODIMP get_hyperlink(long index,
532 IAccessibleHyperlink** hyperlink);
534 CONTENT_EXPORT STDMETHODIMP get_hyperlinkIndex(long char_index,
535 long* hyperlink_index);
537 // IAccessibleHyperlink not implemented.
538 CONTENT_EXPORT STDMETHODIMP get_anchor(long index, VARIANT* anchor) {
539 return E_NOTIMPL;
541 CONTENT_EXPORT STDMETHODIMP get_anchorTarget(long index,
542 VARIANT* anchor_target) {
543 return E_NOTIMPL;
545 CONTENT_EXPORT STDMETHODIMP get_startIndex( long* index) {
546 return E_NOTIMPL;
548 CONTENT_EXPORT STDMETHODIMP get_endIndex( long* index) {
549 return E_NOTIMPL;
551 CONTENT_EXPORT STDMETHODIMP get_valid(boolean* valid) {
552 return E_NOTIMPL;
555 // IAccessibleAction not implemented.
556 CONTENT_EXPORT STDMETHODIMP nActions(long* n_actions) {
557 return E_NOTIMPL;
559 CONTENT_EXPORT STDMETHODIMP doAction(long action_index) {
560 return E_NOTIMPL;
562 CONTENT_EXPORT STDMETHODIMP get_description(long action_index,
563 BSTR* description) {
564 return E_NOTIMPL;
566 CONTENT_EXPORT STDMETHODIMP get_keyBinding(long action_index,
567 long n_max_bindings,
568 BSTR** key_bindings,
569 long* n_bindings) {
570 return E_NOTIMPL;
572 CONTENT_EXPORT STDMETHODIMP get_name(long action_index, BSTR* name) {
573 return E_NOTIMPL;
575 CONTENT_EXPORT STDMETHODIMP get_localizedName(long action_index,
576 BSTR* localized_name) {
577 return E_NOTIMPL;
581 // IAccessibleValue methods.
584 CONTENT_EXPORT STDMETHODIMP get_currentValue(VARIANT* value);
586 CONTENT_EXPORT STDMETHODIMP get_minimumValue(VARIANT* value);
588 CONTENT_EXPORT STDMETHODIMP get_maximumValue(VARIANT* value);
590 CONTENT_EXPORT STDMETHODIMP setCurrentValue(VARIANT new_value);
593 // ISimpleDOMDocument methods.
596 CONTENT_EXPORT STDMETHODIMP get_URL(BSTR* url);
598 CONTENT_EXPORT STDMETHODIMP get_title(BSTR* title);
600 CONTENT_EXPORT STDMETHODIMP get_mimeType(BSTR* mime_type);
602 CONTENT_EXPORT STDMETHODIMP get_docType(BSTR* doc_type);
604 CONTENT_EXPORT STDMETHODIMP get_nameSpaceURIForID(short name_space_id,
605 BSTR* name_space_uri) {
606 return E_NOTIMPL;
608 CONTENT_EXPORT STDMETHODIMP put_alternateViewMediaTypes(
609 BSTR* comma_separated_media_types) {
610 return E_NOTIMPL;
614 // ISimpleDOMNode methods.
617 CONTENT_EXPORT STDMETHODIMP get_nodeInfo(BSTR* node_name,
618 short* name_space_id,
619 BSTR* node_value,
620 unsigned int* num_children,
621 unsigned int* unique_id,
622 unsigned short* node_type);
624 CONTENT_EXPORT STDMETHODIMP get_attributes(unsigned short max_attribs,
625 BSTR* attrib_names,
626 short* name_space_id,
627 BSTR* attrib_values,
628 unsigned short* num_attribs);
630 CONTENT_EXPORT STDMETHODIMP get_attributesForNames(
631 unsigned short num_attribs,
632 BSTR* attrib_names,
633 short* name_space_id,
634 BSTR* attrib_values);
636 CONTENT_EXPORT STDMETHODIMP get_computedStyle(
637 unsigned short max_style_properties,
638 boolean use_alternate_view,
639 BSTR *style_properties,
640 BSTR *style_values,
641 unsigned short *num_style_properties);
643 CONTENT_EXPORT STDMETHODIMP get_computedStyleForProperties(
644 unsigned short num_style_properties,
645 boolean use_alternate_view,
646 BSTR* style_properties,
647 BSTR* style_values);
649 CONTENT_EXPORT STDMETHODIMP scrollTo(boolean placeTopLeft);
651 CONTENT_EXPORT STDMETHODIMP get_parentNode(ISimpleDOMNode** node);
653 CONTENT_EXPORT STDMETHODIMP get_firstChild(ISimpleDOMNode** node);
655 CONTENT_EXPORT STDMETHODIMP get_lastChild(ISimpleDOMNode** node);
657 CONTENT_EXPORT STDMETHODIMP get_previousSibling(ISimpleDOMNode** node);
659 CONTENT_EXPORT STDMETHODIMP get_nextSibling(ISimpleDOMNode** node);
661 CONTENT_EXPORT STDMETHODIMP get_childAt(unsigned int child_index,
662 ISimpleDOMNode** node);
664 CONTENT_EXPORT STDMETHODIMP get_innerHTML(BSTR* innerHTML) {
665 return E_NOTIMPL;
668 CONTENT_EXPORT STDMETHODIMP get_localInterface(void** local_interface) {
669 return E_NOTIMPL;
672 CONTENT_EXPORT STDMETHODIMP get_language(BSTR* language) {
673 return E_NOTIMPL;
677 // ISimpleDOMText methods.
680 CONTENT_EXPORT STDMETHODIMP get_domText(BSTR* dom_text);
682 CONTENT_EXPORT STDMETHODIMP get_clippedSubstringBounds(
683 unsigned int start_index,
684 unsigned int end_index,
685 int* out_x,
686 int* out_y,
687 int* out_width,
688 int* out_height);
690 CONTENT_EXPORT STDMETHODIMP get_unclippedSubstringBounds(
691 unsigned int start_index,
692 unsigned int end_index,
693 int* out_x,
694 int* out_y,
695 int* out_width,
696 int* out_height);
698 CONTENT_EXPORT STDMETHODIMP scrollToSubstring(unsigned int start_index,
699 unsigned int end_index);
701 CONTENT_EXPORT STDMETHODIMP get_fontFamily(BSTR *font_family) {
702 return E_NOTIMPL;
706 // IServiceProvider methods.
709 CONTENT_EXPORT STDMETHODIMP QueryService(REFGUID guidService,
710 REFIID riid,
711 void** object);
713 // IAccessibleEx methods not implemented.
714 CONTENT_EXPORT STDMETHODIMP GetObjectForChild(long child_id,
715 IAccessibleEx** ret) {
716 return E_NOTIMPL;
719 CONTENT_EXPORT STDMETHODIMP GetIAccessiblePair(IAccessible** acc,
720 long* child_id) {
721 return E_NOTIMPL;
724 CONTENT_EXPORT STDMETHODIMP GetRuntimeId(SAFEARRAY** runtime_id) {
725 return E_NOTIMPL;
728 CONTENT_EXPORT STDMETHODIMP ConvertReturnedElement(
729 IRawElementProviderSimple* element,
730 IAccessibleEx** acc) {
731 return E_NOTIMPL;
735 // IRawElementProviderSimple methods.
737 // The GetPatternProvider/GetPropertyValue methods need to be implemented for
738 // the on-screen keyboard to show up in Windows 8 metro.
739 CONTENT_EXPORT STDMETHODIMP GetPatternProvider(PATTERNID id,
740 IUnknown** provider);
741 CONTENT_EXPORT STDMETHODIMP GetPropertyValue(PROPERTYID id, VARIANT* ret);
744 // IRawElementProviderSimple methods not implemented
746 CONTENT_EXPORT STDMETHODIMP get_ProviderOptions(enum ProviderOptions* ret) {
747 return E_NOTIMPL;
750 CONTENT_EXPORT STDMETHODIMP get_HostRawElementProvider(
751 IRawElementProviderSimple** provider) {
752 return E_NOTIMPL;
756 // CComObjectRootEx methods.
759 CONTENT_EXPORT HRESULT WINAPI InternalQueryInterface(
760 void* this_ptr,
761 const _ATL_INTMAP_ENTRY* entries,
762 REFIID iid,
763 void** object);
765 // Accessors.
766 int32 ia_role() const { return ia_role_; }
767 int32 ia_state() const { return ia_state_; }
768 const base::string16& role_name() const { return role_name_; }
769 int32 ia2_role() const { return ia2_role_; }
770 int32 ia2_state() const { return ia2_state_; }
771 const std::vector<base::string16>& ia2_attributes() const {
772 return ia2_attributes_;
775 // BrowserAccessibility::role is shadowed by IAccessible2::role, so
776 // we provide an alias for it.
777 int32 blink_role() const { return BrowserAccessibility::role(); }
779 private:
780 // Add one to the reference count and return the same object. Always
781 // use this method when returning a BrowserAccessibilityWin object as
782 // an output parameter to a COM interface, never use it otherwise.
783 BrowserAccessibilityWin* NewReference();
785 // Many MSAA methods take a var_id parameter indicating that the operation
786 // should be performed on a particular child ID, rather than this object.
787 // This method tries to figure out the target object from |var_id| and
788 // returns a pointer to the target object if it exists, otherwise NULL.
789 // Does not return a new reference.
790 BrowserAccessibilityWin* GetTargetFromChildID(const VARIANT& var_id);
792 // Initialize the role and state metadata from the role enum and state
793 // bitmasks defined in ui::AXNodeData.
794 void InitRoleAndState();
796 // Retrieve the value of an attribute from the string attribute map and
797 // if found and nonempty, allocate a new BSTR (with SysAllocString)
798 // and return S_OK. If not found or empty, return S_FALSE.
799 HRESULT GetStringAttributeAsBstr(
800 ui::AXStringAttribute attribute,
801 BSTR* value_bstr);
803 // If the string attribute |attribute| is present, add its value as an
804 // IAccessible2 attribute with the name |ia2_attr|.
805 void StringAttributeToIA2(ui::AXStringAttribute attribute,
806 const char* ia2_attr);
808 // If the bool attribute |attribute| is present, add its value as an
809 // IAccessible2 attribute with the name |ia2_attr|.
810 void BoolAttributeToIA2(ui::AXBoolAttribute attribute,
811 const char* ia2_attr);
813 // If the int attribute |attribute| is present, add its value as an
814 // IAccessible2 attribute with the name |ia2_attr|.
815 void IntAttributeToIA2(ui::AXIntAttribute attribute,
816 const char* ia2_attr);
818 // Get the value text, which might come from the floating-point
819 // value for some roles.
820 base::string16 GetValueText();
822 // Get the text of this node for the purposes of IAccessibleText - it may
823 // be the name, it may be the value, etc. depending on the role.
824 base::string16 TextForIAccessibleText();
826 // If offset is a member of IA2TextSpecialOffsets this function updates the
827 // value of offset and returns, otherwise offset remains unchanged.
828 void HandleSpecialTextOffset(const base::string16& text, LONG* offset);
830 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType.
831 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type);
833 // Search forwards (direction == 1) or backwards (direction == -1)
834 // from the given offset until the given boundary is found, and
835 // return the offset of that boundary.
836 LONG FindBoundary(const base::string16& text,
837 IA2TextBoundaryType ia2_boundary,
838 LONG start_offset,
839 ui::TextBoundaryDirection direction);
841 // Return a pointer to the object corresponding to the given renderer_id,
842 // does not make a new reference.
843 BrowserAccessibilityWin* GetFromRendererID(int32 renderer_id);
845 // Windows-specific unique ID (unique within the browser process),
846 // used for get_accChild, NotifyWinEvent, and as the unique ID for
847 // IAccessible2 and ISimpleDOM.
848 LONG unique_id_win_;
850 // IAccessible role and state.
851 int32 ia_role_;
852 int32 ia_state_;
853 base::string16 role_name_;
855 // IAccessible2 role and state.
856 int32 ia2_role_;
857 int32 ia2_state_;
859 // IAccessible2 attributes.
860 std::vector<base::string16> ia2_attributes_;
862 // True in Initialize when the object is first created, and false
863 // subsequent times.
864 bool first_time_;
866 // The previous text, before the last update to this object.
867 base::string16 previous_text_;
869 // The old text to return in IAccessibleText::get_oldText - this is like
870 // previous_text_ except that it's NOT updated when the object
871 // is initialized again but the text doesn't change.
872 base::string16 old_text_;
874 // The previous state, used to see if there was a state change.
875 int32 old_ia_state_;
877 // Relationships between this node and other nodes.
878 std::vector<BrowserAccessibilityRelation*> relations_;
880 // The text of this node including embedded hyperlink characters.
881 base::string16 hypertext_;
883 // Maps the |hypertext_| embedded character offset to an index in
884 // |hyperlinks_|.
885 std::map<int32, int32> hyperlink_offset_to_index_;
887 // Collection of non-static text child indicies, each of which corresponds to
888 // a hyperlink.
889 std::vector<int32> hyperlinks_;
891 // The previous scroll position, so we can tell if this object scrolled.
892 int previous_scroll_x_;
893 int previous_scroll_y_;
895 // The next unique id to use.
896 static LONG next_unique_id_win_;
898 // Give BrowserAccessibility::Create access to our constructor.
899 friend class BrowserAccessibility;
900 friend class BrowserAccessibilityRelation;
902 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin);
905 } // namespace content
907 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_