cef/libcef/browser/views/view_util_mac.mm
Marshall Greenblatt 1d39ff720e Mac: Add Views API support (see issue #1749)
The Chrome browser can now be hosted in a Views-based application on Mac
(see issue #2969).

To launch a fully-featured Chrome window using cefsimple:
$ open cefsimple.app --args --enable-chrome-runtime

To launch a minimally-styled Views-hosted window using cefsimple:
$ open cefsimple.app --args --use-views [--enable-chrome-runtime]

To launch a fully-styled Views-hosted window using cefclient:
$ open cefclient.app --args --use-views [--enable-chrome-runtime]

Known issues:
- Some Views unit tests are currently failing on Mac.
2021-02-27 12:31:45 -05:00

33 lines
847 B
Plaintext

// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/view_util.h"
#include "include/internal/cef_types_mac.h"
#include "ui/views/widget/widget.h"
namespace view_util {
gfx::NativeWindow GetNativeWindow(views::Widget* widget) {
if (widget)
return widget->GetNativeWindow();
return gfx::NativeWindow();
}
gfx::NativeView GetNativeView(views::Widget* widget) {
if (widget)
return widget->GetNativeView();
return gfx::NativeView();
}
CefWindowHandle GetWindowHandle(views::Widget* widget) {
auto view = GetNativeView(widget);
if (view)
return CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(view.GetNativeNSView());
return kNullWindowHandle;
}
} // namespace view_util