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

Unified Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2745873002: Created NavigationManager::CopyStateFromAndPrune(). (Closed)
Patch Set: Added no-op tests, addressed Eugene's comments 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
Index: ios/chrome/browser/ui/browser_view_controller.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index 6a4a6377932b8bb80bc74322b25a863d130bcf91..59a76ae81321b5afa2632fe4593f5a8bdbe20aed 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -3678,15 +3678,12 @@ - (void)loadURL:(const GURL&)url
Tab* newTab = [_preloadController releasePrerenderContents];
DCHECK(oldTab);
DCHECK(newTab);
- if (oldTab && newTab) {
+ bool canPruneItems =
+ [newTab navigationManager]->CanPruneAllButLastCommittedItem();
+ if (oldTab && newTab && canPruneItems) {
[oldTab recordStateInHistory];
- DCHECK([newTab navigationManager]);
- CRWSessionController* newHistory =
- [newTab navigationManagerImpl]->GetSessionController();
- DCHECK([oldTab navigationManager]);
- CRWSessionController* oldHistory =
- [oldTab navigationManagerImpl]->GetSessionController();
- [newHistory insertStateFromSessionController:oldHistory];
+ [newTab navigationManager]->CopyStateFromAndPrune(
+ [oldTab navigationManager]);
[[newTab nativeAppNavigationController]
copyStateFrom:[oldTab nativeAppNavigationController]];
[_model replaceTab:oldTab withTab:newTab];
« no previous file with comments | « no previous file | ios/web/navigation/crw_session_controller.h » ('j') | ios/web/navigation/crw_session_controller.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698