Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1334)

Side by Side Diff: webkit/glue/user_agent.cc

Issue 7922023: Remove webkit_glue::BuildUserAgent(), remove windows spoofing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to r102225 Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/user_agent.h" 5 #include "webkit/glue/user_agent.h"
6 6
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) 7 #if defined(OS_POSIX) && !defined(OS_MACOSX)
8 #include <sys/utsname.h> 8 #include <sys/utsname.h>
9 #endif 9 #endif
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 int GetWebKitMajorVersion() { 108 int GetWebKitMajorVersion() {
109 return WEBKIT_VERSION_MAJOR; 109 return WEBKIT_VERSION_MAJOR;
110 } 110 }
111 111
112 int GetWebKitMinorVersion() { 112 int GetWebKitMinorVersion() {
113 return WEBKIT_VERSION_MINOR; 113 return WEBKIT_VERSION_MINOR;
114 } 114 }
115 115
116 std::string BuildUserAgentHelper(bool mimic_windows, 116 std::string BuildUserAgentFromProduct(const std::string& product) {
117 const std::string& product) {
118 const char kUserAgentPlatform[] = 117 const char kUserAgentPlatform[] =
119 #if defined(OS_WIN) 118 #if defined(OS_WIN)
120 ""; 119 "";
121 #elif defined(OS_MACOSX) 120 #elif defined(OS_MACOSX)
122 "Macintosh; "; 121 "Macintosh; ";
123 #elif defined(USE_X11) 122 #elif defined(USE_X11)
124 "X11; "; // strange, but that's what Firefox uses 123 "X11; "; // strange, but that's what Firefox uses
125 #else 124 #else
126 "Unknown; "; 125 "Unknown; ";
127 #endif 126 #endif
128 127
129 std::string user_agent; 128 std::string user_agent;
130 129
131 // Replace Safari's Version/X string with the product name/version passed in.
132 // This is done to expose our product name in a manner that is maximally 130 // This is done to expose our product name in a manner that is maximally
133 // compatible with Safari, we hope!! 131 // compatible with Safari, we hope!!
134 132
135 // Derived from Safari's UA string. 133 // Derived from Safari's UA string.
136 base::StringAppendF( 134 base::StringAppendF(
137 &user_agent, 135 &user_agent,
138 "Mozilla/5.0 (%s%s) AppleWebKit/%d.%d" 136 "Mozilla/5.0 (%s%s) AppleWebKit/%d.%d"
139 " (KHTML, like Gecko) %s Safari/%d.%d", 137 " (KHTML, like Gecko) %s Safari/%d.%d",
140 mimic_windows ? "Windows " : kUserAgentPlatform, 138 kUserAgentPlatform,
141 webkit_glue::BuildOSCpuInfo().c_str(), 139 webkit_glue::BuildOSCpuInfo().c_str(),
142 WEBKIT_VERSION_MAJOR, 140 WEBKIT_VERSION_MAJOR,
143 WEBKIT_VERSION_MINOR, 141 WEBKIT_VERSION_MINOR,
144 product.c_str(), 142 product.c_str(),
145 WEBKIT_VERSION_MAJOR, 143 WEBKIT_VERSION_MAJOR,
146 WEBKIT_VERSION_MINOR); 144 WEBKIT_VERSION_MINOR);
147 return user_agent; 145 return user_agent;
148 } 146 }
149 147
150 } // namespace webkit_glue 148 } // namespace webkit_glue
151 149
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698