mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add initial chrome runtime support (see issue #2969)
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
This commit is contained in:
48
patch/patches/chrome_runtime.patch
Normal file
48
patch/patches/chrome_runtime.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
|
||||
index c06585b15b8f..b5ed3518c0fd 100644
|
||||
--- chrome/browser/chrome_browser_main.cc
|
||||
+++ chrome/browser/chrome_browser_main.cc
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "build/branding_buildflags.h"
|
||||
#include "build/build_config.h"
|
||||
#include "cc/base/switches.h"
|
||||
+#include "cef/libcef/features/chrome_cef.h"
|
||||
#include "chrome/browser/about_flags.h"
|
||||
#include "chrome/browser/active_use_util.h"
|
||||
#include "chrome/browser/after_startup_task_utils.h"
|
||||
@@ -885,8 +886,10 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
|
||||
#if !defined(OS_ANDROID)
|
||||
// Create the RunLoop for MainMessageLoopRun() to use, and pass a copy of
|
||||
// its QuitClosure to the BrowserProcessImpl to call when it is time to exit.
|
||||
+ // CEF with the Chrome runtime will create and manage its own RunLoop.
|
||||
DCHECK(!g_run_loop);
|
||||
- g_run_loop = new base::RunLoop;
|
||||
+ if (!cef::IsChromeRuntimeEnabled())
|
||||
+ g_run_loop = new base::RunLoop;
|
||||
|
||||
// These members must be initialized before returning from this function.
|
||||
// Android doesn't use StartupBrowserCreator.
|
||||
@@ -1613,7 +1616,9 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
// Transfer ownership of the browser's lifetime to the BrowserProcess.
|
||||
- browser_process_->SetQuitClosure(g_run_loop->QuitWhenIdleClosure());
|
||||
+ // CEF with the Chrome runtime will create and manage its own RunLoop.
|
||||
+ if (g_run_loop)
|
||||
+ browser_process_->SetQuitClosure(g_run_loop->QuitWhenIdleClosure());
|
||||
DCHECK(!run_message_loop_);
|
||||
run_message_loop_ = true;
|
||||
}
|
||||
diff --git ui/gtk/select_file_dialog_impl_kde.cc ui/gtk/select_file_dialog_impl_kde.cc
|
||||
index f09501d6cd8e..edfc2a4c9bb5 100644
|
||||
--- ui/gtk/select_file_dialog_impl_kde.cc
|
||||
+++ ui/gtk/select_file_dialog_impl_kde.cc
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <stddef.h>
|
||||
|
||||
+#undef Success
|
||||
+
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
14
patch/patches/linux_chrome_page_info_1099927.patch
Normal file
14
patch/patches/linux_chrome_page_info_1099927.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff --git chrome/browser/ui/page_info/chrome_page_info_client.cc chrome/browser/ui/page_info/chrome_page_info_client.cc
|
||||
index e2972da9e548..2f356616ed97 100644
|
||||
--- chrome/browser/ui/page_info/chrome_page_info_client.cc
|
||||
+++ chrome/browser/ui/page_info/chrome_page_info_client.cc
|
||||
@@ -17,5 +17,9 @@ std::unique_ptr<PageInfoDelegate> ChromePageInfoClient::CreatePageInfoDelegate(
|
||||
}
|
||||
|
||||
int ChromePageInfoClient::GetJavaResourceId(int native_resource_id) {
|
||||
+#if defined(OS_ANDROID)
|
||||
return ResourceMapper::MapToJavaDrawableId(native_resource_id);
|
||||
+#else
|
||||
+ return 0;
|
||||
+#endif
|
||||
}
|
@@ -1,16 +1,16 @@
|
||||
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
|
||||
index 75a5ee192358..bc97cbf684c0 100644
|
||||
index 75a5ee192358..379e0bdd11b1 100644
|
||||
--- chrome/browser/net/profile_network_context_service.cc
|
||||
+++ chrome/browser/net/profile_network_context_service.cc
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
+#include "cef/libcef/features/chrome_cef.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
@@ -661,9 +662,22 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
@@ -661,9 +662,23 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
network_context_params->cookie_manager_params =
|
||||
CreateCookieManagerParams(profile_, *cookie_settings_);
|
||||
|
||||
@@ -18,8 +18,8 @@ index 75a5ee192358..bc97cbf684c0 100644
|
||||
+
|
||||
// Configure on-disk storage for non-OTR profiles. OTR profiles just use
|
||||
// default behavior (in memory storage, default sizes).
|
||||
if (!in_memory) {
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
- if (!in_memory) {
|
||||
+ if (!in_memory && cef::IsCefRuntimeEnabled()) {
|
||||
+ PrefService* prefs = profile_->GetPrefs();
|
||||
+ // Configure the HTTP cache path and size.
|
||||
+ const base::FilePath& base_cache_path =
|
||||
@@ -29,18 +29,22 @@ index 75a5ee192358..bc97cbf684c0 100644
|
||||
+ base_cache_path.Append(chrome::kCacheDirname);
|
||||
+ network_context_params->http_cache_max_size =
|
||||
+ prefs->GetInteger(prefs::kDiskCacheSize);
|
||||
+#else
|
||||
+ }
|
||||
+
|
||||
+ if (!in_memory && !cef::IsCefRuntimeEnabled()) {
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
// Configure the HTTP cache path and size.
|
||||
base::FilePath base_cache_path;
|
||||
@@ -676,6 +690,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
@@ -676,7 +691,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
|
||||
base_cache_path.Append(chrome::kCacheDirname);
|
||||
network_context_params->http_cache_max_size =
|
||||
local_state->GetInteger(prefs::kDiskCacheSize);
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
+ if (!in_memory) {
|
||||
// Currently this just contains HttpServerProperties, but that will likely
|
||||
// change.
|
||||
network_context_params->http_server_properties_path =
|
||||
diff --git chrome/browser/profiles/profile.h chrome/browser/profiles/profile.h
|
||||
index a48ead96b3f7..967a5975c330 100644
|
||||
--- chrome/browser/profiles/profile.h
|
||||
|
Reference in New Issue
Block a user