~saiarcot895/chromium-browser/chromium-browser.precise.beta

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Add "Chromium" and "Ubuntu" to the user-agent text.
Author: Chad Miller <chad.miller@canonical.com>

Index: beta.xenial/content/common/user_agent.cc
===================================================================
--- beta.xenial.orig/content/common/user_agent.cc
+++ beta.xenial/content/common/user_agent.cc
@@ -189,13 +189,21 @@ std::string BuildUserAgentFromOSAndProdu
   // Derived from Safari's UA string.
   // This is done to expose our product name in a manner that is maximally
   // compatible with Safari, we hope!!
+
+  // We want to also add Chromium
+  std::string realproduct = product.c_str();
+  size_t pos;
+  if ((pos = realproduct.find("/")) != std::string::npos)
+      realproduct.replace(0, pos, "Chromium");
+
   std::string user_agent;
   base::StringAppendF(
       &user_agent,
-      "Mozilla/5.0 (%s) AppleWebKit/%d.%d (KHTML, like Gecko) %s Safari/%d.%d",
+      "Mozilla/5.0 (%s) AppleWebKit/%d.%d (KHTML, like Gecko) Ubuntu %s %s Safari/%d.%d",
       os_info.c_str(),
       WEBKIT_VERSION_MAJOR,
       WEBKIT_VERSION_MINOR,
+      realproduct.c_str(),
       product.c_str(),
       WEBKIT_VERSION_MAJOR,
       WEBKIT_VERSION_MINOR);