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

Unified Diff: ios/web/public/navigation_manager.h

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/web/public/navigation_manager.h
diff --git a/ios/web/public/navigation_manager.h b/ios/web/public/navigation_manager.h
index 50bf82be8487db8551d08dc006ee1739c5089b5e..a8b1cf57f714c357f129a7150cb382e35838b50b 100644
--- a/ios/web/public/navigation_manager.h
+++ b/ios/web/public/navigation_manager.h
@@ -166,6 +166,26 @@ class NavigationManager {
virtual NavigationItemList GetBackwardItems() const = 0;
virtual NavigationItemList GetForwardItems() const = 0;
+ // Removes all items from this except the last committed item, and inserts
+ // copies of all items from |source| at the beginning of the session history.
+ //
+ // For example:
+ // source: A B *C* D
+ // this: E F *G*
+ // result: A B C *G*
+ //
+ // If there is a pending item after *G* in |this|, it is also preserved.
+ // This ignores any pending or transient entries in |source|. This will be a
+ // no-op if called while CanPruneAllButLastCommittedItem() is false.
+ virtual void CopyStateFromAndPrune(const NavigationManager* source) = 0;
+
+ // Whether the NavigationManager can prune all but the last committed item.
+ // This is true when all the following conditions are met:
+ // - There is a last committed NavigationItem.
+ // - There is no pending history navigation.
+ // - There is no transient NavigationItem.
+ virtual bool CanPruneAllButLastCommittedItem() const = 0;
+
// Forces the pending item to be loaded using desktop user agent. Note that
// the pending item may or may not already exist.
// TODO(crbug.com/692303): Remove this when overriding the user agent doesn't

Powered by Google App Engine
This is Rietveld 408576698