mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix patched chrome build with enable_cef=false
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
diff --git chrome/browser/extensions/api/chrome_extensions_api_client.cc chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
diff --git chrome/browser/extensions/api/chrome_extensions_api_client.cc chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||||
index 19a81f51a14c1..d23f6db838d41 100644
|
index 19a81f51a14c1..41dbb40ff4586 100644
|
||||||
--- chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
--- chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||||
+++ chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
+++ chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||||
@@ -13,6 +13,7 @@
|
@@ -13,6 +13,7 @@
|
||||||
@ -21,13 +21,15 @@ index 19a81f51a14c1..d23f6db838d41 100644
|
|||||||
#if BUILDFLAG(ENABLE_PDF)
|
#if BUILDFLAG(ENABLE_PDF)
|
||||||
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
|
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
|
||||||
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
||||||
@@ -305,6 +310,9 @@ ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate(
|
@@ -305,6 +310,11 @@ ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate(
|
||||||
std::unique_ptr<MimeHandlerViewGuestDelegate>
|
std::unique_ptr<MimeHandlerViewGuestDelegate>
|
||||||
ChromeExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
ChromeExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
||||||
MimeHandlerViewGuest* guest) const {
|
MimeHandlerViewGuest* guest) const {
|
||||||
|
+#if BUILDFLAG(ENABLE_CEF)
|
||||||
+ if (cef::IsChromeRuntimeEnabled()) {
|
+ if (cef::IsChromeRuntimeEnabled()) {
|
||||||
+ return std::make_unique<ChromeMimeHandlerViewGuestDelegateCef>(guest);
|
+ return std::make_unique<ChromeMimeHandlerViewGuestDelegateCef>(guest);
|
||||||
+ }
|
+ }
|
||||||
|
+#endif
|
||||||
return std::make_unique<ChromeMimeHandlerViewGuestDelegate>();
|
return std::make_unique<ChromeMimeHandlerViewGuestDelegate>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ index de1b45f921123..077894e4a42c9 100644
|
|||||||
// content::ContentMainDelegate:
|
// content::ContentMainDelegate:
|
||||||
absl::optional<int> BasicStartupComplete() override;
|
absl::optional<int> BasicStartupComplete() override;
|
||||||
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
|
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
|
||||||
index a9f1fa7ac0c5a..c4c42fab178ba 100644
|
index a9f1fa7ac0c5a..2e7bf32d504d9 100644
|
||||||
--- chrome/browser/chrome_browser_main.cc
|
--- chrome/browser/chrome_browser_main.cc
|
||||||
+++ chrome/browser/chrome_browser_main.cc
|
+++ chrome/browser/chrome_browser_main.cc
|
||||||
@@ -52,6 +52,7 @@
|
@@ -52,6 +52,7 @@
|
||||||
@ -113,6 +113,24 @@ index a9f1fa7ac0c5a..c4c42fab178ba 100644
|
|||||||
#include "chrome/browser/about_flags.h"
|
#include "chrome/browser/about_flags.h"
|
||||||
#include "chrome/browser/active_use_util.h"
|
#include "chrome/browser/active_use_util.h"
|
||||||
#include "chrome/browser/after_startup_task_utils.h"
|
#include "chrome/browser/after_startup_task_utils.h"
|
||||||
|
@@ -1451,7 +1452,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||||
|
}
|
||||||
|
#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
|
|
||||||
|
-#if BUILDFLAG(ENABLE_PROCESS_SINGLETON)
|
||||||
|
+#if BUILDFLAG(ENABLE_PROCESS_SINGLETON) && !BUILDFLAG(ENABLE_CEF)
|
||||||
|
// Handle special early return paths (which couldn't be processed even earlier
|
||||||
|
// as they require the process singleton to be held) first.
|
||||||
|
|
||||||
|
@@ -1498,7 +1499,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||||
|
return content::RESULT_CODE_NORMAL_EXIT;
|
||||||
|
#endif // BUILDFLAG(IS_WIN)
|
||||||
|
}
|
||||||
|
-#endif // BUILDFLAG(ENABLE_PROCESS_SINGLETON)
|
||||||
|
+#endif // BUILDFLAG(ENABLE_PROCESS_SINGLETON) && !BUILDFLAG(ENABLE_CEF)
|
||||||
|
|
||||||
|
#if BUILDFLAG(IS_WIN)
|
||||||
|
// Check if there is any machine level Chrome installed on the current
|
||||||
@@ -1551,12 +1552,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
@@ -1551,12 +1552,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||||
browser_process_->local_state());
|
browser_process_->local_state());
|
||||||
}
|
}
|
||||||
@ -128,37 +146,26 @@ index a9f1fa7ac0c5a..c4c42fab178ba 100644
|
|||||||
|
|
||||||
#if BUILDFLAG(IS_ANDROID)
|
#if BUILDFLAG(IS_ANDROID)
|
||||||
page_info::SetPageInfoClient(new ChromePageInfoClient());
|
page_info::SetPageInfoClient(new ChromePageInfoClient());
|
||||||
@@ -1708,14 +1711,17 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
@@ -1705,6 +1708,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||||
|
}
|
||||||
|
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
|
|
||||||
|
+ // Bypass StartupBrowserCreator and RunLoop creation with CEF.
|
||||||
|
+ // CEF with the Chrome runtime will create and manage its own RunLoop.
|
||||||
|
+#if !BUILDFLAG(ENABLE_CEF)
|
||||||
|
+
|
||||||
// This step is costly and is already measured in
|
// This step is costly and is already measured in
|
||||||
// Startup.StartupBrowserCreator_Start.
|
// Startup.StartupBrowserCreator_Start.
|
||||||
// See the comment above for an explanation of |process_command_line|.
|
// See the comment above for an explanation of |process_command_line|.
|
||||||
+ // Bypass StartupBrowserCreator with CEF where |GetMainRunLoopInstance()| is
|
@@ -1748,6 +1755,8 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||||
+ // nullptr.
|
|
||||||
const bool started =
|
|
||||||
+ !GetMainRunLoopInstance() ||
|
|
||||||
#if BUILDFLAG(ENABLE_PROCESS_SINGLETON)
|
|
||||||
!process_command_line ||
|
|
||||||
#endif // BUILDFLAG(ENABLE_PROCESS_SINGLETON)
|
|
||||||
browser_creator_->Start(*base::CommandLine::ForCurrentProcess(),
|
|
||||||
base::FilePath(), profile_info,
|
|
||||||
last_opened_profiles);
|
|
||||||
- if (started) {
|
|
||||||
+ if (started && GetMainRunLoopInstance()) {
|
|
||||||
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
|
|
||||||
// of lacros-chrome is complete.
|
|
||||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
|
|
||||||
@@ -1743,8 +1749,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
|
||||||
|
|
||||||
// Create the RunLoop for MainMessageLoopRun() to use and transfer
|
|
||||||
// ownership of the browser's lifetime to the BrowserProcess.
|
|
||||||
+ // CEF with the Chrome runtime will create and manage its own RunLoop.
|
|
||||||
DCHECK(!GetMainRunLoopInstance());
|
|
||||||
- GetMainRunLoopInstance() = std::make_unique<base::RunLoop>();
|
|
||||||
+ if (!cef::IsChromeRuntimeEnabled())
|
|
||||||
+ GetMainRunLoopInstance() = std::make_unique<base::RunLoop>();
|
|
||||||
browser_process_->SetQuitClosure(
|
browser_process_->SetQuitClosure(
|
||||||
GetMainRunLoopInstance()->QuitWhenIdleClosure());
|
GetMainRunLoopInstance()->QuitWhenIdleClosure());
|
||||||
}
|
}
|
||||||
|
+#endif // !BUILDFLAG(ENABLE_CEF)
|
||||||
|
+
|
||||||
|
browser_creator_.reset();
|
||||||
|
#endif // !BUILDFLAG(IS_ANDROID)
|
||||||
|
|
||||||
diff --git chrome/browser/chrome_browser_main_mac.mm chrome/browser/chrome_browser_main_mac.mm
|
diff --git chrome/browser/chrome_browser_main_mac.mm chrome/browser/chrome_browser_main_mac.mm
|
||||||
index d12abb3451882..b14d4406c2a76 100644
|
index d12abb3451882..b14d4406c2a76 100644
|
||||||
--- chrome/browser/chrome_browser_main_mac.mm
|
--- chrome/browser/chrome_browser_main_mac.mm
|
||||||
|
@ -379,7 +379,7 @@ index 79911e5461e2e..d70b8a3b84f84 100644
|
|||||||
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
||||||
// interface to keep these two classes decoupled and testable.
|
// interface to keep these two classes decoupled and testable.
|
||||||
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
|
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||||
index c923ca16d06a5..eb75ad1111ae3 100644
|
index c923ca16d06a5..949db1a44b9a5 100644
|
||||||
--- chrome/browser/ui/views/frame/browser_view_layout.cc
|
--- chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||||
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
|
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||||
@@ -45,6 +45,10 @@
|
@@ -45,6 +45,10 @@
|
||||||
@ -393,15 +393,17 @@ index c923ca16d06a5..eb75ad1111ae3 100644
|
|||||||
using views::View;
|
using views::View;
|
||||||
using web_modal::WebContentsModalDialogHost;
|
using web_modal::WebContentsModalDialogHost;
|
||||||
using web_modal::ModalDialogHostObserver;
|
using web_modal::ModalDialogHostObserver;
|
||||||
@@ -474,6 +478,11 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
@@ -474,6 +478,13 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
||||||
|
|
||||||
int BrowserViewLayout::LayoutToolbar(int top) {
|
int BrowserViewLayout::LayoutToolbar(int top) {
|
||||||
TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar");
|
TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar");
|
||||||
|
+#if BUILDFLAG(ENABLE_CEF)
|
||||||
+ if (cef::IsCefView(toolbar_)) {
|
+ if (cef::IsCefView(toolbar_)) {
|
||||||
+ // CEF may take ownership of the toolbar. Early exit to avoid the DCHECK
|
+ // CEF may take ownership of the toolbar. Early exit to avoid the DCHECK
|
||||||
+ // in LayoutManager::SetViewVisibility().
|
+ // in LayoutManager::SetViewVisibility().
|
||||||
+ return top;
|
+ return top;
|
||||||
+ }
|
+ }
|
||||||
|
+#endif
|
||||||
int browser_view_width = vertical_layout_rect_.width();
|
int browser_view_width = vertical_layout_rect_.width();
|
||||||
bool toolbar_visible = delegate_->IsToolbarVisible();
|
bool toolbar_visible = delegate_->IsToolbarVisible();
|
||||||
int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
|
int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
|
||||||
|
@ -178,3 +178,37 @@ index 76ca0135501ae..e81ac506214d8 100644
|
|||||||
// Tells this platform that the renderer is locked to a site (i.e., a scheme
|
// Tells this platform that the renderer is locked to a site (i.e., a scheme
|
||||||
// plus eTLD+1, such as https://google.com), or to a more specific origin.
|
// plus eTLD+1, such as https://google.com), or to a more specific origin.
|
||||||
void SetIsLockedToSite();
|
void SetIsLockedToSite();
|
||||||
|
diff --git headless/lib/browser/headless_content_browser_client.cc headless/lib/browser/headless_content_browser_client.cc
|
||||||
|
index 5cae59116d39d..2c6fb3e830fcd 100644
|
||||||
|
--- headless/lib/browser/headless_content_browser_client.cc
|
||||||
|
+++ headless/lib/browser/headless_content_browser_client.cc
|
||||||
|
@@ -312,7 +312,7 @@ bool HeadlessContentBrowserClient::ShouldEnableStrictSiteIsolation() {
|
||||||
|
return browser_->options()->site_per_process;
|
||||||
|
}
|
||||||
|
|
||||||
|
-void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
||||||
|
+bool HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
||||||
|
content::BrowserContext* context,
|
||||||
|
bool in_memory,
|
||||||
|
const base::FilePath& relative_partition_path,
|
||||||
|
@@ -322,6 +322,7 @@ void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
||||||
|
HeadlessBrowserContextImpl::From(context)->ConfigureNetworkContextParams(
|
||||||
|
in_memory, relative_partition_path, network_context_params,
|
||||||
|
cert_verifier_creation_params);
|
||||||
|
+ return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HeadlessContentBrowserClient::GetProduct() {
|
||||||
|
diff --git headless/lib/browser/headless_content_browser_client.h headless/lib/browser/headless_content_browser_client.h
|
||||||
|
index 441423c66de35..97a98a41dd7e3 100644
|
||||||
|
--- headless/lib/browser/headless_content_browser_client.h
|
||||||
|
+++ headless/lib/browser/headless_content_browser_client.h
|
||||||
|
@@ -71,7 +71,7 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient {
|
||||||
|
std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
|
||||||
|
bool ShouldEnableStrictSiteIsolation() override;
|
||||||
|
|
||||||
|
- void ConfigureNetworkContextParams(
|
||||||
|
+ bool ConfigureNetworkContextParams(
|
||||||
|
content::BrowserContext* context,
|
||||||
|
bool in_memory,
|
||||||
|
const base::FilePath& relative_partition_path,
|
||||||
|
@ -1,24 +1,37 @@
|
|||||||
diff --git components/embedder_support/user_agent_utils.cc components/embedder_support/user_agent_utils.cc
|
diff --git components/embedder_support/user_agent_utils.cc components/embedder_support/user_agent_utils.cc
|
||||||
index 2c5b4b4a85536..900e8e4735c76 100644
|
index 2c5b4b4a85536..f235c4d72e39e 100644
|
||||||
--- components/embedder_support/user_agent_utils.cc
|
--- components/embedder_support/user_agent_utils.cc
|
||||||
+++ components/embedder_support/user_agent_utils.cc
|
+++ components/embedder_support/user_agent_utils.cc
|
||||||
@@ -15,6 +15,7 @@
|
@@ -15,6 +15,7 @@
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
#include "build/branding_buildflags.h"
|
#include "build/branding_buildflags.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
+#include "cef/libcef/common/cef_switches.h"
|
+#include "cef/libcef/features/features.h"
|
||||||
#include "components/embedder_support/pref_names.h"
|
#include "components/embedder_support/pref_names.h"
|
||||||
#include "components/embedder_support/switches.h"
|
#include "components/embedder_support/switches.h"
|
||||||
#include "components/policy/core/common/policy_pref_names.h"
|
#include "components/policy/core/common/policy_pref_names.h"
|
||||||
@@ -370,6 +371,12 @@ std::string GetMajorVersionForUserAgentString(
|
@@ -31,6 +32,10 @@
|
||||||
|
#if BUILDFLAG(IS_WIN)
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
+#if BUILDFLAG(ENABLE_CEF)
|
||||||
|
+#include "cef/libcef/common/cef_switches.h"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#include "base/win/registry.h"
|
||||||
|
#include "base/win/windows_version.h"
|
||||||
|
#endif // BUILDFLAG(IS_WIN)
|
||||||
|
@@ -370,6 +375,14 @@ std::string GetMajorVersionForUserAgentString(
|
||||||
std::string GetProductAndVersion(
|
std::string GetProductAndVersion(
|
||||||
ForceMajorVersionToMinorPosition force_major_to_minor,
|
ForceMajorVersionToMinorPosition force_major_to_minor,
|
||||||
UserAgentReductionEnterprisePolicyState user_agent_reduction) {
|
UserAgentReductionEnterprisePolicyState user_agent_reduction) {
|
||||||
|
+#if BUILDFLAG(ENABLE_CEF)
|
||||||
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
+ if (command_line->HasSwitch(switches::kUserAgentProductAndVersion)) {
|
+ if (command_line->HasSwitch(switches::kUserAgentProductAndVersion)) {
|
||||||
+ return command_line->GetSwitchValueASCII(
|
+ return command_line->GetSwitchValueASCII(
|
||||||
+ switches::kUserAgentProductAndVersion);
|
+ switches::kUserAgentProductAndVersion);
|
||||||
+ }
|
+ }
|
||||||
|
+#endif
|
||||||
+
|
+
|
||||||
if (ShouldForceMajorVersionToMinorPosition(force_major_to_minor)) {
|
if (ShouldForceMajorVersionToMinorPosition(force_major_to_minor)) {
|
||||||
// Force major version to 99 and major version to minor version position.
|
// Force major version to 99 and major version to minor version position.
|
||||||
|
Reference in New Issue
Block a user