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

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: fix GetUserAgent() to return whether the user agent is overriding, clean up 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 BuildUserAgentHelper(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. 130 // Replace Safari's Version/X string with the product name/version passed in.
Evan Martin 2011/09/21 20:27:24 This comment appears to be obsolete. Your call as
Dirk Pranke 2011/09/21 21:02:35 Will fix.
132 // This is done to expose our product name in a manner that is maximally 131 // This is done to expose our product name in a manner that is maximally
133 // compatible with Safari, we hope!! 132 // compatible with Safari, we hope!!
134 133
135 // Derived from Safari's UA string. 134 // Derived from Safari's UA string.
136 base::StringAppendF( 135 base::StringAppendF(
137 &user_agent, 136 &user_agent,
138 "Mozilla/5.0 (%s%s) AppleWebKit/%d.%d" 137 "Mozilla/5.0 (%s%s) AppleWebKit/%d.%d"
139 " (KHTML, like Gecko) %s Safari/%d.%d", 138 " (KHTML, like Gecko) %s Safari/%d.%d",
140 mimic_windows ? "Windows " : kUserAgentPlatform, 139 kUserAgentPlatform,
141 webkit_glue::BuildOSCpuInfo().c_str(), 140 webkit_glue::BuildOSCpuInfo().c_str(),
142 WEBKIT_VERSION_MAJOR, 141 WEBKIT_VERSION_MAJOR,
143 WEBKIT_VERSION_MINOR, 142 WEBKIT_VERSION_MINOR,
144 product.c_str(), 143 product.c_str(),
145 WEBKIT_VERSION_MAJOR, 144 WEBKIT_VERSION_MAJOR,
146 WEBKIT_VERSION_MINOR); 145 WEBKIT_VERSION_MINOR);
147 return user_agent; 146 return user_agent;
148 } 147 }
149 148
150 } // namespace webkit_glue 149 } // namespace webkit_glue
151 150
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698