| 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 "ui/views/view.h" | 7 #include "ui/views/view.h" |
| 8 #include "ui/views/widget/widget.h" | 8 #include "ui/views/widget/widget.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 NativeViewAccessibilityMac::NativeViewAccessibilityMac(View* view) |
| 13 : NativeViewAccessibility(view) {} |
| 14 |
| 15 gfx::NativeViewAccessible |
| 16 NativeViewAccessibilityMac::GetNativeViewAccessibleForWidget() { |
| 17 if (view_->GetWidget()) |
| 18 return view_->GetWidget()->GetNativeView(); |
| 19 return NativeViewAccessibility::GetNativeViewAccessibleForWidget(); |
| 20 } |
| 21 |
| 12 // static | 22 // static |
| 13 NativeViewAccessibility* NativeViewAccessibility::Create(View* view) { | 23 NativeViewAccessibility* NativeViewAccessibility::Create(View* view) { |
| 14 return new NativeViewAccessibilityMac(view); | 24 return new NativeViewAccessibilityMac(view); |
| 15 } | 25 } |
| 16 | 26 |
| 17 NativeViewAccessibilityMac::NativeViewAccessibilityMac(View* view) | |
| 18 : NativeViewAccessibility(view) {} | |
| 19 | |
| 20 gfx::NativeViewAccessible NativeViewAccessibilityMac::GetParent() { | |
| 21 if (view_->parent()) | |
| 22 return view_->parent()->GetNativeViewAccessible(); | |
| 23 | |
| 24 if (view_->GetWidget()) | |
| 25 return view_->GetWidget()->GetNativeView(); | |
| 26 | |
| 27 if (parent_widget_) | |
| 28 return parent_widget_->GetRootView()->GetNativeViewAccessible(); | |
| 29 | |
| 30 return nullptr; | |
| 31 } | |
| 32 | |
| 33 } // namespace views | 27 } // namespace views |
| OLD | NEW |