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 "views/widget/widget.h" | 8 #include "views/widget/widget.h" |
8 #include "views/widget/widget_win.h" | 9 #include "views/widget/widget_win.h" |
9 | 10 |
10 const wchar_t kViewsNativeHostPropForAccessibility[] = | 11 const char kViewsNativeHostPropForAccessibility[] = |
11 L"Views_NativeViewHostHWNDForAccessibility"; | 12 "Views_NativeViewHostHWNDForAccessibility"; |
12 | 13 |
13 // static | 14 // static |
14 scoped_refptr<ViewAccessibility> ViewAccessibility::Create(views::View* view) { | 15 scoped_refptr<ViewAccessibility> ViewAccessibility::Create(views::View* view) { |
15 CComObject<ViewAccessibility>* instance = NULL; | 16 CComObject<ViewAccessibility>* instance = NULL; |
16 HRESULT hr = CComObject<ViewAccessibility>::CreateInstance(&instance); | 17 HRESULT hr = CComObject<ViewAccessibility>::CreateInstance(&instance); |
17 DCHECK(SUCCEEDED(hr)); | 18 DCHECK(SUCCEEDED(hr)); |
18 instance->set_view(view); | 19 instance->set_view(view); |
19 return scoped_refptr<ViewAccessibility>(instance); | 20 return scoped_refptr<ViewAccessibility>(instance); |
20 } | 21 } |
21 | 22 |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 msaa_state |= STATE_SYSTEM_UNAVAILABLE; | 704 msaa_state |= STATE_SYSTEM_UNAVAILABLE; |
704 return msaa_state; | 705 return msaa_state; |
705 } | 706 } |
706 | 707 |
707 // static | 708 // static |
708 HRESULT ViewAccessibility::GetNativeIAccessibleInterface( | 709 HRESULT ViewAccessibility::GetNativeIAccessibleInterface( |
709 views::NativeViewHost* native_host, IAccessible** accessible) { | 710 views::NativeViewHost* native_host, IAccessible** accessible) { |
710 if (!native_host || !accessible) | 711 if (!native_host || !accessible) |
711 return E_INVALIDARG; | 712 return E_INVALIDARG; |
712 | 713 |
713 HWND native_view_window = | 714 HWND native_view_window = static_cast<HWND>( |
714 static_cast<HWND>(GetProp(native_host->native_view(), | 715 app::ViewProp::GetValue(native_host->native_view(), |
715 kViewsNativeHostPropForAccessibility)); | 716 kViewsNativeHostPropForAccessibility)); |
716 if (!IsWindow(native_view_window)) { | 717 if (!IsWindow(native_view_window)) { |
717 native_view_window = native_host->native_view(); | 718 native_view_window = native_host->native_view(); |
718 } | 719 } |
719 | 720 |
720 return GetNativeIAccessibleInterface(native_view_window, accessible); | 721 return GetNativeIAccessibleInterface(native_view_window, accessible); |
721 } | 722 } |
722 | 723 |
723 // static | 724 // static |
724 HRESULT ViewAccessibility::GetNativeIAccessibleInterface( | 725 HRESULT ViewAccessibility::GetNativeIAccessibleInterface( |
725 HWND native_view_window , IAccessible** accessible) { | 726 HWND native_view_window , IAccessible** accessible) { |
726 if (IsWindow(native_view_window)) { | 727 if (IsWindow(native_view_window)) { |
727 LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0, | 728 LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0, |
728 OBJID_CLIENT); | 729 OBJID_CLIENT); |
729 return ObjectFromLresult(ret, IID_IDispatch, 0, | 730 return ObjectFromLresult(ret, IID_IDispatch, 0, |
730 reinterpret_cast<void**>(accessible)); | 731 reinterpret_cast<void**>(accessible)); |
731 } | 732 } |
732 | 733 |
733 return E_FAIL; | 734 return E_FAIL; |
734 } | 735 } |
OLD | NEW |