Make castv2 performance test work.
[chromium-blink-merge.git] / ui / views / accessibility / native_view_accessibility_win.cc
blobfd9edaa3e29d29e339861af10155a8e664abd714
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
3 // found in the LICENSE file.
5 #include "ui/views/accessibility/native_view_accessibility_win.h"
7 #include <oleacc.h>
9 #include <set>
10 #include <vector>
12 #include "base/memory/singleton.h"
13 #include "base/strings/utf_string_conversions.h"
14 #include "base/win/scoped_comptr.h"
15 #include "base/win/windows_version.h"
16 #include "third_party/iaccessible2/ia2_api_all.h"
17 #include "ui/accessibility/ax_enums.h"
18 #include "ui/accessibility/ax_text_utils.h"
19 #include "ui/accessibility/ax_view_state.h"
20 #include "ui/base/win/accessibility_misc_utils.h"
21 #include "ui/base/win/atl_module.h"
22 #include "ui/views/controls/button/custom_button.h"
23 #include "ui/views/focus/focus_manager.h"
24 #include "ui/views/focus/view_storage.h"
25 #include "ui/views/widget/widget.h"
26 #include "ui/views/win/hwnd_util.h"
28 namespace views {
30 // static
31 NativeViewAccessibility* NativeViewAccessibility::Create(View* view) {
32 return new NativeViewAccessibilityWin(view);
35 NativeViewAccessibilityWin::NativeViewAccessibilityWin(View* view)
36 : NativeViewAccessibility(view) {
39 NativeViewAccessibilityWin::~NativeViewAccessibilityWin() {
42 gfx::NativeViewAccessible NativeViewAccessibilityWin::GetParent() {
43 IAccessible* parent = NativeViewAccessibility::GetParent();
44 if (parent)
45 return parent;
47 HWND hwnd = HWNDForView(view_);
48 if (!hwnd)
49 return NULL;
51 HRESULT hr = ::AccessibleObjectFromWindow(
52 hwnd, OBJID_WINDOW, IID_IAccessible,
53 reinterpret_cast<void**>(&parent));
54 if (SUCCEEDED(hr))
55 return parent;
57 return NULL;
60 gfx::AcceleratedWidget
61 NativeViewAccessibilityWin::GetTargetForNativeAccessibilityEvent() {
62 return HWNDForView(view_);
65 } // namespace views