1// Copyright 2019 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. 4 5#include "ui/views/accessibility/ax_virtual_view.h" 6 7#include "ui/views/cocoa/native_widget_mac_ns_window_host.h" 8#include "ui/views/widget/widget.h" 9 10namespace views { 11 12gfx::NativeViewAccessible AXVirtualView::GetNSWindow() { 13 View* owner = GetOwnerView(); 14 if (!owner) 15 return nil; 16 17 Widget* widget = owner->GetWidget(); 18 if (!widget) 19 return nil; 20 21 auto* window_host = NativeWidgetMacNSWindowHost::GetFromNativeWindow( 22 widget->GetNativeWindow()); 23 if (!window_host) 24 return nil; 25 26 return window_host->GetNativeViewAccessibleForNSWindow(); 27} 28 29} // namespace views 30