| Index: ios/web/navigation/crw_session_controller.h
|
| diff --git a/ios/web/navigation/crw_session_controller.h b/ios/web/navigation/crw_session_controller.h
|
| index f70a871b8466583a8bedfee6821ee1f9d57570dd..3859af2ac855ff9e46ca38356c75d34b536b6584 100644
|
| --- a/ios/web/navigation/crw_session_controller.h
|
| +++ b/ios/web/navigation/crw_session_controller.h
|
| @@ -8,6 +8,7 @@
|
| #import <Foundation/Foundation.h>
|
| #include <vector>
|
|
|
| +#include "ios/web/public/navigation_item_list.h"
|
| #include "ui/base/page_transition_types.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -16,6 +17,7 @@
|
|
|
| namespace web {
|
| class BrowserState;
|
| +class NavigationItemImpl;
|
| class NavigationManagerImpl;
|
| struct Referrer;
|
| }
|
| @@ -31,32 +33,59 @@ struct Referrer;
|
| @property(nonatomic, readonly, copy) NSString* tabId;
|
| @property(nonatomic, readonly, assign) NSInteger currentNavigationIndex;
|
| @property(nonatomic, readonly, assign) NSInteger previousNavigationIndex;
|
| -// The index of the pending entry if it is in entries_, or -1 if pendingEntry is
|
| -// a new entry (created by addPendingEntry:).
|
| -@property(nonatomic, readwrite, assign) NSInteger pendingEntryIndex;
|
| -@property(nonatomic, readonly, strong) NSArray* entries;
|
| +// The index of the pending item if it is in |items|, or -1 if |pendingItem|
|
| +// corresponds with a new navigation (created by addPendingItem:).
|
| +@property(nonatomic, readwrite, assign) NSInteger pendingItemIndex;
|
| @property(nonatomic, copy) NSString* windowName;
|
| // Indicates whether the page was opened by DOM (e.g. with |window.open|
|
| // JavaScript call or by clicking a link with |_blank| target).
|
| @property(nonatomic, readonly, getter=isOpenedByDOM) BOOL openedByDOM;
|
| @property(nonatomic, readonly, strong)
|
| CRWSessionCertificatePolicyManager* sessionCertificatePolicyManager;
|
| -// Returns the current entry in the session list, or the pending entry if there
|
| -// is a navigation in progress.
|
| +@property(nonatomic, assign) NSTimeInterval lastVisitedTimestamp;
|
| +@property(nonatomic, readonly, copy) NSString* openerId;
|
| +@property(nonatomic, readonly, assign) NSInteger openerNavigationIndex;
|
| +
|
| +// The list of CRWSessionEntries in |_entries|'s NavigationItemImpls.
|
| +@property(nonatomic, readonly) web::NavigationItemList items;
|
| +// The current NavigationItem. During a pending navigation, returns the
|
| +// NavigationItem for that navigation. If a transient NavigationItem exists,
|
| +// this NavigationItem will be returned.
|
| +@property(nonatomic, readonly) web::NavigationItemImpl* currentItem;
|
| +// Returns the NavigationItem whose URL should be displayed to the user.
|
| +@property(nonatomic, readonly) web::NavigationItemImpl* visibleItem;
|
| +// Returns the NavigationItem corresponding to a load for which no data has yet
|
| +// been received.
|
| +@property(nonatomic, readonly) web::NavigationItemImpl* pendingItem;
|
| +// Returns the NavigationItem corresponding with a transient navigation (i.e.
|
| +// SSL interstitials).
|
| +@property(nonatomic, readonly) web::NavigationItemImpl* transientItem;
|
| +// Returns the NavigationItem corresponding with the last committed load.
|
| +@property(nonatomic, readonly) web::NavigationItemImpl* lastCommittedItem;
|
| +// Returns the NavigationItem corresponding with the previously loaded page.
|
| +@property(nonatomic, readonly) web::NavigationItemImpl* previousItem;
|
| +// Returns most recent NavigationItem that is not a redirect. Returns nil if
|
| +// |items| is empty.
|
| +@property(nonatomic, readonly) web::NavigationItemImpl* lastUserItem;
|
| +// Returns a list of all non-redirected NavigationItems whose index precedes
|
| +// |currentNavigationIndex|.
|
| +@property(nonatomic, readonly) web::NavigationItemList backwardItems;
|
| +// Returns a list of all non-redirected NavigationItems whose index follow
|
| +// |currentNavigationIndex|.
|
| +@property(nonatomic, readonly) web::NavigationItemList forwardItems;
|
| +
|
| +// DEPRECATED: Don't add new usage of these properties. Instead, use the
|
| +// NavigationItem versions of these properties above.
|
| +@property(nonatomic, readonly, strong) NSArray* entries;
|
| @property(nonatomic, readonly, strong) CRWSessionEntry* currentEntry;
|
| -// Returns the entry that should be displayed to users (e.g., in the omnibox).
|
| @property(nonatomic, readonly, strong) CRWSessionEntry* visibleEntry;
|
| -// Returns the pending entry, if any.
|
| @property(nonatomic, readonly, strong) CRWSessionEntry* pendingEntry;
|
| -// Returns the transient entry, if any.
|
| @property(nonatomic, readonly, strong) CRWSessionEntry* transientEntry;
|
| -// Returns the last committed entry.
|
| @property(nonatomic, readonly, strong) CRWSessionEntry* lastCommittedEntry;
|
| -// Returns the previous entry in the session list, or nil if there isn't any.
|
| @property(nonatomic, readonly, strong) CRWSessionEntry* previousEntry;
|
| -@property(nonatomic, assign) NSTimeInterval lastVisitedTimestamp;
|
| -@property(nonatomic, readonly, copy) NSString* openerId;
|
| -@property(nonatomic, readonly, assign) NSInteger openerNavigationIndex;
|
| +@property(nonatomic, readonly, strong) CRWSessionEntry* lastUserEntry;
|
| +@property(nonatomic, readonly, weak) NSArray* backwardEntries;
|
| +@property(nonatomic, readonly, weak) NSArray* forwardEntries;
|
|
|
| // CRWSessionController doesn't have public constructors. New
|
| // CRWSessionControllers are created by deserialization, or via a
|
| @@ -67,79 +96,69 @@ struct Referrer;
|
| // Sets the corresponding BrowserState.
|
| - (void)setBrowserState:(web::BrowserState*)browserState;
|
|
|
| -// Add a new entry with the given url, referrer, and navigation type, making it
|
| -// the current entry. If |url| is the same as the current entry's url, this
|
| -// does nothing. |referrer| may be nil if there isn't one. The entry starts
|
| -// out as pending, and will be lost unless |-commitPendingEntry| is called.
|
| -- (void)addPendingEntry:(const GURL&)url
|
| - referrer:(const web::Referrer&)referrer
|
| - transition:(ui::PageTransition)type
|
| - rendererInitiated:(BOOL)rendererInitiated;
|
| +// Add a new item with the given url, referrer, and navigation type, making it
|
| +// the current item. If |url| is the same as the current item's url, this
|
| +// does nothing. |referrer| may be nil if there isn't one. The item starts
|
| +// out as pending, and will be lost unless |-commitPendingItem| is called.
|
| +- (void)addPendingItem:(const GURL&)url
|
| + referrer:(const web::Referrer&)referrer
|
| + transition:(ui::PageTransition)type
|
| + rendererInitiated:(BOOL)rendererInitiated;
|
|
|
| -// Updates the URL of the yet to be committed pending entry. Useful for page
|
| -// redirects. Does nothing if there is no pending entry.
|
| -- (void)updatePendingEntry:(const GURL&)url;
|
| +// Updates the URL of the yet to be committed pending item. Useful for page
|
| +// redirects. Does nothing if there is no pending item.
|
| +- (void)updatePendingItem:(const GURL&)url;
|
|
|
| -// Commits the current pending entry. No changes are made to the entry during
|
| +// Commits the current pending item. No changes are made to the item during
|
| // this process, it is just moved from pending to committed.
|
| // TODO(pinkerton): Desktop Chrome broadcasts a notification here, should we?
|
| -- (void)commitPendingEntry;
|
| +- (void)commitPendingItem;
|
|
|
| -// Adds a transient entry with the given URL. A transient entry will be
|
| +// Adds a transient item with the given URL. A transient item will be
|
| // discarded on any navigation.
|
| -// TODO(stuartmorgan): Make this work more like upstream, where the entry can
|
| +// TODO(stuartmorgan): Make this work more like upstream, where the item can
|
| // be made from outside and then handed in.
|
| -- (void)addTransientEntryWithURL:(const GURL&)URL;
|
| +- (void)addTransientItemWithURL:(const GURL&)URL;
|
|
|
| // Creates a new CRWSessionEntry with the given URL and state object. A state
|
| // object is a serialized generic JavaScript object that contains details of the
|
| -// UI's state for a given CRWSessionEntry/URL. The current entry's URL is the
|
| -// new entry's referrer.
|
| -- (void)pushNewEntryWithURL:(const GURL&)URL
|
| - stateObject:(NSString*)stateObject
|
| - transition:(ui::PageTransition)transition;
|
| -
|
| -// Updates the URL and state object for the current entry.
|
| -- (void)updateCurrentEntryWithURL:(const GURL&)url
|
| - stateObject:(NSString*)stateObject;
|
| -
|
| -- (void)discardNonCommittedEntries;
|
| -
|
| -// Returns YES if there is a pending entry.
|
| -- (BOOL)hasPendingEntry;
|
| -
|
| -// Inserts history state from the given CRWSessionController to the front of
|
| -// this controller.
|
| +// UI's state for a given CRWSessionEntry/URL. The current item's URL is the
|
| +// new item's referrer.
|
| +- (void)pushNewItemWithURL:(const GURL&)URL
|
| + stateObject:(NSString*)stateObject
|
| + transition:(ui::PageTransition)transition;
|
| +
|
| +// Updates the URL and state object for the current item.
|
| +- (void)updateCurrentItemWithURL:(const GURL&)url
|
| + stateObject:(NSString*)stateObject;
|
| +
|
| +// Removes the pending and transient NavigationItems.
|
| +- (void)discardNonCommittedItems;
|
| +
|
| +// Inserts history state from |otherController| to the front of |items|. This
|
| +// function transfers ownership of |otherController|'s NavigationItems to the
|
| +// receiver.
|
| - (void)insertStateFromSessionController:(CRWSessionController*)otherController;
|
|
|
| // Sets |currentNavigationIndex_| to the |index| if it's in the entries bounds.
|
| -- (void)goToEntryAtIndex:(NSInteger)index;
|
| +- (void)goToItemAtIndex:(NSInteger)index;
|
|
|
| -// Removes the entry at |index| after discarding any noncomitted entries.
|
| -// |index| must not be the index of the last committed entry, or a noncomitted
|
| -// entry.
|
| -- (void)removeEntryAtIndex:(NSInteger)index;
|
| -
|
| -// Returns an array containing all of the non-redirected CRWSessionEntry objects
|
| -// whose index in |entries_| is less than |currentNavigationIndex_|.
|
| -- (NSArray*)backwardEntries;
|
| -
|
| -// Returns an array containing all of the non-redirected CRWSessionEntry objects
|
| -// whose index in |entries_| is greater than |currentNavigationIndex_|.
|
| -- (NSArray*)forwardEntries;
|
| +// Removes the item at |index| after discarding any noncomitted entries.
|
| +// |index| must not be the index of the last committed item, or a noncomitted
|
| +// item.
|
| +- (void)removeItemAtIndex:(NSInteger)index;
|
|
|
| // Determines whether a navigation between |firstEntry| and |secondEntry| is a
|
| // same-document navigation. Entries can be passed in any order.
|
| -- (BOOL)isSameDocumentNavigationBetweenEntry:(CRWSessionEntry*)firstEntry
|
| - andEntry:(CRWSessionEntry*)secondEntry;
|
| +- (BOOL)isSameDocumentNavigationBetweenItem:(web::NavigationItem*)firstItem
|
| + andItem:(web::NavigationItem*)secondItem;
|
|
|
| -// Find the most recent session entry that is not a redirect. Returns nil if
|
| -// |entries_| is empty.
|
| -- (CRWSessionEntry*)lastUserEntry;
|
| -
|
| -// Set |useDesktopUserAgentForNextPendingEntry_| to YES if there is no pending
|
| +// Set |useDesktopUserAgentForNextPendingItem_| to YES if there is no pending
|
| // entry, otherwise set |useDesktopUserAgent| in the pending entry.
|
| -- (void)useDesktopUserAgentForNextPendingEntry;
|
| +- (void)useDesktopUserAgentForNextPendingItem;
|
| +
|
| +// Returns the index of |item| in |items|.
|
| +- (NSInteger)indexOfItem:(web::NavigationItem*)item;
|
|
|
| @end
|
|
|
|
|