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

Unified Diff: webkit/glue/user_agent.cc

Issue 10854251: Allow the creation of partially spoofed user agents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moving namespaces Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/user_agent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/user_agent.cc
diff --git a/webkit/glue/user_agent.cc b/webkit/glue/user_agent.cc
index bfd1ff4217e54ea688b9bfc3440311b37d3ca79c..cc03719ebccd87b04909c9c3278dac76d509a692 100644
--- a/webkit/glue/user_agent.cc
+++ b/webkit/glue/user_agent.cc
@@ -155,18 +155,22 @@ std::string BuildUserAgentFromProduct(const std::string& product) {
"Unknown; ";
#endif
- std::string user_agent;
+ std::string os_info;
+ base::StringAppendF(&os_info, "%s%s", kUserAgentPlatform,
+ webkit_glue::BuildOSCpuInfo().c_str());
+ return BuildUserAgentFromOSAndProduct(os_info, product);
+}
+std::string BuildUserAgentFromOSAndProduct(const std::string& os_info,
+ const std::string& product) {
+ // 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!!
-
- // Derived from Safari's UA string.
+ std::string user_agent;
base::StringAppendF(
&user_agent,
- "Mozilla/5.0 (%s%s) AppleWebKit/%d.%d"
- " (KHTML, like Gecko) %s Safari/%d.%d",
- kUserAgentPlatform,
- webkit_glue::BuildOSCpuInfo().c_str(),
+ "Mozilla/5.0 (%s) AppleWebKit/%d.%d (KHTML, like Gecko) %s Safari/%d.%d",
+ os_info.c_str(),
WEBKIT_VERSION_MAJOR,
WEBKIT_VERSION_MINOR,
product.c_str(),
« no previous file with comments | « webkit/glue/user_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698