Created
December 18, 2022 20:51
-
-
Save uazo/8333c504ba9589bad6db367c2c63cbad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: Your Name <you@example.com> | |
Date: Sun, 18 Dec 2022 16:37:43 +0000 | |
Subject: Guard for user-agent reduction | |
--- | |
chrome/browser/chrome_content_browser_client.cc | 2 +- | |
content/common/user_agent.cc | 13 +++++-------- | |
.../platform/runtime_enabled_features.json5 | 3 ++- | |
3 files changed, 8 insertions(+), 10 deletions(-) | |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc | |
--- a/chrome/browser/chrome_content_browser_client.cc | |
+++ b/chrome/browser/chrome_content_browser_client.cc | |
@@ -1475,7 +1475,7 @@ void ChromeContentBrowserClient::RegisterProfilePrefs( | |
registry->RegisterIntegerPref( | |
prefs::kUserAgentReduction, | |
static_cast<int>( | |
- embedder_support::UserAgentReductionEnterprisePolicyState::kDefault)); | |
+ embedder_support::UserAgentReductionEnterprisePolicyState::kForceEnabled)); | |
registry->RegisterBooleanPref(prefs::kOriginAgentClusterDefaultEnabled, true); | |
registry->RegisterIntegerPref( | |
prefs::kForceMajorVersionToMinorPositionInUserAgent, | |
diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc | |
--- a/content/common/user_agent.cc | |
+++ b/content/common/user_agent.cc | |
@@ -323,14 +323,7 @@ std::string BuildUserAgentFromProduct(const std::string& product) { | |
} | |
std::string BuildModelInfo() { | |
- std::string model; | |
-#if BUILDFLAG(IS_ANDROID) | |
- // Only send the model information if on the release build of Android, | |
- // matching user agent behaviour. | |
- if (base::SysInfo::GetAndroidBuildCodename() == "REL") | |
- model = base::SysInfo::HardwareModelName(); | |
-#endif | |
- return model; | |
+ return std::string(); | |
} | |
#if BUILDFLAG(IS_ANDROID) | |
@@ -351,6 +344,10 @@ std::string GetAndroidOSInfo( | |
IncludeAndroidModel include_android_model) { | |
std::string android_info_str; | |
+ // Do not send information about the device. | |
+ include_android_model = IncludeAndroidModel::Exclude; | |
+ include_android_build_number = IncludeAndroidBuildNumber::Exclude; | |
+ | |
// Send information about the device. | |
bool semicolon_inserted = false; | |
if (include_android_model == IncludeAndroidModel::Include) { | |
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 | |
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 | |
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 | |
@@ -2721,7 +2721,8 @@ | |
base_feature: "UserAgentClientHint", | |
}, | |
{ | |
- name: "UserAgentReduction", | |
+ name: "UserAgentReduction", // always enabled | |
+ status: "stable", // in bromite | |
origin_trial_feature_name: "UserAgentReduction", | |
origin_trial_allows_third_party: true, | |
// iOS not included as it should not send a reduced User-Agent string. | |
-- | |
2.25.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment