~chromium-team/chromium-browser/artful-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
31
32
33
34
35
36
37
38
39
40
41
42
43
---
 webkit/glue/user_agent.cc |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: src/webkit/glue/user_agent.cc
===================================================================
--- src.orig/webkit/glue/user_agent.cc
+++ src/webkit/glue/user_agent.cc
@@ -94,26 +94,33 @@
   // TODO(port): figure out correct locale
   const char kUserAgentLocale[] = "en-US";
 
   // Get the product name and version, and replace Safari's Version/X string
   // with it.  This is done to expose our product name in a manner that is
   // maximally compatible with Safari, we hope!!
   std::string product = GetProductVersion();
 
+  // 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");
+
   // Derived from Safari's UA string.
   StringAppendF(
       result,
       "Mozilla/5.0 (%s; %c; %s; %s) AppleWebKit/%d.%d"
-      " (KHTML, like Gecko) %s Safari/%d.%d",
+      " (KHTML, like Gecko) @BUILD_DIST_NAME@/@BUILD_DIST_VERSION@ %s %s Safari/%d.%d",
       mimic_windows ? "Windows" : kUserAgentPlatform,
       kUserAgentSecurity,
       ((mimic_windows ? "Windows " : "") + BuildOSCpuInfo()).c_str(),
       kUserAgentLocale,
       WEBKIT_VERSION_MAJOR,
       WEBKIT_VERSION_MINOR,
+      realproduct.c_str(),
       product.c_str(),
       WEBKIT_VERSION_MAJOR,
       WEBKIT_VERSION_MINOR);
 }
 
 }  // namespace webkit_glue