Chromium Code Reviews| 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..f51bfe882deec7afe9b8ab565c60d4bb2dd1cbe1 100644 |
| --- a/ios/chrome/browser/web/chrome_web_client.mm |
| +++ b/ios/chrome/browser/web/chrome_web_client.mm |
| @@ -108,12 +108,17 @@ |
| 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. |
| + if (type == web::UserAgentType::NONE) { |
| + NOTREACHED(); |
| + return std::string(); |
|
liaoyuke
2017/02/25 01:28:19
Do we really need this return statement?
kkhorimoto
2017/02/25 01:35:05
Yes, NOTREACHED() does nothing in non-debug builds
liaoyuke
2017/02/25 01:40:55
I think it will compile even without this return,
kkhorimoto
2017/02/25 01:52:09
It will compile, but it will return the wrong valu
|
| + } |
| + |
| // 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)) { |