OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/browser_accessibility.h" | 5 #include "chrome/browser/browser_accessibility.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/browser_accessibility_manager.h" | 8 #include "chrome/browser/browser_accessibility_manager.h" |
9 | 9 |
10 using webkit_glue::WebAccessibility; | 10 using webkit_glue::WebAccessibility; |
(...skipping 11 matching lines...) Expand all Loading... |
22 parent_hwnd_ = parent_hwnd; | 22 parent_hwnd_ = parent_hwnd; |
23 | 23 |
24 // Mark instance as active. | 24 // Mark instance as active. |
25 instance_active_ = true; | 25 instance_active_ = true; |
26 return S_OK; | 26 return S_OK; |
27 } | 27 } |
28 | 28 |
29 HRESULT BrowserAccessibility::accDoDefaultAction(VARIANT var_id) { | 29 HRESULT BrowserAccessibility::accDoDefaultAction(VARIANT var_id) { |
30 if (!instance_active()) { | 30 if (!instance_active()) { |
31 // Instance no longer active, fail gracefully. | 31 // Instance no longer active, fail gracefully. |
32 // TODO(klink): Once we have MSAA events, change these fails to having | 32 // TODO(ctguil): Once we have MSAA events, change these fails to having |
33 // BrowserAccessibilityManager firing the right event. | 33 // BrowserAccessibilityManager firing the right event. |
34 return E_FAIL; | 34 return E_FAIL; |
35 } | 35 } |
36 | 36 |
37 if (var_id.vt != VT_I4) | 37 if (var_id.vt != VT_I4) |
38 return E_INVALIDARG; | 38 return E_INVALIDARG; |
39 | 39 |
40 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_DODEFAULTACTION, | 40 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_DODEFAULTACTION, |
41 var_id, NULL, NULL)) { | 41 var_id, NULL, NULL)) { |
42 return E_FAIL; | 42 return E_FAIL; |
43 } | 43 } |
44 | 44 |
45 if (!response().return_code) | 45 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) |
46 return S_FALSE; | 46 return S_FALSE; |
47 | 47 |
48 return S_OK; | 48 return S_OK; |
49 } | 49 } |
50 | 50 |
51 STDMETHODIMP BrowserAccessibility::accHitTest(LONG x_left, LONG y_top, | 51 STDMETHODIMP BrowserAccessibility::accHitTest(LONG x_left, LONG y_top, |
52 VARIANT* child) { | 52 VARIANT* child) { |
53 if (!instance_active()) { | 53 if (!instance_active()) { |
54 // Instance no longer active, fail gracefully. | 54 // Instance no longer active, fail gracefully. |
55 return E_FAIL; | 55 return E_FAIL; |
56 } | 56 } |
57 | 57 |
58 if (!child) | 58 if (!child) |
59 return E_INVALIDARG; | 59 return E_INVALIDARG; |
60 | 60 |
61 if (!parent_hwnd_) { | 61 if (!parent_hwnd_) { |
62 // Parent HWND needed for coordinate conversion. | 62 // Parent HWND needed for coordinate conversion. |
63 return E_FAIL; | 63 return E_FAIL; |
64 } | 64 } |
65 | 65 |
66 // Convert coordinates to test from screen into client window coordinates, to | 66 // Convert coordinates to test from screen into client window coordinates, to |
67 // maintain sandbox functionality on renderer side. | 67 // maintain sandbox functionality on renderer side. |
68 POINT p = {x_left, y_top}; | 68 POINT p = {x_left, y_top}; |
69 ::ScreenToClient(parent_hwnd_, &p); | 69 ::ScreenToClient(parent_hwnd_, &p); |
70 | 70 |
71 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_HITTEST, | 71 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_HITTEST, |
72 EmptyVariant(), p.x, p.y)) { | 72 ChildSelfVariant(), p.x, p.y)) { |
73 return E_FAIL; | 73 return E_FAIL; |
74 } | 74 } |
75 | 75 |
76 if (!response().return_code) { | 76 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
77 // The point is outside of the object's boundaries. | 77 // The point is outside of the object's boundaries. |
78 child->vt = VT_EMPTY; | 78 child->vt = VT_EMPTY; |
79 return S_FALSE; | 79 return S_FALSE; |
80 } | 80 } |
81 | 81 |
82 if (response().output_long1 == -1) { | 82 if (response().output_long1 == -1) { |
83 if (CreateInstance(IID_IAccessible, response().object_id, | 83 if (CreateInstance(IID_IAccessible, response().object_id, |
84 reinterpret_cast<void**>(&child->pdispVal)) == S_OK) { | 84 reinterpret_cast<void**>(&child->pdispVal)) == S_OK) { |
85 child->vt = VT_DISPATCH; | 85 child->vt = VT_DISPATCH; |
86 // Increment the reference count for the retrieved interface. | 86 // Increment the reference count for the retrieved interface. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 nav_dir == NAVDIR_LEFT || nav_dir == NAVDIR_RIGHT) { | 149 nav_dir == NAVDIR_LEFT || nav_dir == NAVDIR_RIGHT) { |
150 // Directions not implemented, matching Mozilla and IE. | 150 // Directions not implemented, matching Mozilla and IE. |
151 return E_INVALIDARG; | 151 return E_INVALIDARG; |
152 } | 152 } |
153 | 153 |
154 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_NAVIGATE, start, | 154 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_NAVIGATE, start, |
155 nav_dir, NULL)) { | 155 nav_dir, NULL)) { |
156 return E_FAIL; | 156 return E_FAIL; |
157 } | 157 } |
158 | 158 |
159 if (!response().return_code) { | 159 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
160 // No screen element was found in the specified direction. | 160 // No screen element was found in the specified direction. |
161 end->vt = VT_EMPTY; | 161 end->vt = VT_EMPTY; |
162 return S_FALSE; | 162 return S_FALSE; |
163 } | 163 } |
164 | 164 |
165 if (response().output_long1 == -1) { | 165 if (response().output_long1 == -1) { |
166 if (CreateInstance(IID_IAccessible, response().object_id, | 166 if (CreateInstance(IID_IAccessible, response().object_id, |
167 reinterpret_cast<void**>(&end->pdispVal)) == S_OK) { | 167 reinterpret_cast<void**>(&end->pdispVal)) == S_OK) { |
168 end->vt = VT_DISPATCH; | 168 end->vt = VT_DISPATCH; |
169 // Increment the reference count for the retrieved interface. | 169 // Increment the reference count for the retrieved interface. |
(...skipping 21 matching lines...) Expand all Loading... |
191 | 191 |
192 // If var_child is the parent, remain with the same IDispatch. | 192 // If var_child is the parent, remain with the same IDispatch. |
193 if (var_child.lVal == CHILDID_SELF && iaccessible_id_ != 1000) | 193 if (var_child.lVal == CHILDID_SELF && iaccessible_id_ != 1000) |
194 return S_OK; | 194 return S_OK; |
195 | 195 |
196 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETCHILD, var_child, | 196 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETCHILD, var_child, |
197 NULL, NULL)) { | 197 NULL, NULL)) { |
198 return E_FAIL; | 198 return E_FAIL; |
199 } | 199 } |
200 | 200 |
201 if (!response().return_code) { | 201 // TODO(ctguil): Figure out when the return code would be false |
| 202 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
202 // When at a leaf, children are handled by the parent object. | 203 // When at a leaf, children are handled by the parent object. |
203 *disp_child = NULL; | 204 *disp_child = NULL; |
204 return S_FALSE; | 205 return S_FALSE; |
205 } | 206 } |
206 | 207 |
207 // Retrieve the IUnknown interface for the parent view, and assign the | 208 // Retrieve the IUnknown interface for the parent view, and assign the |
208 // IDispatch returned. | 209 // IDispatch returned. |
209 if (CreateInstance(IID_IAccessible, response().object_id, | 210 if (CreateInstance(IID_IAccessible, response().object_id, |
210 reinterpret_cast<void**>(disp_child)) == S_OK) { | 211 reinterpret_cast<void**>(disp_child)) == S_OK) { |
211 // Increment the reference count for the retrieved interface. | 212 // Increment the reference count for the retrieved interface. |
212 (*disp_child)->AddRef(); | 213 (*disp_child)->AddRef(); |
213 return S_OK; | 214 return S_OK; |
214 } else { | 215 } else { |
215 return E_NOINTERFACE; | 216 return E_NOINTERFACE; |
216 } | 217 } |
217 } | 218 } |
218 | 219 |
219 STDMETHODIMP BrowserAccessibility::get_accChildCount(LONG* child_count) { | 220 STDMETHODIMP BrowserAccessibility::get_accChildCount(LONG* child_count) { |
220 if (!instance_active()) { | 221 if (!instance_active()) { |
221 // Instance no longer active, fail gracefully. | 222 // Instance no longer active, fail gracefully. |
222 return E_FAIL; | 223 return E_FAIL; |
223 } | 224 } |
224 | 225 |
225 if (!child_count) | 226 if (!child_count) |
226 return E_INVALIDARG; | 227 return E_INVALIDARG; |
227 | 228 |
228 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_CHILDCOUNT, | 229 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_CHILDCOUNT, |
229 EmptyVariant(), NULL, NULL)) { | 230 ChildSelfVariant(), NULL, NULL)) { |
230 return E_FAIL; | 231 return E_FAIL; |
231 } | 232 } |
232 | 233 |
233 *child_count = response().output_long1; | 234 *child_count = response().output_long1; |
234 return S_OK; | 235 return S_OK; |
235 } | 236 } |
236 | 237 |
237 STDMETHODIMP BrowserAccessibility::get_accDefaultAction(VARIANT var_id, | 238 STDMETHODIMP BrowserAccessibility::get_accDefaultAction(VARIANT var_id, |
238 BSTR* def_action) { | 239 BSTR* def_action) { |
239 if (!instance_active()) { | 240 if (!instance_active()) { |
240 // Instance no longer active, fail gracefully. | 241 // Instance no longer active, fail gracefully. |
241 return E_FAIL; | 242 return E_FAIL; |
242 } | 243 } |
243 | 244 |
244 if (var_id.vt != VT_I4 || !def_action) | 245 if (var_id.vt != VT_I4 || !def_action) |
245 return E_INVALIDARG; | 246 return E_INVALIDARG; |
246 | 247 |
247 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_DEFAULTACTION, | 248 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_DEFAULTACTION, |
248 var_id, NULL, NULL)) { | 249 var_id, NULL, NULL)) { |
249 return E_FAIL; | 250 return E_FAIL; |
250 } | 251 } |
251 | 252 |
252 if (!response().return_code) { | 253 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
253 // No string found. | 254 // No string found. |
254 return S_FALSE; | 255 return S_FALSE; |
255 } | 256 } |
256 | 257 |
257 *def_action = SysAllocString(response().output_string.c_str()); | 258 *def_action = SysAllocString(response().output_string.c_str()); |
258 | 259 |
259 DCHECK(*def_action); | 260 DCHECK(*def_action); |
260 return S_OK; | 261 return S_OK; |
261 } | 262 } |
262 | 263 |
263 STDMETHODIMP BrowserAccessibility::get_accDescription(VARIANT var_id, | 264 STDMETHODIMP BrowserAccessibility::get_accDescription(VARIANT var_id, |
264 BSTR* desc) { | 265 BSTR* desc) { |
265 if (!instance_active()) { | 266 if (!instance_active()) { |
266 // Instance no longer active, fail gracefully. | 267 // Instance no longer active, fail gracefully. |
267 return E_FAIL; | 268 return E_FAIL; |
268 } | 269 } |
269 | 270 |
270 if (var_id.vt != VT_I4 || !desc) | 271 if (var_id.vt != VT_I4 || !desc) |
271 return E_INVALIDARG; | 272 return E_INVALIDARG; |
272 | 273 |
273 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_DESCRIPTION, var_id, | 274 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_DESCRIPTION, var_id, |
274 NULL, NULL)) { | 275 NULL, NULL)) { |
275 return E_FAIL; | 276 return E_FAIL; |
276 } | 277 } |
277 | 278 |
278 if (!response().return_code) { | 279 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
279 // No string found. | 280 // No string found. |
280 return S_FALSE; | 281 return S_FALSE; |
281 } | 282 } |
282 | 283 |
283 *desc = SysAllocString(response().output_string.c_str()); | 284 *desc = SysAllocString(response().output_string.c_str()); |
284 | 285 |
285 DCHECK(*desc); | 286 DCHECK(*desc); |
286 return S_OK; | 287 return S_OK; |
287 } | 288 } |
288 | 289 |
289 STDMETHODIMP BrowserAccessibility::get_accFocus(VARIANT* focus_child) { | 290 STDMETHODIMP BrowserAccessibility::get_accFocus(VARIANT* focus_child) { |
290 if (!instance_active()) { | 291 if (!instance_active()) { |
291 // Instance no longer active, fail gracefully. | 292 // Instance no longer active, fail gracefully. |
292 return E_FAIL; | 293 return E_FAIL; |
293 } | 294 } |
294 | 295 |
295 if (!focus_child) | 296 if (!focus_child) |
296 return E_INVALIDARG; | 297 return E_INVALIDARG; |
297 | 298 |
298 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETFOCUSEDCHILD, | 299 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETFOCUSEDCHILD, |
299 EmptyVariant(), NULL, NULL)) { | 300 ChildSelfVariant(), NULL, NULL)) { |
300 return E_FAIL; | 301 return E_FAIL; |
301 } | 302 } |
302 | 303 |
303 if (!response().return_code) { | 304 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
304 // The window that contains this object is not the active window. | 305 // The window that contains this object is not the active window. |
305 focus_child->vt = VT_EMPTY; | 306 focus_child->vt = VT_EMPTY; |
306 return S_FALSE; | 307 return S_FALSE; |
307 } | 308 } |
308 | 309 |
309 if (response().output_long1 == -1) { | 310 if (response().output_long1 == -1) { |
310 if (CreateInstance(IID_IAccessible, response().object_id, | 311 if (CreateInstance(IID_IAccessible, response().object_id, |
311 reinterpret_cast<void**>(&focus_child->pdispVal)) == S_OK) { | 312 reinterpret_cast<void**>(&focus_child->pdispVal)) == S_OK) { |
312 focus_child->vt = VT_DISPATCH; | 313 focus_child->vt = VT_DISPATCH; |
313 // Increment the reference count for the retrieved interface. | 314 // Increment the reference count for the retrieved interface. |
(...skipping 16 matching lines...) Expand all Loading... |
330 } | 331 } |
331 | 332 |
332 if (var_id.vt != VT_I4 || !help) | 333 if (var_id.vt != VT_I4 || !help) |
333 return E_INVALIDARG; | 334 return E_INVALIDARG; |
334 | 335 |
335 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_HELPTEXT, var_id, | 336 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_HELPTEXT, var_id, |
336 NULL, NULL)) { | 337 NULL, NULL)) { |
337 return E_FAIL; | 338 return E_FAIL; |
338 } | 339 } |
339 | 340 |
340 if (!response().return_code || response().output_string.empty()) { | 341 if (response().return_code == WebAccessibility::RETURNCODE_FALSE || |
| 342 response().output_string.empty()) { |
341 // No string found. | 343 // No string found. |
342 return S_FALSE; | 344 return S_FALSE; |
343 } | 345 } |
344 | 346 |
345 *help = SysAllocString(response().output_string.c_str()); | 347 *help = SysAllocString(response().output_string.c_str()); |
346 | 348 |
347 DCHECK(*help); | 349 DCHECK(*help); |
348 return S_OK; | 350 return S_OK; |
349 } | 351 } |
350 | 352 |
351 STDMETHODIMP BrowserAccessibility::get_accKeyboardShortcut(VARIANT var_id, | 353 STDMETHODIMP BrowserAccessibility::get_accKeyboardShortcut(VARIANT var_id, |
352 BSTR* acc_key) { | 354 BSTR* acc_key) { |
353 if (!instance_active()) { | 355 if (!instance_active()) { |
354 // Instance no longer active, fail gracefully. | 356 // Instance no longer active, fail gracefully. |
355 return E_FAIL; | 357 return E_FAIL; |
356 } | 358 } |
357 | 359 |
358 if (var_id.vt != VT_I4 || !acc_key) | 360 if (var_id.vt != VT_I4 || !acc_key) |
359 return E_INVALIDARG; | 361 return E_INVALIDARG; |
360 | 362 |
361 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_KEYBOARDSHORTCUT, | 363 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_KEYBOARDSHORTCUT, |
362 var_id, NULL, NULL)) { | 364 var_id, NULL, NULL)) { |
363 return E_FAIL; | 365 return E_FAIL; |
364 } | 366 } |
365 | 367 |
366 if (!response().return_code) { | 368 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
367 // No string found. | 369 // No string found. |
368 return S_FALSE; | 370 return S_FALSE; |
369 } | 371 } |
370 | 372 |
371 *acc_key = SysAllocString(response().output_string.c_str()); | 373 *acc_key = SysAllocString(response().output_string.c_str()); |
372 | 374 |
373 DCHECK(*acc_key); | 375 DCHECK(*acc_key); |
374 return S_OK; | 376 return S_OK; |
375 } | 377 } |
376 | 378 |
377 STDMETHODIMP BrowserAccessibility::get_accName(VARIANT var_id, BSTR* name) { | 379 STDMETHODIMP BrowserAccessibility::get_accName(VARIANT var_id, BSTR* name) { |
378 if (!instance_active()) { | 380 if (!instance_active()) { |
379 // Instance no longer active, fail gracefully. | 381 // Instance no longer active, fail gracefully. |
380 return E_FAIL; | 382 return E_FAIL; |
381 } | 383 } |
382 | 384 |
383 if (var_id.vt != VT_I4 || !name) | 385 if (var_id.vt != VT_I4 || !name) |
384 return E_INVALIDARG; | 386 return E_INVALIDARG; |
385 | 387 |
386 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_NAME, var_id, NULL, | 388 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_NAME, var_id, NULL, |
387 NULL)) { | 389 NULL)) { |
388 return E_FAIL; | 390 return E_FAIL; |
389 } | 391 } |
390 | 392 |
391 if (!response().return_code) { | 393 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
392 // No string found. | 394 // No string found. |
393 return S_FALSE; | 395 return S_FALSE; |
394 } | 396 } |
395 | 397 |
396 *name = SysAllocString(response().output_string.c_str()); | 398 *name = SysAllocString(response().output_string.c_str()); |
397 | 399 |
398 DCHECK(*name); | 400 DCHECK(*name); |
399 return S_OK; | 401 return S_OK; |
400 } | 402 } |
401 | 403 |
(...skipping 16 matching lines...) Expand all Loading... |
418 reinterpret_cast<void**>(disp_parent)); | 420 reinterpret_cast<void**>(disp_parent)); |
419 | 421 |
420 if (!SUCCEEDED(hr)) { | 422 if (!SUCCEEDED(hr)) { |
421 *disp_parent = NULL; | 423 *disp_parent = NULL; |
422 return S_FALSE; | 424 return S_FALSE; |
423 } | 425 } |
424 return S_OK; | 426 return S_OK; |
425 } | 427 } |
426 | 428 |
427 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETPARENT, | 429 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETPARENT, |
428 EmptyVariant(), NULL, NULL)) { | 430 ChildSelfVariant(), NULL, NULL)) { |
429 return E_FAIL; | 431 return E_FAIL; |
430 } | 432 } |
431 | 433 |
432 if (!response().return_code) { | 434 if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
433 // No parent exists for this object. | 435 // No parent exists for this object. |
434 return S_FALSE; | 436 return S_FALSE; |
435 } | 437 } |
436 | 438 |
437 // Retrieve the IUnknown interface for the parent view, and assign the | 439 // Retrieve the IUnknown interface for the parent view, and assign the |
438 // IDispatch returned. | 440 // IDispatch returned. |
439 if (CreateInstance(IID_IAccessible, response().object_id, | 441 if (CreateInstance(IID_IAccessible, response().object_id, |
440 reinterpret_cast<void**>(disp_parent)) == S_OK) { | 442 reinterpret_cast<void**>(disp_parent)) == S_OK) { |
441 // Increment the reference count for the retrieved interface. | 443 // Increment the reference count for the retrieved interface. |
442 (*disp_parent)->AddRef(); | 444 (*disp_parent)->AddRef(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 } | 494 } |
493 | 495 |
494 if (var_id.vt != VT_I4 || !value) | 496 if (var_id.vt != VT_I4 || !value) |
495 return E_INVALIDARG; | 497 return E_INVALIDARG; |
496 | 498 |
497 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_VALUE, var_id, NULL, | 499 if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_VALUE, var_id, NULL, |
498 NULL)) { | 500 NULL)) { |
499 return E_FAIL; | 501 return E_FAIL; |
500 } | 502 } |
501 | 503 |
502 if (!response().return_code || response().output_string.empty()) { | 504 if (response().return_code == WebAccessibility::RETURNCODE_FALSE || |
| 505 response().output_string.empty()) { |
503 // No string found. | 506 // No string found. |
504 return S_FALSE; | 507 return S_FALSE; |
505 } | 508 } |
506 | 509 |
507 *value = SysAllocString(response().output_string.c_str()); | 510 *value = SysAllocString(response().output_string.c_str()); |
508 | 511 |
509 DCHECK(*value); | 512 DCHECK(*value); |
510 return S_OK; | 513 return S_OK; |
511 } | 514 } |
512 | 515 |
(...skipping 20 matching lines...) Expand all Loading... |
533 int iaccessible_id, | 536 int iaccessible_id, |
534 void** interface_ptr) { | 537 void** interface_ptr) { |
535 return BrowserAccessibilityManager::GetInstance()-> | 538 return BrowserAccessibilityManager::GetInstance()-> |
536 CreateAccessibilityInstance(iid, iaccessible_id, routing_id_, | 539 CreateAccessibilityInstance(iid, iaccessible_id, routing_id_, |
537 process_id_, parent_hwnd_, interface_ptr); | 540 process_id_, parent_hwnd_, interface_ptr); |
538 } | 541 } |
539 | 542 |
540 bool BrowserAccessibility::RequestAccessibilityInfo(int iaccessible_func_id, | 543 bool BrowserAccessibility::RequestAccessibilityInfo(int iaccessible_func_id, |
541 VARIANT var_id, LONG input1, | 544 VARIANT var_id, LONG input1, |
542 LONG input2) { | 545 LONG input2) { |
| 546 DCHECK(V_VT(&var_id) == VT_I4); |
| 547 |
543 // Create and populate IPC message structure, for retrieval of accessibility | 548 // Create and populate IPC message structure, for retrieval of accessibility |
544 // information from the renderer. | 549 // information from the renderer. |
545 WebAccessibility::InParams in_params; | 550 WebAccessibility::InParams in_params; |
546 in_params.object_id = iaccessible_id_; | 551 in_params.object_id = iaccessible_id_; |
547 in_params.function_id = iaccessible_func_id; | 552 in_params.function_id = iaccessible_func_id; |
548 in_params.child_id = var_id.lVal; | 553 in_params.child_id = V_I4(&var_id); |
549 in_params.input_long1 = input1; | 554 in_params.input_long1 = input1; |
550 in_params.input_long2 = input2; | 555 in_params.input_long2 = input2; |
551 | 556 |
552 return BrowserAccessibilityManager::GetInstance()-> | 557 return BrowserAccessibilityManager::GetInstance()-> |
553 RequestAccessibilityInfo(&in_params, routing_id_, process_id_); | 558 RequestAccessibilityInfo(&in_params, routing_id_, process_id_) && |
| 559 response().return_code != WebAccessibility::RETURNCODE_FAIL; |
554 } | 560 } |
555 | 561 |
556 const WebAccessibility::OutParams& BrowserAccessibility::response() { | 562 const WebAccessibility::OutParams& BrowserAccessibility::response() { |
557 return BrowserAccessibilityManager::GetInstance()->response(); | 563 return BrowserAccessibilityManager::GetInstance()->response(); |
558 } | 564 } |
559 | 565 |
560 long BrowserAccessibility::MSAARole(long browser_accessibility_role) { | 566 long BrowserAccessibility::MSAARole(long browser_accessibility_role) { |
561 switch (browser_accessibility_role) { | 567 switch (browser_accessibility_role) { |
562 case WebAccessibility::ROLE_APPLICATION: | 568 case WebAccessibility::ROLE_APPLICATION: |
563 return ROLE_SYSTEM_APPLICATION; | 569 return ROLE_SYSTEM_APPLICATION; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 state |= STATE_SYSTEM_READONLY; | 672 state |= STATE_SYSTEM_READONLY; |
667 | 673 |
668 if ((browser_accessibility_state >> WebAccessibility::STATE_TRAVERSED) & 1) | 674 if ((browser_accessibility_state >> WebAccessibility::STATE_TRAVERSED) & 1) |
669 state |= STATE_SYSTEM_TRAVERSED; | 675 state |= STATE_SYSTEM_TRAVERSED; |
670 | 676 |
671 if ((browser_accessibility_state >> WebAccessibility::STATE_UNAVAILABLE) & 1) | 677 if ((browser_accessibility_state >> WebAccessibility::STATE_UNAVAILABLE) & 1) |
672 state |= STATE_SYSTEM_UNAVAILABLE; | 678 state |= STATE_SYSTEM_UNAVAILABLE; |
673 | 679 |
674 return state; | 680 return state; |
675 } | 681 } |
OLD | NEW |