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

Unified Diff: ios/chrome/browser/web/chrome_web_client.mm

Issue 2705293014: Created web::UserAgentType. (Closed)
Patch Set: rebase + compile fix Created 3 years, 10 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 | « ios/chrome/browser/web/chrome_web_client.h ('k') | ios/chrome/browser/web/chrome_web_client_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « ios/chrome/browser/web/chrome_web_client.h ('k') | ios/chrome/browser/web/chrome_web_client_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698