| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ | 5 #ifndef IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ |
| 6 #define IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ | 6 #define IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 // A CRWSessionController is similar to a NavigationController object in desktop | 25 // A CRWSessionController is similar to a NavigationController object in desktop |
| 26 // Chrome. It maintains information needed to save/restore a tab with its | 26 // Chrome. It maintains information needed to save/restore a tab with its |
| 27 // complete session history. There is one of these for each tab. | 27 // complete session history. There is one of these for each tab. |
| 28 // DEPRECATED, do not use this class and do not add any methods to it. | 28 // DEPRECATED, do not use this class and do not add any methods to it. |
| 29 // Use web::NavigationManager instead. | 29 // Use web::NavigationManager instead. |
| 30 // TODO(crbug.com/454984): Remove this class. | 30 // TODO(crbug.com/454984): Remove this class. |
| 31 @interface CRWSessionController : NSObject | 31 @interface CRWSessionController : NSObject |
| 32 | 32 |
| 33 @property(nonatomic, readonly, assign) NSInteger currentNavigationIndex; | 33 @property(nonatomic, readonly, assign) NSInteger lastCommittedItemIndex; |
| 34 @property(nonatomic, readonly, assign) NSInteger previousNavigationIndex; | 34 @property(nonatomic, readonly, assign) NSInteger previousItemIndex; |
| 35 // The index of the pending item if it is in |items|, or -1 if |pendingItem| | 35 // The index of the pending item if it is in |items|, or -1 if |pendingItem| |
| 36 // corresponds with a new navigation (created by addPendingItem:). | 36 // corresponds with a new navigation (created by addPendingItem:). |
| 37 @property(nonatomic, readwrite, assign) NSInteger pendingItemIndex; | 37 @property(nonatomic, readwrite, assign) NSInteger pendingItemIndex; |
| 38 @property(nonatomic, readonly, strong) | 38 @property(nonatomic, readonly, strong) |
| 39 CRWSessionCertificatePolicyManager* sessionCertificatePolicyManager; | 39 CRWSessionCertificatePolicyManager* sessionCertificatePolicyManager; |
| 40 | 40 |
| 41 // Whether the CRWSessionController can prune all but the last committed item. | 41 // Whether the CRWSessionController can prune all but the last committed item. |
| 42 // This is true when all the following conditions are met: | 42 // This is true when all the following conditions are met: |
| 43 // - There is a last committed NavigationItem | 43 // - There is a last committed NavigationItem |
| 44 // - There is not currently a pending history navigation | 44 // - There is not currently a pending history navigation |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 @property(nonatomic, readonly) web::NavigationItemImpl* pendingItem; | 59 @property(nonatomic, readonly) web::NavigationItemImpl* pendingItem; |
| 60 // Returns the transient NavigationItem, if any. The transient item will be | 60 // Returns the transient NavigationItem, if any. The transient item will be |
| 61 // discarded on any navigation, and is used to represent interstitials in the | 61 // discarded on any navigation, and is used to represent interstitials in the |
| 62 // session history. | 62 // session history. |
| 63 @property(nonatomic, readonly) web::NavigationItemImpl* transientItem; | 63 @property(nonatomic, readonly) web::NavigationItemImpl* transientItem; |
| 64 // Returns the NavigationItem corresponding with the last committed load. | 64 // Returns the NavigationItem corresponding with the last committed load. |
| 65 @property(nonatomic, readonly) web::NavigationItemImpl* lastCommittedItem; | 65 @property(nonatomic, readonly) web::NavigationItemImpl* lastCommittedItem; |
| 66 // Returns the NavigationItem corresponding with the previously loaded page. | 66 // Returns the NavigationItem corresponding with the previously loaded page. |
| 67 @property(nonatomic, readonly) web::NavigationItemImpl* previousItem; | 67 @property(nonatomic, readonly) web::NavigationItemImpl* previousItem; |
| 68 // Returns a list of all non-redirected NavigationItems whose index precedes | 68 // Returns a list of all non-redirected NavigationItems whose index precedes |
| 69 // |currentNavigationIndex|. | 69 // |lastCommittedItemIndex|. |
| 70 @property(nonatomic, readonly) web::NavigationItemList backwardItems; | 70 @property(nonatomic, readonly) web::NavigationItemList backwardItems; |
| 71 // Returns a list of all non-redirected NavigationItems whose index follow | 71 // Returns a list of all non-redirected NavigationItems whose index follow |
| 72 // |currentNavigationIndex|. | 72 // |lastCommittedItemIndex|. |
| 73 @property(nonatomic, readonly) web::NavigationItemList forwardItems; | 73 @property(nonatomic, readonly) web::NavigationItemList forwardItems; |
| 74 | 74 |
| 75 // CRWSessionController doesn't have public constructors. New | 75 // CRWSessionController doesn't have public constructors. New |
| 76 // CRWSessionControllers are created by deserialization, or via a | 76 // CRWSessionControllers are created by deserialization, or via a |
| 77 // NavigationManager. | 77 // NavigationManager. |
| 78 | 78 |
| 79 // Sets the corresponding NavigationManager. | 79 // Sets the corresponding NavigationManager. |
| 80 - (void)setNavigationManager:(web::NavigationManagerImpl*)navigationManager; | 80 - (void)setNavigationManager:(web::NavigationManagerImpl*)navigationManager; |
| 81 // Sets the corresponding BrowserState. | 81 // Sets the corresponding BrowserState. |
| 82 - (void)setBrowserState:(web::BrowserState*)browserState; | 82 - (void)setBrowserState:(web::BrowserState*)browserState; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // For example: | 126 // For example: |
| 127 // source: A B *C* D | 127 // source: A B *C* D |
| 128 // this: E F *G* | 128 // this: E F *G* |
| 129 // result: A B C *G* | 129 // result: A B C *G* |
| 130 // | 130 // |
| 131 // If there is a pending item after *G* in |this|, it is also preserved. | 131 // If there is a pending item after *G* in |this|, it is also preserved. |
| 132 // This ignores any pending or transient entries in |source|. No-op if | 132 // This ignores any pending or transient entries in |source|. No-op if |
| 133 // |canPruneAllButLastCommittedItem| is false. | 133 // |canPruneAllButLastCommittedItem| is false. |
| 134 - (void)copyStateFromSessionControllerAndPrune:(CRWSessionController*)source; | 134 - (void)copyStateFromSessionControllerAndPrune:(CRWSessionController*)source; |
| 135 | 135 |
| 136 // Sets |currentNavigationIndex_| to the |index| if it's in the entries bounds. | 136 // Sets |lastCommittedItemIndex| to the |index| if it's in the entries bounds. |
| 137 - (void)goToItemAtIndex:(NSInteger)index; | 137 - (void)goToItemAtIndex:(NSInteger)index; |
| 138 | 138 |
| 139 // Removes the item at |index| after discarding any noncomitted entries. | 139 // Removes the item at |index| after discarding any noncomitted entries. |
| 140 // |index| must not be the index of the last committed item, or a noncomitted | 140 // |index| must not be the index of the last committed item, or a noncomitted |
| 141 // item. | 141 // item. |
| 142 - (void)removeItemAtIndex:(NSInteger)index; | 142 - (void)removeItemAtIndex:(NSInteger)index; |
| 143 | 143 |
| 144 // Determines whether a navigation between |firstEntry| and |secondEntry| is a | 144 // Determines whether a navigation between |firstEntry| and |secondEntry| is a |
| 145 // same-document navigation. Entries can be passed in any order. | 145 // same-document navigation. Entries can be passed in any order. |
| 146 - (BOOL)isSameDocumentNavigationBetweenItem:(web::NavigationItem*)firstItem | 146 - (BOOL)isSameDocumentNavigationBetweenItem:(web::NavigationItem*)firstItem |
| 147 andItem:(web::NavigationItem*)secondItem; | 147 andItem:(web::NavigationItem*)secondItem; |
| 148 | 148 |
| 149 // Returns the index of |item| in |items|. | 149 // Returns the index of |item| in |items|. |
| 150 - (NSInteger)indexOfItem:(const web::NavigationItem*)item; | 150 - (NSInteger)indexOfItem:(const web::NavigationItem*)item; |
| 151 | 151 |
| 152 // Returns the item at |index| in |items|. | 152 // Returns the item at |index| in |items|. |
| 153 - (web::NavigationItemImpl*)itemAtIndex:(NSInteger)index; | 153 - (web::NavigationItemImpl*)itemAtIndex:(NSInteger)index; |
| 154 | 154 |
| 155 @end | 155 @end |
| 156 | 156 |
| 157 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ | 157 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_CONTROLLER_H_ |
| OLD | NEW |