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

Side by Side Diff: ui/views/accessibility/native_view_accessibility_mac.mm

Issue 2715543003: Views a11y: Implement AXPlatformNode::FromNativeViewAccessible on all platforms. (Closed)
Patch Set: Fix bad rebase. Created 3 years, 9 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_mac.h" 5 #include "ui/views/accessibility/native_view_accessibility_mac.h"
6 6
7 #include <memory>
8
9 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
10 #include "ui/views/view.h" 8 #include "ui/views/view.h"
11 #include "ui/views/widget/widget.h" 9 #include "ui/views/widget/widget.h"
12 10
13 namespace views { 11 namespace views {
14 12
15 // static 13 // static
16 std::unique_ptr<NativeViewAccessibility> NativeViewAccessibility::Create( 14 std::unique_ptr<NativeViewAccessibility> NativeViewAccessibility::Create(
17 View* view) { 15 View* view) {
18 return base::MakeUnique<NativeViewAccessibilityMac>(view); 16 return base::MakeUnique<NativeViewAccessibilityMac>(view);
19 } 17 }
20 18
21 NativeViewAccessibilityMac::NativeViewAccessibilityMac(View* view) 19 NativeViewAccessibilityMac::NativeViewAccessibilityMac(View* view)
22 : NativeViewAccessibility(view) {} 20 : NativeViewAccessibility(view) {}
23 21
24 gfx::NativeViewAccessible NativeViewAccessibilityMac::GetParent() { 22 gfx::NativeViewAccessible NativeViewAccessibilityMac::GetParent() {
25 if (view_->parent()) 23 if (view_->parent())
26 return view_->parent()->GetNativeViewAccessible(); 24 return view_->parent()->GetNativeViewAccessible();
27 25
28 if (view_->GetWidget()) 26 if (view_->GetWidget())
29 return view_->GetWidget()->GetNativeView(); 27 return view_->GetWidget()->GetNativeView();
30 28
31 if (parent_widget_) 29 if (parent_widget_)
32 return parent_widget_->GetRootView()->GetNativeViewAccessible(); 30 return parent_widget_->GetRootView()->GetNativeViewAccessible();
33 31
34 return nullptr; 32 return nullptr;
35 } 33 }
36 34
37 } // namespace views 35 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698