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

Side by Side Diff: ui/accessibility/platform/ax_platform_node_win.h

Issue 949333002: Revert of Implement NativeViewAccessibilityWin using AXPlatformNodeWin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
7
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <oleacc.h>
11
12 #include "third_party/iaccessible2/ia2_api_all.h"
13 #include "ui/accessibility/platform/ax_platform_node_base.h"
14
15 namespace ui {
16
17 class __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2"))
18 AXPlatformNodeWin
19 : public CComObjectRootEx<CComMultiThreadModel>,
20 public IDispatchImpl<IAccessible2_2, &IID_IAccessible2,
21 &LIBID_IAccessible2Lib>,
22 public IAccessibleText,
23 public IServiceProvider,
24 public AXPlatformNodeBase {
25 public:
26 BEGIN_COM_MAP(AXPlatformNodeWin)
27 COM_INTERFACE_ENTRY2(IDispatch, IAccessible2_2)
28 COM_INTERFACE_ENTRY(AXPlatformNodeWin)
29 COM_INTERFACE_ENTRY(IAccessible)
30 COM_INTERFACE_ENTRY(IAccessible2)
31 COM_INTERFACE_ENTRY(IAccessible2_2)
32 COM_INTERFACE_ENTRY(IAccessibleText)
33 COM_INTERFACE_ENTRY(IServiceProvider)
34 END_COM_MAP()
35
36 virtual ~AXPlatformNodeWin();
37
38 // AXPlatformNode overrides.
39 void Destroy() override;
40 gfx::NativeViewAccessible GetNativeViewAccessible() override;
41 void NotifyAccessibilityEvent(ui::AXEvent event_type) override;
42
43 // AXPlatformNodeBase overrides.
44 int GetIndexInParent() override;
45
46 //
47 // IAccessible methods.
48 //
49
50 // Retrieves the child element or child object at a given point on the screen.
51 virtual STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child);
52
53 // Performs the object's default action.
54 STDMETHODIMP accDoDefaultAction(VARIANT var_id);
55
56 // Retrieves the specified object's current screen location.
57 STDMETHODIMP accLocation(LONG* x_left,
58 LONG* y_top,
59 LONG* width,
60 LONG* height,
61 VARIANT var_id);
62
63 // Traverses to another UI element and retrieves the object.
64 STDMETHODIMP accNavigate(LONG nav_dir, VARIANT start, VARIANT* end);
65
66 // Retrieves an IDispatch interface pointer for the specified child.
67 virtual STDMETHODIMP get_accChild(VARIANT var_child, IDispatch** disp_child);
68
69 // Retrieves the number of accessible children.
70 virtual STDMETHODIMP get_accChildCount(LONG* child_count);
71
72 // Retrieves a string that describes the object's default action.
73 STDMETHODIMP get_accDefaultAction(VARIANT var_id, BSTR* default_action);
74
75 // Retrieves the tooltip description.
76 STDMETHODIMP get_accDescription(VARIANT var_id, BSTR* desc);
77
78 // Retrieves the object that has the keyboard focus.
79 STDMETHODIMP get_accFocus(VARIANT* focus_child);
80
81 // Retrieves the specified object's shortcut.
82 STDMETHODIMP get_accKeyboardShortcut(VARIANT var_id, BSTR* access_key);
83
84 // Retrieves the name of the specified object.
85 STDMETHODIMP get_accName(VARIANT var_id, BSTR* name);
86
87 // Retrieves the IDispatch interface of the object's parent.
88 STDMETHODIMP get_accParent(IDispatch** disp_parent);
89
90 // Retrieves information describing the role of the specified object.
91 STDMETHODIMP get_accRole(VARIANT var_id, VARIANT* role);
92
93 // Retrieves the current state of the specified object.
94 STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state);
95
96 // Gets the help string for the specified object.
97 STDMETHODIMP get_accHelp(VARIANT var_id, BSTR* help);
98
99 // Retrieve or set the string value associated with the specified object.
100 // Setting the value is not typically used by screen readers, but it's
101 // used frequently by automation software.
102 STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value);
103 STDMETHODIMP put_accValue(VARIANT var_id, BSTR new_value);
104
105 // IAccessible methods not implemented.
106 STDMETHODIMP get_accSelection(VARIANT* selected);
107 STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id);
108 STDMETHODIMP get_accHelpTopic(BSTR* help_file,
109 VARIANT var_id,
110 LONG* topic_id);
111 STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name);
112
113 //
114 // IAccessible2 methods.
115 //
116
117 STDMETHODIMP role(LONG* role) override;
118
119 STDMETHODIMP get_states(AccessibleStates* states) override;
120
121 STDMETHODIMP get_uniqueID(LONG* unique_id) override;
122
123 STDMETHODIMP get_windowHandle(HWND* window_handle) override;
124
125 STDMETHODIMP get_relationTargetsOfType(BSTR type,
126 long max_targets,
127 IUnknown*** targets,
128 long* n_targets) override;
129
130 STDMETHODIMP get_attributes(BSTR* attributes) override;
131
132 //
133 // IAccessible2 methods not implemented.
134 //
135
136 STDMETHODIMP get_attribute(BSTR name, VARIANT* attribute) override {
137 return E_NOTIMPL;
138 }
139 STDMETHODIMP get_indexInParent(LONG* index_in_parent) override {
140 return E_NOTIMPL;
141 }
142 STDMETHODIMP get_extendedRole(BSTR* extended_role) override {
143 return E_NOTIMPL;
144 }
145 STDMETHODIMP get_nRelations(LONG* n_relations) override { return E_NOTIMPL; }
146 STDMETHODIMP get_relation(LONG relation_index,
147 IAccessibleRelation** relation) override {
148 return E_NOTIMPL;
149 }
150 STDMETHODIMP get_relations(LONG max_relations,
151 IAccessibleRelation** relations,
152 LONG* n_relations) override {
153 return E_NOTIMPL;
154 }
155 STDMETHODIMP scrollTo(enum IA2ScrollType scroll_type) override {
156 return E_NOTIMPL;
157 }
158 STDMETHODIMP scrollToPoint(enum IA2CoordinateType coordinate_type,
159 LONG x,
160 LONG y) override {
161 return E_NOTIMPL;
162 }
163 STDMETHODIMP get_groupPosition(LONG* group_level,
164 LONG* similar_items_in_group,
165 LONG* position_in_group) override {
166 return E_NOTIMPL;
167 }
168 STDMETHODIMP get_localizedExtendedRole(
169 BSTR* localized_extended_role) override {
170 return E_NOTIMPL;
171 }
172 STDMETHODIMP get_nExtendedStates(LONG* n_extended_states) override {
173 return E_NOTIMPL;
174 }
175 STDMETHODIMP get_extendedStates(LONG max_extended_states,
176 BSTR** extended_states,
177 LONG* n_extended_states) override {
178 return E_NOTIMPL;
179 }
180 STDMETHODIMP get_localizedExtendedStates(
181 LONG max_localized_extended_states,
182 BSTR** localized_extended_states,
183 LONG* n_localized_extended_states) override {
184 return E_NOTIMPL;
185 }
186 STDMETHODIMP get_locale(IA2Locale* locale) override { return E_NOTIMPL; }
187 STDMETHODIMP get_accessibleWithCaret(IUnknown** accessible,
188 long* caret_offset) override {
189 return E_NOTIMPL;
190 }
191
192 //
193 // IAccessibleText methods.
194 //
195
196 STDMETHODIMP get_nCharacters(LONG* n_characters) override;
197
198 STDMETHODIMP get_caretOffset(LONG* offset) override;
199
200 STDMETHODIMP get_nSelections(LONG* n_selections) override;
201
202 STDMETHODIMP get_selection(LONG selection_index,
203 LONG* start_offset,
204 LONG* end_offset) override;
205
206 STDMETHODIMP get_text(LONG start_offset,
207 LONG end_offset,
208 BSTR* text) override;
209
210 STDMETHODIMP get_textAtOffset(LONG offset,
211 enum IA2TextBoundaryType boundary_type,
212 LONG* start_offset,
213 LONG* end_offset,
214 BSTR* text) override;
215
216 STDMETHODIMP get_textBeforeOffset(LONG offset,
217 enum IA2TextBoundaryType boundary_type,
218 LONG* start_offset,
219 LONG* end_offset,
220 BSTR* text) override;
221
222 STDMETHODIMP get_textAfterOffset(LONG offset,
223 enum IA2TextBoundaryType boundary_type,
224 LONG* start_offset,
225 LONG* end_offset,
226 BSTR* text) override;
227
228 STDMETHODIMP get_offsetAtPoint(LONG x,
229 LONG y,
230 enum IA2CoordinateType coord_type,
231 LONG* offset) override;
232
233 //
234 // IAccessibleText methods not implemented.
235 //
236
237 STDMETHODIMP get_newText(IA2TextSegment* new_text) override {
238 return E_NOTIMPL;
239 }
240 STDMETHODIMP get_oldText(IA2TextSegment* old_text) override {
241 return E_NOTIMPL;
242 }
243 STDMETHODIMP addSelection(LONG start_offset, LONG end_offset) override {
244 return E_NOTIMPL;
245 }
246 STDMETHODIMP get_attributes(LONG offset,
247 LONG* start_offset,
248 LONG* end_offset,
249 BSTR* text_attributes) override {
250 return E_NOTIMPL;
251 }
252 STDMETHODIMP get_characterExtents(LONG offset,
253 enum IA2CoordinateType coord_type,
254 LONG* x,
255 LONG* y,
256 LONG* width,
257 LONG* height) override {
258 return E_NOTIMPL;
259 }
260 STDMETHODIMP removeSelection(LONG selection_index) override {
261 return E_NOTIMPL;
262 }
263 STDMETHODIMP setCaretOffset(LONG offset) override { return E_NOTIMPL; }
264 STDMETHODIMP setSelection(LONG selection_index,
265 LONG start_offset,
266 LONG end_offset) override {
267 return E_NOTIMPL;
268 }
269 STDMETHODIMP scrollSubstringTo(LONG start_index,
270 LONG end_index,
271 enum IA2ScrollType scroll_type) override {
272 return E_NOTIMPL;
273 }
274 STDMETHODIMP scrollSubstringToPoint(LONG start_index,
275 LONG end_index,
276 enum IA2CoordinateType coordinate_type,
277 LONG x,
278 LONG y) override {
279 return E_NOTIMPL;
280 }
281
282 //
283 // IServiceProvider methods.
284 //
285
286 STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** object);
287
288 protected:
289 AXPlatformNodeWin();
290
291 private:
292 bool IsValidId(const VARIANT& child) const;
293 int MSAARole();
294 int MSAAState();
295 int MSAAEvent(ui::AXEvent event);
296
297 HRESULT GetStringAttributeAsBstr(
298 ui::AXStringAttribute attribute,
299 BSTR* value_bstr) const;
300
301 void AddAlertTarget();
302 void RemoveAlertTarget();
303
304 // Return the text to use for IAccessibleText.
305 base::string16 TextForIAccessibleText();
306
307 // If offset is a member of IA2TextSpecialOffsets this function updates the
308 // value of offset and returns, otherwise offset remains unchanged.
309 void HandleSpecialTextOffset(const base::string16& text, LONG* offset);
310
311 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType.
312 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type);
313
314 // Search forwards (direction == 1) or backwards (direction == -1)
315 // from the given offset until the given boundary is found, and
316 // return the offset of that boundary.
317 LONG FindBoundary(const base::string16& text,
318 IA2TextBoundaryType ia2_boundary,
319 LONG start_offset,
320 ui::TextBoundaryDirection direction);
321
322 // A windows-specific unique ID for this object. It's returned in
323 // IAccessible2::get_uniqueID, but more importantly it's used for
324 // firing events. On Windows, we fire events on the nearest parent HWND
325 // and pass the unique ID as the child id parameter. When the client
326 // wants to retrieve the object the event was fired on, it calls
327 // get_accChild and passes the child ID. We use negative IDs for the unique
328 // ID so we can distinguish a request for an arbitrary child from a request
329 // for an immediate child of an object by its 0-based index.
330 LONG unique_id_win_;
331 };
332
333 } // namespace ui
334
335 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
OLDNEW
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_mac.mm ('k') | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698