| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PUBLIC_NAVIGATION_MANAGER_H_ | 5 #ifndef IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ |
| 6 #define IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ | 6 #define IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 // Adds |rewriter| to a transient list of URL rewriters. Transient URL | 106 // Adds |rewriter| to a transient list of URL rewriters. Transient URL |
| 107 // rewriters will be executed before the rewriters already added to the | 107 // rewriters will be executed before the rewriters already added to the |
| 108 // BrowserURLRewriter singleton, and the list will be cleared after the next | 108 // BrowserURLRewriter singleton, and the list will be cleared after the next |
| 109 // attempted page load. |rewriter| must not be null. | 109 // attempted page load. |rewriter| must not be null. |
| 110 virtual void AddTransientURLRewriter( | 110 virtual void AddTransientURLRewriter( |
| 111 BrowserURLRewriter::URLRewriter rewriter) = 0; | 111 BrowserURLRewriter::URLRewriter rewriter) = 0; |
| 112 | 112 |
| 113 // Returns the number of items in the NavigationManager, excluding | 113 // Returns the number of items in the NavigationManager, excluding |
| 114 // pending and transient entries. | 114 // pending and transient entries. |
| 115 // TODO(crbug.com/533848): Update to return size_t. |
| 115 virtual int GetItemCount() const = 0; | 116 virtual int GetItemCount() const = 0; |
| 116 | 117 |
| 117 // Returns the committed NavigationItem at |index|. | 118 // Returns the committed NavigationItem at |index|. |
| 118 virtual NavigationItem* GetItemAtIndex(size_t index) const = 0; | 119 virtual NavigationItem* GetItemAtIndex(size_t index) const = 0; |
| 119 | 120 |
| 120 // Returns the index from which web would go back/forward or reload. | 121 // Returns the index from which web would go back/forward or reload. |
| 122 // TODO(crbug.com/533848): Update to return size_t. |
| 121 virtual int GetCurrentItemIndex() const = 0; | 123 virtual int GetCurrentItemIndex() const = 0; |
| 122 | 124 |
| 123 // Returns the index of the last committed item or -1 if the last | 125 // Returns the index of the last committed item or -1 if the last |
| 124 // committed item correspond to a new navigation. | 126 // committed item correspond to a new navigation. |
| 127 // TODO(crbug.com/533848): Update to return size_t. |
| 125 virtual int GetLastCommittedItemIndex() const = 0; | 128 virtual int GetLastCommittedItemIndex() const = 0; |
| 126 | 129 |
| 127 // Returns the index of the pending item or -1 if the pending item | 130 // Returns the index of the pending item or -1 if the pending item |
| 128 // corresponds to a new navigation. | 131 // corresponds to a new navigation. |
| 132 // TODO(crbug.com/533848): Update to return size_t. |
| 129 virtual int GetPendingItemIndex() const = 0; | 133 virtual int GetPendingItemIndex() const = 0; |
| 130 | 134 |
| 131 // Removes the item at the specified |index|. If the index is the last | 135 // Removes the item at the specified |index|. If the index is the last |
| 132 // committed index or the pending item, this does nothing and returns false. | 136 // committed index or the pending item, this does nothing and returns false. |
| 133 // Otherwise this call discards any transient or pending entries. | 137 // Otherwise this call discards any transient or pending entries. |
| 138 // TODO(crbug.com/533848): Update to use size_t. |
| 134 virtual bool RemoveItemAtIndex(int index) = 0; | 139 virtual bool RemoveItemAtIndex(int index) = 0; |
| 135 | 140 |
| 136 // Navigation relative to the current item. | 141 // Navigation relative to the current item. |
| 137 virtual bool CanGoBack() const = 0; | 142 virtual bool CanGoBack() const = 0; |
| 138 virtual bool CanGoForward() const = 0; | 143 virtual bool CanGoForward() const = 0; |
| 139 virtual bool CanGoToOffset(int offset) const = 0; | 144 virtual bool CanGoToOffset(int offset) const = 0; |
| 140 virtual void GoBack() = 0; | 145 virtual void GoBack() = 0; |
| 141 virtual void GoForward() = 0; | 146 virtual void GoForward() = 0; |
| 142 | 147 |
| 143 // Navigates to the specified absolute index. | 148 // Navigates to the specified absolute index. |
| 149 // TODO(crbug.com/533848): Update to use size_t. |
| 144 virtual void GoToIndex(int index) = 0; | 150 virtual void GoToIndex(int index) = 0; |
| 145 | 151 |
| 146 // Reloads the current item. If |check_for_repost| is true and the current | 152 // Reloads the current item. If |check_for_repost| is true and the current |
| 147 // item has POST data the user is prompted to see if they really want to | 153 // item has POST data the user is prompted to see if they really want to |
| 148 // reload the page. In nearly all cases pass in true. If a transient item is | 154 // reload the page. In nearly all cases pass in true. If a transient item is |
| 149 // showing, initiates a new navigation to its URL. | 155 // showing, initiates a new navigation to its URL. |
| 150 virtual void Reload(bool check_for_repost) = 0; | 156 virtual void Reload(bool check_for_repost) = 0; |
| 151 | 157 |
| 152 // Forces the pending item to be loaded using desktop user agent. Note that | 158 // Forces the pending item to be loaded using desktop user agent. Note that |
| 153 // the pending item may or may not already exist. | 159 // the pending item may or may not already exist. |
| 154 // TODO(crbug.com/692303): Remove this when overriding the user agent doesn't | 160 // TODO(crbug.com/692303): Remove this when overriding the user agent doesn't |
| 155 // create a new NavigationItem. | 161 // create a new NavigationItem. |
| 156 virtual void OverrideDesktopUserAgentForNextPendingItem() = 0; | 162 virtual void OverrideDesktopUserAgentForNextPendingItem() = 0; |
| 157 }; | 163 }; |
| 158 | 164 |
| 159 } // namespace web | 165 } // namespace web |
| 160 | 166 |
| 161 #endif // IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ | 167 #endif // IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ |
| OLD | NEW |