mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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.
This commit is contained in:
@@ -93,6 +93,16 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
|
||||
#endif
|
||||
}
|
||||
|
||||
// Enable experimental Chrome runtime. See issue #2969 for details.
|
||||
use_chrome_runtime_ =
|
||||
command_line_->HasSwitch(switches::kEnableChromeRuntime);
|
||||
|
||||
if (use_windowless_rendering_ && use_chrome_runtime_) {
|
||||
LOG(ERROR)
|
||||
<< "Windowless rendering is not supported with the Chrome runtime.";
|
||||
use_chrome_runtime_ = false;
|
||||
}
|
||||
|
||||
#if defined(OS_WIN) || defined(OS_LINUX)
|
||||
// Whether the Views framework will be used.
|
||||
use_views_ = command_line_->HasSwitch(switches::kUseViews);
|
||||
@@ -103,6 +113,14 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
|
||||
use_views_ = false;
|
||||
}
|
||||
|
||||
if (use_chrome_runtime_ && !use_views_) {
|
||||
// TODO(chrome): Add support for this runtime configuration (e.g. a fully
|
||||
// styled Chrome window with cefclient menu customizations). In the mean
|
||||
// time this can be demo'd with "cefsimple --enable-chrome-runtime".
|
||||
LOG(WARNING) << "Chrome runtime requires the Views framework.";
|
||||
use_views_ = true;
|
||||
}
|
||||
|
||||
if (use_views_ && command_line->HasSwitch(switches::kHideFrame) &&
|
||||
!command_line_->HasSwitch(switches::kUrl)) {
|
||||
// Use the draggable regions test as the default URL for frameless windows.
|
||||
@@ -178,6 +196,9 @@ void MainContextImpl::PopulateSettings(CefSettings* settings) {
|
||||
command_line_->HasSwitch(switches::kExternalMessagePump);
|
||||
}
|
||||
|
||||
if (use_chrome_runtime_)
|
||||
settings->chrome_runtime = true;
|
||||
|
||||
CefString(&settings->cache_path) =
|
||||
command_line_->GetSwitchValue(switches::kCachePath);
|
||||
|
||||
|
Reference in New Issue
Block a user