Files
cef/patch/patches/embedder_product_override.patch
2025-05-06 17:09:21 -04:00

38 lines
1.4 KiB
Diff

diff --git components/embedder_support/user_agent_utils.cc components/embedder_support/user_agent_utils.cc
index 47abbd2835a36..4eb995232a7d8 100644
--- components/embedder_support/user_agent_utils.cc
+++ components/embedder_support/user_agent_utils.cc
@@ -28,6 +28,7 @@
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/util/chromium_git_revision.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"
@@ -56,6 +57,10 @@
#include <sys/utsname.h>
#endif
+#if BUILDFLAG(ENABLE_CEF)
+constexpr char kUserAgentProductAndVersion[] = "user-agent-product";
+#endif
+
namespace embedder_support {
namespace {
@@ -465,6 +470,13 @@ std::string BuildOSCpuInfo(
std::string GetProductAndVersion(
UserAgentReductionEnterprisePolicyState user_agent_reduction) {
+#if BUILDFLAG(ENABLE_CEF)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(kUserAgentProductAndVersion)) {
+ return command_line->GetSwitchValueASCII(kUserAgentProductAndVersion);
+ }
+#endif
+
return ShouldReduceUserAgentMinorVersion(user_agent_reduction)
? version_info::GetProductNameAndVersionForReducedUserAgent(
blink::features::kUserAgentFrozenBuildVersion.Get())