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

Unified Diff: ios/chrome/browser/tabs/tab.mm

Issue 2779383002: implement user agent override option. (Closed)
Patch Set: Rebase Created 3 years, 9 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/tabs/tab.h ('k') | ios/chrome/browser/tabs/tab_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/tabs/tab.mm
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm
index 776f2a7b2de88d81f4e727a3c50a6541eb764fc1..360fb322727edfe9eedfda7fc97ab4a25c2f5ac3 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -622,8 +622,6 @@ + (Tab*)preloadingTabWithBrowserState:(ios::ChromeBrowserState*)browserState
opener:opener
openedByDOM:NO
model:nil] autorelease];
- if (desktopUserAgent)
- [tab enableDesktopUserAgent];
[[tab webController] setNativeProvider:provider];
[[tab webController] setWebUsageEnabled:YES];
@@ -633,6 +631,11 @@ + (Tab*)preloadingTabWithBrowserState:(ios::ChromeBrowserState*)browserState
web::NavigationManager::WebLoadParams params(URL);
params.transition_type = transition;
params.referrer = referrer;
+ if (desktopUserAgent) {
+ params.user_agent_override_option =
+ web::NavigationManager::UserAgentOverrideOption::DESKTOP;
+ }
+
[[tab webController] loadWithParams:params];
return tab;
@@ -1484,12 +1487,6 @@ - (BOOL)usesDesktopUserAgent {
visibleItem->GetUserAgentType() == web::UserAgentType::DESKTOP;
}
-- (void)enableDesktopUserAgent {
- DCHECK_EQ(self.usesDesktopUserAgent, NO);
- DCHECK([self navigationManager]);
- [self navigationManager]->OverrideDesktopUserAgentForNextPendingItem();
-}
-
- (void)reloadForDesktopUserAgent {
// This removes the web view, which will be recreated at the end of this.
[self.webController requirePageReconstruction];
@@ -1514,6 +1511,8 @@ - (void)reloadForDesktopUserAgent {
web::NavigationManager::WebLoadParams params(reloadURL);
params.referrer = lastNonRedirectedItem->GetReferrer();
// A new navigation is needed here for reloading with desktop User-Agent.
+ params.user_agent_override_option =
+ web::NavigationManager::UserAgentOverrideOption::DESKTOP;
params.transition_type =
ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT);
navigationManager->LoadURLWithParams(params);
« no previous file with comments | « ios/chrome/browser/tabs/tab.h ('k') | ios/chrome/browser/tabs/tab_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698