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

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

Issue 2757073002: Cleanup of how -enableDesktopUserAgent uses NavigationManager utility. (Closed)
Patch Set: Added DCHECK 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 | « no previous file | ios/chrome/browser/web/navigation_manager_util.h » ('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 e43f2bcfdbbd274cc7d7aa92709df367c7d4ef58..63be1a79b034f1a2a533b5a45f81316b177683e8 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -1489,23 +1489,20 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
}
- (void)reloadForDesktopUserAgent {
- // |loadWithParams| will recreate the removed UIWebView.
+ // This removes the web view, which will be recreated at the end of this.
[self.webController requirePageReconstruction];
// TODO(crbug.com/228171): A hack in session_controller -addPendingItem
// discusses making tab responsible for distinguishing history stack
- // navigation from new navigations. Because we want a new navigation here, we
- // use |PAGE_TRANSITION_FORM_SUBMIT|. When session_controller changes, so
- // should this.
- ui::PageTransition transition =
- ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT);
- DCHECK([self navigationManager]);
+ // navigation from new navigations.
+ web::NavigationManager* navigationManager = [self navigationManager];
+ DCHECK(navigationManager);
web::NavigationItem* lastNonRedirectedItem =
- GetLastNonRedirectedItem([self navigationManager]);
+ GetLastNonRedirectedItem(navigationManager);
if (!lastNonRedirectedItem)
return;
- // |originalUrl| will be empty if a page was open by DOM.
+ // |reloadURL| will be empty if a page was open by DOM.
GURL reloadURL(lastNonRedirectedItem->GetOriginalRequestURL());
if (reloadURL.is_empty()) {
DCHECK(
@@ -1515,9 +1512,10 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
web::NavigationManager::WebLoadParams params(reloadURL);
params.referrer = lastNonRedirectedItem->GetReferrer();
- params.transition_type = transition;
- if (self.navigationManager)
- self.navigationManager->LoadURLWithParams(params);
+ // A new navigation is needed here for reloading with desktop User-Agent.
+ params.transition_type =
+ ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT);
+ navigationManager->LoadURLWithParams(params);
}
- (id<SnapshotOverlayProvider>)snapshotOverlayProvider {
« no previous file with comments | « no previous file | ios/chrome/browser/web/navigation_manager_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698