Fix patched chrome build with enable_cef=false
This commit is contained in:
parent
5c4ac32bb9
commit
47d2651ea4
|
@ -1,5 +1,5 @@
|
|||
diff --git chrome/browser/extensions/api/chrome_extensions_api_client.cc chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||
index 2b64f15504dcb..06a70c70738cd 100644
|
||||
index 2b64f15504dcb..7c65f1b0d8baa 100644
|
||||
--- chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||
+++ chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||
@@ -13,6 +13,7 @@
|
||||
|
@ -21,13 +21,15 @@ index 2b64f15504dcb..06a70c70738cd 100644
|
|||
#if BUILDFLAG(ENABLE_PDF)
|
||||
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.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>
|
||||
ChromeExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
||||
MimeHandlerViewGuest* guest) const {
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (cef::IsChromeRuntimeEnabled()) {
|
||||
+ return std::make_unique<ChromeMimeHandlerViewGuestDelegateCef>(guest);
|
||||
+ }
|
||||
+#endif
|
||||
return std::make_unique<ChromeMimeHandlerViewGuestDelegate>();
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ index 49993fbc333f8..c39e8743e281e 100644
|
|||
// content::ContentMainDelegate:
|
||||
absl::optional<int> BasicStartupComplete() override;
|
||||
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
|
||||
index 2893df3488d8f..46cd8d9643b69 100644
|
||||
index 2893df3488d8f..4ad86fb7a2bb0 100644
|
||||
--- chrome/browser/chrome_browser_main.cc
|
||||
+++ chrome/browser/chrome_browser_main.cc
|
||||
@@ -51,6 +51,7 @@
|
||||
|
@ -113,6 +113,24 @@ index 2893df3488d8f..46cd8d9643b69 100644
|
|||
#include "chrome/browser/about_flags.h"
|
||||
#include "chrome/browser/active_use_util.h"
|
||||
#include "chrome/browser/after_startup_task_utils.h"
|
||||
@@ -1475,7 +1476,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.
|
||||
|
||||
@@ -1522,7 +1523,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
|
||||
@@ -1575,12 +1576,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
browser_process_->local_state());
|
||||
}
|
||||
|
@ -128,37 +146,32 @@ index 2893df3488d8f..46cd8d9643b69 100644
|
|||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
page_info::SetPageInfoClient(new ChromePageInfoClient());
|
||||
@@ -1732,14 +1735,17 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
@@ -1729,6 +1732,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
|
||||
// Startup.StartupBrowserCreator_Start.
|
||||
// See the comment above for an explanation of |process_command_line|.
|
||||
+ // Bypass StartupBrowserCreator with CEF where |GetMainRunLoopInstance()| is
|
||||
+ // 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))
|
||||
@@ -1767,8 +1773,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
@@ -1767,11 +1774,14 @@ 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>();
|
||||
GetMainRunLoopInstance() = std::make_unique<base::RunLoop>();
|
||||
browser_process_->SetQuitClosure(
|
||||
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
|
||||
index 77aaa6d46daea..e428711ec4ab3 100644
|
||||
--- chrome/browser/chrome_browser_main_mac.mm
|
||||
|
|
|
@ -379,7 +379,7 @@ index 97f6f59322215..a71571e0d6ce9 100644
|
|||
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
||||
// 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
|
||||
index e1b23142611cb..08852ecb7c129 100644
|
||||
index e1b23142611cb..1c9fb04a163db 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
@@ -46,6 +46,10 @@
|
||||
|
@ -393,15 +393,17 @@ index e1b23142611cb..08852ecb7c129 100644
|
|||
using views::View;
|
||||
using web_modal::ModalDialogHostObserver;
|
||||
using web_modal::WebContentsModalDialogHost;
|
||||
@@ -472,6 +476,11 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
||||
@@ -472,6 +476,13 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
||||
|
||||
int BrowserViewLayout::LayoutToolbar(int top) {
|
||||
TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar");
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (cef::IsCefView(toolbar_)) {
|
||||
+ // CEF may take ownership of the toolbar. Early exit to avoid the DCHECK
|
||||
+ // in LayoutManager::SetViewVisibility().
|
||||
+ return top;
|
||||
+ }
|
||||
+#endif
|
||||
int browser_view_width = vertical_layout_rect_.width();
|
||||
bool toolbar_visible = delegate_->IsToolbarVisible();
|
||||
int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
|
||||
|
|
|
@ -178,3 +178,37 @@ index 3ae765eea4b8f..c0fe200f0d373 100644
|
|||
// 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.
|
||||
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
|
||||
index 40148eeaef7d1..353c6d2b37a7a 100644
|
||||
index 40148eeaef7d1..9e2fae7232653 100644
|
||||
--- components/embedder_support/user_agent_utils.cc
|
||||
+++ components/embedder_support/user_agent_utils.cc
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "base/version.h"
|
||||
#include "build/branding_buildflags.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/switches.h"
|
||||
#include "components/policy/core/common/policy_pref_names.h"
|
||||
@@ -382,6 +383,12 @@ std::string GetMajorVersionForUserAgentString(
|
||||
@@ -35,6 +36,10 @@
|
||||
#include "base/win/windows_version.h"
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "cef/libcef/common/cef_switches.h"
|
||||
+#endif
|
||||
+
|
||||
namespace embedder_support {
|
||||
|
||||
namespace {
|
||||
@@ -382,6 +387,14 @@ std::string GetMajorVersionForUserAgentString(
|
||||
std::string GetProductAndVersion(
|
||||
ForceMajorVersionToMinorPosition force_major_to_minor,
|
||||
UserAgentReductionEnterprisePolicyState user_agent_reduction) {
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
+ if (command_line->HasSwitch(switches::kUserAgentProductAndVersion)) {
|
||||
+ return command_line->GetSwitchValueASCII(
|
||||
+ switches::kUserAgentProductAndVersion);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (ShouldForceMajorVersionToMinorPosition(force_major_to_minor)) {
|
||||
// Force major version to 99 and major version to minor version position.
|
||||
|
|
Loading…
Reference in New Issue