Fix patched chrome build with enable_cef=false

This commit is contained in:
Marshall Greenblatt
2023-01-23 12:59:09 -05:00
parent 18f6895b3b
commit 83cbdcdce5
5 changed files with 91 additions and 33 deletions

View File

@@ -1,24 +1,37 @@
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
@@ -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"
@@ -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(
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.