OLD | NEW |
---|---|
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> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 | 14 |
15 // static | 15 // static |
16 std::unique_ptr<NativeViewAccessibility> NativeViewAccessibility::Create( | 16 std::unique_ptr<NativeViewAccessibility> NativeViewAccessibility::Create( |
17 View* view) { | 17 View* view) { |
18 return base::MakeUnique<NativeViewAccessibilityMac>(view); | 18 return base::MakeUnique<NativeViewAccessibilityMac>(view); |
19 } | 19 } |
20 | 20 |
21 NativeViewAccessibilityMac::NativeViewAccessibilityMac(View* view) | 21 NativeViewAccessibilityMac::NativeViewAccessibilityMac(View* view) |
22 : NativeViewAccessibilityBase(view) {} | 22 : NativeViewAccessibilityBase(view) {} |
23 | 23 |
24 gfx::NativeViewAccessible NativeViewAccessibilityMac::GetParent() { | 24 gfx::NativeViewAccessible |
25 if (view_->parent()) | 25 NativeViewAccessibilityMac::GetNativeViewAccessibleForWidget() { |
26 return view_->parent()->GetNativeViewAccessible(); | |
27 | |
28 if (view_->GetWidget()) | 26 if (view_->GetWidget()) |
tapted
2017/04/03 05:50:36
comment here why |parent_widget_| doesn't work for
Patti Lor
2017/04/04 02:46:29
I'm not sure why we are preferring to use the Nati
tapted
2017/04/04 08:13:13
I think |parent_widget_| came about because in aur
Patti Lor
2017/04/11 05:40:45
O, ok. I think that's still OK though right? If we
| |
29 return view_->GetWidget()->GetNativeView(); | 27 return view_->GetWidget()->GetNativeView(); |
30 | 28 return NativeViewAccessibilityBase::GetNativeViewAccessibleForWidget(); |
31 if (parent_widget_) | |
32 return parent_widget_->GetRootView()->GetNativeViewAccessible(); | |
33 | |
34 return nullptr; | |
35 } | 29 } |
36 | 30 |
37 } // namespace views | 31 } // namespace views |
OLD | NEW |