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

Unified Diff: ios/web/navigation/crw_session_controller.mm

Issue 2821173002: Handle correctly start and commit of non-latest navigations. (Closed)
Patch Set: Use web::GetDisplayTitleForUrl Created 3 years, 8 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/web/navigation/crw_session_controller.h ('k') | ios/web/navigation/crw_session_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/navigation/crw_session_controller.mm
diff --git a/ios/web/navigation/crw_session_controller.mm b/ios/web/navigation/crw_session_controller.mm
index cf5175e1673d9b538cc846748aede176d338b9c8..58d095a83c8377d39736ad1162c309865a44a407 100644
--- a/ios/web/navigation/crw_session_controller.mm
+++ b/ios/web/navigation/crw_session_controller.mm
@@ -541,21 +541,26 @@ initiationType:(web::NavigationInitiationType)initiationType;
self.items.size());
}
-- (void)goToItemAtIndex:(NSInteger)index {
+- (void)goToItemAtIndex:(NSInteger)index
+ discardNonCommittedItems:(BOOL)discard {
if (index < 0 || static_cast<NSUInteger>(index) >= self.items.size())
return;
- if (index < _lastCommittedItemIndex) {
- // Going back.
- [self discardNonCommittedItems];
- } else if (_lastCommittedItemIndex < index) {
- // Going forward.
- [self discardTransientItem];
- } else {
- // |delta| is 0, no need to change the last committed item index.
+ if (index == _lastCommittedItemIndex) {
+ // |delta| is 0, no need to change current navigation index.
return;
}
+ if (discard) {
+ if (index < _lastCommittedItemIndex) {
+ // Going back.
+ [self discardNonCommittedItems];
+ } else if (_lastCommittedItemIndex < index) {
+ // Going forward.
+ [self discardTransientItem];
+ }
+ }
+
_previousItemIndex = _lastCommittedItemIndex;
_lastCommittedItemIndex = index;
}
« no previous file with comments | « ios/web/navigation/crw_session_controller.h ('k') | ios/web/navigation/crw_session_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698