Compare commits

...

2 Commits

Author SHA1 Message Date
Marshall Greenblatt 00118ddcdb cefsimple: Enable Chrome runtime by default (see #3685)
Run with `--disable-chrome-runtime` to use the Alloy runtime.
2024-05-09 12:53:43 -04:00
Marshall Greenblatt e7626b2df6 cefclient: Enable Chrome runtime by default (see #3685)
Run with `--disable-chrome-runtime` to use the Alloy runtime.
2024-05-09 12:49:06 -04:00
8 changed files with 40 additions and 27 deletions

View File

@ -69,6 +69,7 @@ class ClientBrowserDelegate : public ClientAppBrowser::Delegate {
// Add logging for some common switches that the user may attempt to use. // Add logging for some common switches that the user may attempt to use.
static const char* kIgnoredSwitches[] = { static const char* kIgnoredSwitches[] = {
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
switches::kDisableChromeRuntime,
switches::kEnableChromeRuntime, switches::kEnableChromeRuntime,
#endif #endif
switches::kMultiThreadedMessageLoop, switches::kMultiThreadedMessageLoop,

View File

@ -79,7 +79,7 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
// Enable Chrome runtime bootstrap. See issue #2969 for details. // Enable Chrome runtime bootstrap. See issue #2969 for details.
use_chrome_bootstrap_ = use_chrome_bootstrap_ =
command_line_->HasSwitch(switches::kEnableChromeRuntime); !command_line_->HasSwitch(switches::kDisableChromeRuntime);
#endif #endif
// Whether the Views framework will be used. // Whether the Views framework will be used.

View File

@ -59,13 +59,11 @@ int main(int argc, char* argv[]) {
CefSettings settings; CefSettings settings;
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
// Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via // Use the CEF Chrome bootstrap unless "--disable-chrome-runtime" is specified
// the command-line. Otherwise, use the CEF Alloy runtime. For more // via the command-line. Otherwise, use the CEF Alloy bootstrap. The Alloy
// information about CEF runtimes see // bootstrap is deprecated and will be removed in ~M127. See
// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3 // https://github.com/chromiumembedded/cef/issues/3685
if (command_line->HasSwitch("enable-chrome-runtime")) { settings.chrome_runtime = !command_line->HasSwitch("disable-chrome-runtime");
settings.chrome_runtime = true;
}
#endif #endif
// When generating projects with CMake the CEF_USE_SANDBOX value will be defined // When generating projects with CMake the CEF_USE_SANDBOX value will be defined

View File

@ -151,13 +151,12 @@ int main(int argc, char* argv[]) {
CefSettings settings; CefSettings settings;
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
// Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via // Use the CEF Chrome bootstrap unless "--disable-chrome-runtime" is
// the command-line. Otherwise, use the CEF Alloy runtime. For more // specified via the command-line. Otherwise, use the CEF Alloy bootstrap.
// information about CEF runtimes see // The Alloy bootstrap is deprecated and will be removed in ~M127. See
// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3 // https://github.com/chromiumembedded/cef/issues/3685
if (command_line->HasSwitch("enable-chrome-runtime")) { settings.chrome_runtime =
settings.chrome_runtime = true; !command_line->HasSwitch("disable-chrome-runtime");
}
#endif #endif
// When generating projects with CMake the CEF_USE_SANDBOX value will be // When generating projects with CMake the CEF_USE_SANDBOX value will be

View File

@ -75,13 +75,11 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
CefSettings settings; CefSettings settings;
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
// Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via // Use the CEF Chrome bootstrap unless "--disable-chrome-runtime" is specified
// the command-line. Otherwise, use the CEF Alloy runtime. For more // via the command-line. Otherwise, use the CEF Alloy bootstrap. The Alloy
// information about CEF runtimes see // bootstrap is deprecated and will be removed in ~M127. See
// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3 // https://github.com/chromiumembedded/cef/issues/3685
if (command_line->HasSwitch("enable-chrome-runtime")) { settings.chrome_runtime = !command_line->HasSwitch("disable-chrome-runtime");
settings.chrome_runtime = true;
}
#endif #endif
#if !defined(CEF_USE_SANDBOX) #if !defined(CEF_USE_SANDBOX)

View File

@ -113,12 +113,17 @@ void SimpleApp::OnContextInitialized() {
CefRefPtr<CefCommandLine> command_line = CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine(); CefCommandLine::GetGlobalCommandLine();
#if !defined(DISABLE_ALLOY_BOOTSTRAP)
const bool enable_chrome_runtime =
!command_line->HasSwitch("disable-chrome-runtime");
#endif
// Check if Alloy style will be used. Alloy style is always used with the // Check if Alloy style will be used. Alloy style is always used with the
// Alloy runtime bootstrap and optional with the Chrome runtime bootstrap. // Alloy runtime bootstrap and optional with the Chrome runtime bootstrap.
bool use_alloy_style = true; bool use_alloy_style = true;
cef_runtime_style_t runtime_style = CEF_RUNTIME_STYLE_DEFAULT; cef_runtime_style_t runtime_style = CEF_RUNTIME_STYLE_DEFAULT;
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
if (command_line->HasSwitch("enable-chrome-runtime")) if (enable_chrome_runtime)
#endif #endif
{ {
use_alloy_style = command_line->HasSwitch("use-alloy-style"); use_alloy_style = command_line->HasSwitch("use-alloy-style");
@ -142,10 +147,20 @@ void SimpleApp::OnContextInitialized() {
url = "http://www.google.com"; url = "http://www.google.com";
} }
// Create the browser using the Views framework if "--use-views" is specified // Views is enabled by default with the Chrome bootstrap (add `--use-native`
// via the command-line. Otherwise, create the browser using the native // to disable). Views is disabled by default with the Alloy bootstrap (add
// platform framework. // `--use-views` to enable).
if (command_line->HasSwitch("use-views")) { #if !defined(DISABLE_ALLOY_BOOTSTRAP)
const bool use_views =
(enable_chrome_runtime && !command_line->HasSwitch("use-native")) ||
(!enable_chrome_runtime && command_line->HasSwitch("use-views"));
#else
const bool use_views = !command_line->HasSwitch("use-native");
#endif
// If using Views create the browser using the Views framework, otherwise
// create the browser using the native platform framework.
if (use_views) {
// Create the BrowserView. // Create the BrowserView.
CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView( CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView(
handler, url, browser_settings, nullptr, nullptr, handler, url, browser_settings, nullptr, nullptr,

View File

@ -45,6 +45,7 @@ const char kSslClientCertificate[] = "ssl-client-certificate";
const char kCRLSetsPath[] = "crl-sets-path"; const char kCRLSetsPath[] = "crl-sets-path";
const char kNoActivate[] = "no-activate"; const char kNoActivate[] = "no-activate";
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
const char kDisableChromeRuntime[] = "disable-chrome-runtime";
const char kEnableChromeRuntime[] = "enable-chrome-runtime"; const char kEnableChromeRuntime[] = "enable-chrome-runtime";
#endif #endif
const char kShowChromeToolbar[] = "show-chrome-toolbar"; const char kShowChromeToolbar[] = "show-chrome-toolbar";

View File

@ -39,6 +39,7 @@ extern const char kSslClientCertificate[];
extern const char kCRLSetsPath[]; extern const char kCRLSetsPath[];
extern const char kNoActivate[]; extern const char kNoActivate[];
#if !defined(DISABLE_ALLOY_BOOTSTRAP) #if !defined(DISABLE_ALLOY_BOOTSTRAP)
extern const char kDisableChromeRuntime[];
extern const char kEnableChromeRuntime[]; extern const char kEnableChromeRuntime[];
#endif #endif
extern const char kShowChromeToolbar[]; extern const char kShowChromeToolbar[];