Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: ui/views/accessibility/native_view_accessibility.cc

Issue 420653003: MacViews: Accessibility bridge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge accessibility_platform target to accessibility Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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.h" 5 #include "ui/views/accessibility/native_view_accessibility.h"
6 6
7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/views/view.h"
9 #include "ui/views/widget/widget.h"
10
7 namespace views { 11 namespace views {
8 12
9 #if !defined(OS_WIN) 13 #if !defined(OS_WIN)
10 // static 14 // static
11 NativeViewAccessibility* NativeViewAccessibility::Create(View* view) { 15 NativeViewAccessibility* NativeViewAccessibility::Create(View* view) {
12 return NULL; 16 DCHECK(view);
17 NativeViewAccessibility* instance = new NativeViewAccessibility();
18 instance->set_view(view);
19 return instance;
13 } 20 }
14 #endif 21 #endif
15 22
16 NativeViewAccessibility::NativeViewAccessibility() { 23 NativeViewAccessibility::NativeViewAccessibility()
24 : view_(NULL), ax_node_(ui::AXPlatformNode::Create(this)) {
17 } 25 }
18 26
19 NativeViewAccessibility::~NativeViewAccessibility() { 27 NativeViewAccessibility::~NativeViewAccessibility() {
28 if (ax_node_)
29 ax_node_->Destroy();
20 } 30 }
21 31
22 gfx::NativeViewAccessible NativeViewAccessibility::GetNativeObject() { 32 gfx::NativeViewAccessible NativeViewAccessibility::GetNativeObject() {
23 return NULL; 33 return ax_node_ ? ax_node_->GetNativeViewAccessible() : NULL;
24 } 34 }
25 35
26 void NativeViewAccessibility::Destroy() { 36 void NativeViewAccessibility::Destroy() {
27 delete this; 37 delete this;
28 } 38 }
29 39
30 #if !defined(OS_WIN) 40 #if !defined(OS_WIN)
31 // static 41 // static
32 void NativeViewAccessibility::RegisterWebView(View* web_view) { 42 void NativeViewAccessibility::RegisterWebView(View* web_view) {
33 } 43 }
34 44
35 // static 45 // static
36 void NativeViewAccessibility::UnregisterWebView(View* web_view) { 46 void NativeViewAccessibility::UnregisterWebView(View* web_view) {
37 } 47 }
38 #endif 48 #endif
39 49
50 // ui::AXPlatformNodeDelegate
51
52 ui::AXNodeData* NativeViewAccessibility::GetData() {
53 ui::AXViewState state;
54 view_->GetAccessibleState(&state);
55 data_.role = state.role;
56 data_.location = view_->GetBoundsInScreen();
57 return &data_;
58 }
59
60 int NativeViewAccessibility::GetChildCount() {
61 return view_->child_count();
62 }
63
64 gfx::NativeViewAccessible NativeViewAccessibility::ChildAtIndex(int index) {
65 if (index < 0 || index >= view_->child_count())
66 return NULL;
67 return view_->child_at(index)->GetNativeViewAccessible();
68 }
69
70 gfx::NativeViewAccessible NativeViewAccessibility::GetParent() {
71 if (view_->parent())
72 return view_->parent()->GetNativeViewAccessible();
73
74 #if defined(OS_MACOSX)
75 if (view_->GetWidget())
76 return view_->GetWidget()->GetNativeView();
77 #endif
78
79 return NULL;
80 }
81
82 gfx::Vector2d NativeViewAccessibility::GetGlobalCoordinateOffset() {
83 return gfx::Vector2d(0, 0); // location is already in screen coordinates.
84 }
85
86 void NativeViewAccessibility::NotifyAccessibilityEvent(ui::AXEvent event_type) {
87 }
88
40 } // namespace views 89 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/native_view_accessibility.h ('k') | ui/views/accessibility/native_view_accessibility_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698