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 #include "views/accessibility/view_accessibility.h" | 5 #include "views/accessibility/view_accessibility.h" |
6 | 6 |
7 #include "app/view_prop.h" | 7 #include "app/view_prop.h" |
8 #include "views/widget/widget.h" | 8 #include "views/widget/widget.h" |
9 #include "views/widget/widget_win.h" | 9 #include "views/widget/widget_win.h" |
10 | 10 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 275 } |
276 | 276 |
277 STDMETHODIMP ViewAccessibility::get_accDefaultAction( | 277 STDMETHODIMP ViewAccessibility::get_accDefaultAction( |
278 VARIANT var_id, BSTR* def_action) { | 278 VARIANT var_id, BSTR* def_action) { |
279 if (!IsValidId(var_id) || !def_action) | 279 if (!IsValidId(var_id) || !def_action) |
280 return E_INVALIDARG; | 280 return E_INVALIDARG; |
281 | 281 |
282 if (!view_) | 282 if (!view_) |
283 return E_FAIL; | 283 return E_FAIL; |
284 | 284 |
285 std::wstring temp_action = view_->GetAccessibleDefaultAction(); | 285 string16 temp_action = view_->GetAccessibleDefaultAction(); |
286 | 286 |
287 if (!temp_action.empty()) { | 287 if (!temp_action.empty()) { |
288 *def_action = SysAllocString(temp_action.c_str()); | 288 *def_action = SysAllocString(temp_action.c_str()); |
289 } else { | 289 } else { |
290 return S_FALSE; | 290 return S_FALSE; |
291 } | 291 } |
292 | 292 |
293 return S_OK; | 293 return S_OK; |
294 } | 294 } |
295 | 295 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 340 } |
341 | 341 |
342 STDMETHODIMP ViewAccessibility::get_accKeyboardShortcut( | 342 STDMETHODIMP ViewAccessibility::get_accKeyboardShortcut( |
343 VARIANT var_id, BSTR* acc_key) { | 343 VARIANT var_id, BSTR* acc_key) { |
344 if (!IsValidId(var_id) || !acc_key) | 344 if (!IsValidId(var_id) || !acc_key) |
345 return E_INVALIDARG; | 345 return E_INVALIDARG; |
346 | 346 |
347 if (!view_) | 347 if (!view_) |
348 return E_FAIL; | 348 return E_FAIL; |
349 | 349 |
350 std::wstring temp_key = view_->GetAccessibleKeyboardShortcut(); | 350 string16 temp_key = view_->GetAccessibleKeyboardShortcut(); |
351 | 351 |
352 if (!temp_key.empty()) { | 352 if (!temp_key.empty()) { |
353 *acc_key = SysAllocString(temp_key.c_str()); | 353 *acc_key = SysAllocString(temp_key.c_str()); |
354 } else { | 354 } else { |
355 return S_FALSE; | 355 return S_FALSE; |
356 } | 356 } |
357 | 357 |
358 return S_OK; | 358 return S_OK; |
359 } | 359 } |
360 | 360 |
361 STDMETHODIMP ViewAccessibility::get_accName(VARIANT var_id, BSTR* name) { | 361 STDMETHODIMP ViewAccessibility::get_accName(VARIANT var_id, BSTR* name) { |
362 if (!IsValidId(var_id) || !name) | 362 if (!IsValidId(var_id) || !name) |
363 return E_INVALIDARG; | 363 return E_INVALIDARG; |
364 | 364 |
365 if (!view_) | 365 if (!view_) |
366 return E_FAIL; | 366 return E_FAIL; |
367 | 367 |
368 std::wstring temp_name; | 368 string16 temp_name; |
369 | 369 |
370 // Retrieve the current view's name. | 370 // Retrieve the current view's name. |
371 view_->GetAccessibleName(&temp_name); | 371 view_->GetAccessibleName(&temp_name); |
372 if (!temp_name.empty()) { | 372 if (!temp_name.empty()) { |
373 // Return name retrieved. | 373 // Return name retrieved. |
374 *name = SysAllocString(temp_name.c_str()); | 374 *name = SysAllocString(temp_name.c_str()); |
375 } else { | 375 } else { |
376 // If view has no name, return S_FALSE. | 376 // If view has no name, return S_FALSE. |
377 return S_FALSE; | 377 return S_FALSE; |
378 } | 378 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 } | 450 } |
451 | 451 |
452 STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) { | 452 STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) { |
453 if (!IsValidId(var_id) || !value) | 453 if (!IsValidId(var_id) || !value) |
454 return E_INVALIDARG; | 454 return E_INVALIDARG; |
455 | 455 |
456 if (!view_) | 456 if (!view_) |
457 return E_FAIL; | 457 return E_FAIL; |
458 | 458 |
459 // Retrieve the current view's value. | 459 // Retrieve the current view's value. |
460 std::wstring temp_value = view_->GetAccessibleValue(); | 460 string16 temp_value = view_->GetAccessibleValue(); |
461 | 461 |
462 if (!temp_value.empty()) { | 462 if (!temp_value.empty()) { |
463 // Return value retrieved. | 463 // Return value retrieved. |
464 *value = SysAllocString(temp_value.c_str()); | 464 *value = SysAllocString(temp_value.c_str()); |
465 } else { | 465 } else { |
466 // If view has no value, fall back into the default implementation. | 466 // If view has no value, fall back into the default implementation. |
467 *value = NULL; | 467 *value = NULL; |
468 return E_NOTIMPL; | 468 return E_NOTIMPL; |
469 } | 469 } |
470 | 470 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 HWND native_view_window , IAccessible** accessible) { | 726 HWND native_view_window , IAccessible** accessible) { |
727 if (IsWindow(native_view_window)) { | 727 if (IsWindow(native_view_window)) { |
728 LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0, | 728 LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0, |
729 OBJID_CLIENT); | 729 OBJID_CLIENT); |
730 return ObjectFromLresult(ret, IID_IDispatch, 0, | 730 return ObjectFromLresult(ret, IID_IDispatch, 0, |
731 reinterpret_cast<void**>(accessible)); | 731 reinterpret_cast<void**>(accessible)); |
732 } | 732 } |
733 | 733 |
734 return E_FAIL; | 734 return E_FAIL; |
735 } | 735 } |
OLD | NEW |