mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-21 06:22:25 +01:00
1174994211
Running `cefsimple --enable-chrome-runtime` will create and run a Chrome browser window using the CEF app methods, and call CefApp::OnContextInitialized as expected. CEF task methods also work as expected in the main process. No browser-related methods or callbacks are currently supported for the Chrome window, and the application will exit when the last Chrome window closes. The Chrome runtime requires resources.pak, chrome_100_percent.pak and chrome_200_percent.pak files which were not previously built with CEF. It shares the existing locales pak files which have been updated to include additional Chrome-specific strings. On Linux, the Chrome runtime requires GTK so use_gtk=true must be specified via GN_DEFINES when building. This change also refactors the CEF runtime, which can be tested in the various supported modes by running: $ cefclient $ cefclient --multi-threaded-message-loop $ cefclient --external-message-pump
54 lines
2.0 KiB
C++
54 lines
2.0 KiB
C++
// Copyright 2020 The Chromium Embedded Framework Authors.
|
|
// Portions copyright 2012 The Chromium 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/chrome_content_browser_client_cef.h"
|
|
|
|
#include "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h"
|
|
#include "libcef/common/cef_switches.h"
|
|
|
|
#include "base/command_line.h"
|
|
#include "chrome/browser/chrome_browser_main.h"
|
|
|
|
ChromeContentBrowserClientCef::ChromeContentBrowserClientCef(
|
|
StartupData* startup_data)
|
|
: ChromeContentBrowserClient(startup_data) {}
|
|
ChromeContentBrowserClientCef::~ChromeContentBrowserClientCef() = default;
|
|
|
|
std::unique_ptr<content::BrowserMainParts>
|
|
ChromeContentBrowserClientCef::CreateBrowserMainParts(
|
|
const content::MainFunctionParams& parameters) {
|
|
auto main_parts =
|
|
ChromeContentBrowserClient::CreateBrowserMainParts(parameters);
|
|
browser_main_parts_ = new ChromeBrowserMainExtraPartsCef;
|
|
static_cast<ChromeBrowserMainParts*>(main_parts.get())
|
|
->AddParts(browser_main_parts_);
|
|
return main_parts;
|
|
}
|
|
|
|
void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
|
|
base::CommandLine* command_line,
|
|
int child_process_id) {
|
|
ChromeContentBrowserClient::AppendExtraCommandLineSwitches(command_line,
|
|
child_process_id);
|
|
|
|
// Necessary to launch sub-processes in the correct mode.
|
|
command_line->AppendSwitch(switches::kEnableChromeRuntime);
|
|
}
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner>
|
|
ChromeContentBrowserClientCef::background_task_runner() const {
|
|
return browser_main_parts_->background_task_runner();
|
|
}
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner>
|
|
ChromeContentBrowserClientCef::user_visible_task_runner() const {
|
|
return browser_main_parts_->user_visible_task_runner();
|
|
}
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner>
|
|
ChromeContentBrowserClientCef::user_blocking_task_runner() const {
|
|
return browser_main_parts_->user_blocking_task_runner();
|
|
}
|