Index: chrome/common/chrome_content_client.cc |
=================================================================== |
--- chrome/common/chrome_content_client.cc (revision 255867) |
+++ chrome/common/chrome_content_client.cc (working copy) |
@@ -417,8 +417,27 @@ |
#endif // FLAPPER_AVAILABLE |
} |
+std::string GetProduct() { |
+ chrome::VersionInfo version_info; |
+ return version_info.is_valid() ? |
+ version_info.ProductNameAndVersionForUserAgent() : std::string(); |
+} |
+ |
} // namespace |
+std::string GetUserAgent() { |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ if (command_line->HasSwitch(switches::kUserAgent)) |
+ return command_line->GetSwitchValueASCII(switches::kUserAgent); |
+ |
+ std::string product = GetProduct(); |
+#if defined(OS_ANDROID) |
+ if (command_line->HasSwitch(switches::kUseMobileUserAgent)) |
+ product += " Mobile"; |
+#endif |
+ return webkit_glue::BuildUserAgentFromProduct(product); |
+} |
+ |
void ChromeContentClient::SetActiveURL(const GURL& url) { |
base::debug::SetCrashKeyValue(crash_keys::kActiveURL, |
url.possibly_invalid_spec()); |
@@ -480,19 +499,11 @@ |
} |
std::string ChromeContentClient::GetProduct() const { |
- chrome::VersionInfo version_info; |
- return version_info.is_valid() ? |
- version_info.ProductNameAndVersionForUserAgent() : std::string(); |
+ return ::GetProduct(); |
} |
std::string ChromeContentClient::GetUserAgent() const { |
- std::string product = GetProduct(); |
-#if defined(OS_ANDROID) |
- CommandLine* command_line = CommandLine::ForCurrentProcess(); |
- if (command_line->HasSwitch(switches::kUseMobileUserAgent)) |
- product += " Mobile"; |
-#endif |
- return webkit_glue::BuildUserAgentFromProduct(product); |
+ return ::GetUserAgent(); |
} |
base::string16 ChromeContentClient::GetLocalizedString(int message_id) const { |