Parcourir la source

AP9-4099 Google Web Apps shows Unsupported Message

Fix version: 1.0.0
This ensures that when we open the google web apps (like docs.google.com), there is not a message at the top that says “Unsupported Browser”.
The modified content is to add 'Chrome/xx' and 'Firefox/xx' to the User-Agent.
Yifeng Wu il y a 3 ans
Parent
commit
37b78c3d92

+ 2 - 2
README.md

@@ -113,7 +113,7 @@ Finally, if you don't know how to begin with, maybe `Telemetry-event-video-full-
 
 
 ## Setting the build arguments
 ## Setting the build arguments
 
 
-The arguments in `bromite/build/GN_ARGS` must be used as the Chromium
+The arguments in `bromite/build/bromite.gn_args` must be used as the Chromium
 build arguments. To do this, run `gn args` with the default args
 build arguments. To do this, run `gn args` with the default args
 file. You can optionally set your preferred editor. This is done from
 file. You can optionally set your preferred editor. This is done from
 the Chromium src directory:
 the Chromium src directory:
@@ -122,7 +122,7 @@ the Chromium src directory:
 EDITOR=vi gn args out/Default
 EDITOR=vi gn args out/Default
 ```
 ```
 
 
-Replace all the args with the contents of the `build/GN_ARGS` file in this repo.
+Replace all the args with the contents of the `build/bromite.gn_args` file in this repo.
 
 
 ## Continuing the build
 ## Continuing the build
 
 

+ 1 - 1
build/bromite_patches_list.txt

@@ -190,4 +190,4 @@ Force-package-name-to-org.chromium.chrome.patch
 Donot-stretch-when-force-enable-zoom-checked.patch
 Donot-stretch-when-force-enable-zoom-checked.patch
 Force-desktop-mode.patch
 Force-desktop-mode.patch
 Telemetry-event-video-full-screen.patch
 Telemetry-event-video-full-screen.patch
-
+Fix-google-web-apps-show-unsupported-message.patch

+ 55 - 0
build/patches/Fix-google-web-apps-show-unsupported-message.patch

@@ -0,0 +1,55 @@
+From: Yifeng <wuyifeng@nd.com.cn>
+Date: Fri, 5 Nov 2021 05:53:00 +0000
+Subject: AP9-4099 Google Web Apps shows Unsupported Message
+
+This ensures that when we open the google web apps (like docs.google.com), there is not a message at the top that says “Unsupported Browser”.
+The modified content is to add 'Chrome/xx' and 'Firefox/xx' to the User-Agent.
+
+---
+ content/common/user_agent.cc | 4 ++--
+ components/embedder_support/user_agent_utils.cc | 16 -----
+ 2 files changed, 2 insertions(+), 18 deletions(-)
+
+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
+@@ -328,7 +328,7 @@ std::string BuildUserAgentFromOSAndProduct(const std::string& os_info,
+   std::string user_agent;
+   base::StringAppendF(&user_agent,
+                       "Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) "
+-                      "%s Safari/537.36",
+-                      os_info.c_str(), "");
++                      "%s Safari/537.36 Firefox/97.2.0",
++                      os_info.c_str(), product.c_str());
+   return user_agent;
+ }
+diff --git a/components/embedder_support/user_agent_utils.cc b/components/embedder_support/user_agent_utils.cc
+--- a/components/embedder_support/user_agent_utils.cc
++++ b/components/embedder_support/user_agent_utils.cc
+@@ -267,14 +267,3 @@
+ std::string GetUserAgent() {
+-  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+-  if (command_line->HasSwitch(kUserAgent)) {
+-    std::string ua = command_line->GetSwitchValueASCII(kUserAgent);
+-    if (net::HttpUtil::IsValidHeaderValue(ua))
+-      return ua;
+-    LOG(WARNING) << "Ignored invalid value for flag --" << kUserAgent;
+-  }
+-
+-  if (base::FeatureList::IsEnabled(blink::features::kReduceUserAgent))
+-    return GetReducedUserAgent();
+-
+   return GetFullUserAgent();
+ }
+@@ -291,9 +280,4 @@
+ std::string GetFullUserAgent() {
+   std::string product = GetProduct(/*allow_version_override=*/true);
+-#if defined(OS_ANDROID)
+-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+-          switches::kUseMobileUserAgent))
+-    product += " Mobile";
+-#endif
+   return content::BuildUserAgentFromProduct(product);
+ }
+--
+2.17.1