Index: ios/chrome/browser/web/chrome_web_client.mm |
diff --git a/ios/chrome/browser/web/chrome_web_client.mm b/ios/chrome/browser/web/chrome_web_client.mm |
index ccf042f332e166d5afd3775ff80fd8170d17cb16..f3147002e30169b2f4642eff4c59534a73c4e644 100644 |
--- a/ios/chrome/browser/web/chrome_web_client.mm |
+++ b/ios/chrome/browser/web/chrome_web_client.mm |
@@ -108,12 +108,14 @@ |
return product; |
} |
-std::string ChromeWebClient::GetUserAgent(bool desktop_user_agent) const { |
+std::string ChromeWebClient::GetUserAgent(web::UserAgentType type) const { |
+ // The user agent should not be requested for app-specific URLs. |
+ DCHECK_NE(type, web::UserAgentType::NONE); |
+ |
// Using desktop user agent overrides a command-line user agent, so that |
// request desktop site can still work when using an overridden UA. |
- if (desktop_user_agent) { |
+ if (type == web::UserAgentType::DESKTOP) |
return base::SysNSStringToUTF8(ChromeWebView::kDesktopUserAgent); |
- } |
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
if (command_line->HasSwitch(switches::kUserAgent)) { |
@@ -124,8 +126,7 @@ |
LOG(WARNING) << "Ignored invalid value for flag --" << switches::kUserAgent; |
} |
- std::string product = GetProduct(); |
- return web::BuildUserAgentFromProduct(product); |
+ return web::BuildUserAgentFromProduct(GetProduct()); |
} |
base::string16 ChromeWebClient::GetLocalizedString(int message_id) const { |