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

Unified Diff: chrome/common/chrome_content_client.cc

Issue 10854251: Allow the creation of partially spoofed user agents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebasing 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 | « chrome/common/chrome_content_client.h ('k') | content/browser/android/content_view_core_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_content_client.cc
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 05ed4c5aa345ff1d2cfdac9e9d5ebb78b8c16c46..0b4008be15059ba10a3e4b4a5db4164d615d9c57 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -430,16 +430,23 @@ bool ChromeContentClient::CanHandleWhileSwappedOut(
return false;
}
-std::string ChromeContentClient::GetUserAgent() const {
+std::string ChromeContentClient::GetProduct(bool mobile_device) const {
tony 2012/08/24 19:46:17 I like the rename to GetProduct, but do we need to
gone 2012/08/24 20:35:11 Did it thinking that we might want to be able to c
chrome::VersionInfo version_info;
std::string product("Chrome/");
product += version_info.is_valid() ? version_info.Version() : "0.0.0.0";
-#if defined(OS_ANDROID)
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kUseMobileUserAgent)) {
+ if (mobile_device) {
product += " Mobile";
}
+ return product;
+}
+
+std::string ChromeContentClient::GetUserAgent() const {
+ bool mobile_device = false;
+#if defined(OS_ANDROID)
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ mobile_device = command_line->HasSwitch(switches::kUseMobileUserAgent);
#endif
+ std::string product = GetProduct(mobile_device);
return webkit_glue::BuildUserAgentFromProduct(product);
}
« no previous file with comments | « chrome/common/chrome_content_client.h ('k') | content/browser/android/content_view_core_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698