Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/accessibility/native_view_accessibility_win.h" | 5 #include "ui/views/accessibility/native_view_accessibility_win.h" |
| 6 | 6 |
| 7 #include <oleacc.h> | 7 #include <oleacc.h> |
| 8 | 8 |
| 9 #include <memory> | |
| 9 #include <set> | 10 #include <set> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 13 #include "base/memory/ptr_util.h" | |
| 12 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/win/scoped_comptr.h" | 16 #include "base/win/scoped_comptr.h" |
| 15 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
| 16 #include "third_party/iaccessible2/ia2_api_all.h" | 18 #include "third_party/iaccessible2/ia2_api_all.h" |
| 17 #include "ui/accessibility/ax_enums.h" | 19 #include "ui/accessibility/ax_enums.h" |
| 18 #include "ui/accessibility/ax_node_data.h" | 20 #include "ui/accessibility/ax_node_data.h" |
| 19 #include "ui/accessibility/ax_text_utils.h" | 21 #include "ui/accessibility/ax_text_utils.h" |
| 20 #include "ui/base/win/accessibility_misc_utils.h" | 22 #include "ui/base/win/accessibility_misc_utils.h" |
| 21 #include "ui/base/win/atl_module.h" | 23 #include "ui/base/win/atl_module.h" |
| 22 #include "ui/views/controls/button/custom_button.h" | 24 #include "ui/views/controls/button/custom_button.h" |
| 23 #include "ui/views/focus/focus_manager.h" | 25 #include "ui/views/focus/focus_manager.h" |
| 24 #include "ui/views/focus/view_storage.h" | 26 #include "ui/views/focus/view_storage.h" |
| 25 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 26 #include "ui/views/win/hwnd_util.h" | 28 #include "ui/views/win/hwnd_util.h" |
| 27 | 29 |
| 28 namespace views { | 30 namespace views { |
| 29 | 31 |
| 30 // static | |
| 31 NativeViewAccessibility* NativeViewAccessibility::Create(View* view) { | |
| 32 return new NativeViewAccessibilityWin(view); | |
| 33 } | |
| 34 | |
| 35 NativeViewAccessibilityWin::NativeViewAccessibilityWin(View* view) | |
| 36 : NativeViewAccessibility(view) { | |
| 37 } | |
| 38 | |
| 39 NativeViewAccessibilityWin::~NativeViewAccessibilityWin() { | |
| 40 } | |
| 41 | |
| 42 gfx::NativeViewAccessible NativeViewAccessibilityWin::GetParent() { | 32 gfx::NativeViewAccessible NativeViewAccessibilityWin::GetParent() { |
| 43 IAccessible* parent = NativeViewAccessibility::GetParent(); | 33 IAccessible* parent = NativeViewAccessibility::GetParent(); |
| 44 if (parent) | 34 if (parent) |
| 45 return parent; | 35 return parent; |
| 46 | 36 |
| 47 HWND hwnd = HWNDForView(view_); | 37 HWND hwnd = HWNDForView(view_); |
| 48 if (!hwnd) | 38 if (!hwnd) |
| 49 return NULL; | 39 return NULL; |
| 50 | 40 |
| 51 HRESULT hr = ::AccessibleObjectFromWindow( | 41 HRESULT hr = ::AccessibleObjectFromWindow( |
| 52 hwnd, OBJID_WINDOW, IID_IAccessible, | 42 hwnd, OBJID_WINDOW, IID_IAccessible, |
| 53 reinterpret_cast<void**>(&parent)); | 43 reinterpret_cast<void**>(&parent)); |
| 54 if (SUCCEEDED(hr)) | 44 if (SUCCEEDED(hr)) |
| 55 return parent; | 45 return parent; |
| 56 | 46 |
| 57 return NULL; | 47 return NULL; |
| 58 } | 48 } |
| 59 | 49 |
| 60 gfx::AcceleratedWidget | 50 gfx::AcceleratedWidget |
| 61 NativeViewAccessibilityWin::GetTargetForNativeAccessibilityEvent() { | 51 NativeViewAccessibilityWin::GetTargetForNativeAccessibilityEvent() { |
| 62 return HWNDForView(view_); | 52 return HWNDForView(view_); |
| 63 } | 53 } |
| 64 | 54 |
| 55 NativeViewAccessibilityWin::NativeViewAccessibilityWin(View* view) | |
|
tapted
2017/02/28 06:29:12
The two NativeViewAccessibilityWin methods should
Patti Lor
2017/02/28 22:24:24
Took the first option to match what they were orig
| |
| 56 : NativeViewAccessibility(view) {} | |
| 57 | |
| 58 NativeViewAccessibilityWin::~NativeViewAccessibilityWin() {} | |
| 59 | |
| 60 // static | |
| 61 std::unique_ptr<NativeViewAccessibility> NativeViewAccessibility::Create( | |
| 62 View* view) { | |
| 63 return base::MakeUnique<NativeViewAccessibilityWin>(view); | |
| 64 } | |
| 65 | |
| 65 } // namespace views | 66 } // namespace views |
| OLD | NEW |