cef/libcef/browser/chrome/views/chrome_browser_frame.cc
Marshall Greenblatt 8733cb89c7 chrome: Add Views API integration (see issue #2969)
The Chrome browser can now be hosted in a Views-based application on Windows
and Linux.

To launch a fully-featured Chrome window using cefsimple:
$ cefsimple --enable-chrome-runtime

To launch a minimally-styled Views-hosted window using cefsimple:
$ cefsimple --enable-chrome-runtime --use-views

To launch a fully-styled Views-hosted window using cefclient:
$ cefclient --enable-chrome-runtime --use-views

Views unit tests also now pass with the Chrome runtime enabled:
$ ceftests --gtest_filter=Views* --enable-chrome-runtime

Known issues:
- Popup browsers cannot be intercepted and reparented.
2021-02-21 15:25:10 -05:00

36 lines
1.1 KiB
C++

// 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/chrome/views/chrome_browser_frame.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
void ChromeBrowserFrame::Init(BrowserView* browser_view,
std::unique_ptr<Browser> browser) {
DCHECK(browser_view);
DCHECK(!browser_);
browser_ = browser.get();
DCHECK(browser_);
// Initialize BrowserFrame state.
InitBrowserView(browser_view);
// Initialize BrowserView state.
browser_view->InitBrowser(std::move(browser));
}
views::internal::RootView* ChromeBrowserFrame::CreateRootView() {
// Bypass the BrowserFrame implementation.
return views::Widget::CreateRootView();
}
std::unique_ptr<views::NonClientFrameView>
ChromeBrowserFrame::CreateNonClientFrameView() {
// Bypass the BrowserFrame implementation.
return views::Widget::CreateNonClientFrameView();
}