1// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be found 3// in the LICENSE file. 4 5#include "libcef/browser/views/view_util.h" 6 7#include "include/internal/cef_types_mac.h" 8 9#include "ui/views/widget/widget.h" 10 11namespace view_util { 12 13gfx::NativeWindow GetNativeWindow(views::Widget* widget) { 14 if (widget) 15 return widget->GetNativeWindow(); 16 return gfx::NativeWindow(); 17} 18 19gfx::NativeView GetNativeView(views::Widget* widget) { 20 if (widget) 21 return widget->GetNativeView(); 22 return gfx::NativeView(); 23} 24 25CefWindowHandle GetWindowHandle(views::Widget* widget) { 26 auto view = GetNativeView(widget); 27 if (view) 28 return CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(view.GetNativeNSView()); 29 return kNullWindowHandle; 30} 31 32} // namespace view_util 33