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