OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // has not been responded to, the NavigationEntry is pending. Once data is | 213 // has not been responded to, the NavigationEntry is pending. Once data is |
214 // received for that entry, that NavigationEntry is committed. | 214 // received for that entry, that NavigationEntry is committed. |
215 | 215 |
216 // A transient entry is an entry that, when the user navigates away, is | 216 // A transient entry is an entry that, when the user navigates away, is |
217 // removed and discarded rather than being added to the back-forward list. | 217 // removed and discarded rather than being added to the back-forward list. |
218 // Transient entries are useful for interstitial pages and the like. | 218 // Transient entries are useful for interstitial pages and the like. |
219 | 219 |
220 // Active entry -------------------------------------------------------------- | 220 // Active entry -------------------------------------------------------------- |
221 | 221 |
222 // THIS IS DEPRECATED. DO NOT USE. Use GetVisibleEntry instead. | 222 // THIS IS DEPRECATED. DO NOT USE. Use GetVisibleEntry instead. |
| 223 // See http://crbug.com/273710. |
223 // | 224 // |
224 // Returns the active entry, which is the transient entry if any, the pending | 225 // Returns the active entry, which is the transient entry if any, the pending |
225 // entry if a navigation is in progress or the last committed entry otherwise. | 226 // entry if a navigation is in progress or the last committed entry otherwise. |
226 // NOTE: This can be NULL!! | 227 // NOTE: This can be NULL!! |
227 // | |
228 // If you are trying to get the current state of the NavigationController, | |
229 // this is the method you will typically want to call. If you want to display | |
230 // the active entry to the user (e.g., in the location bar), use | |
231 // GetVisibleEntry instead. | |
232 virtual NavigationEntry* GetActiveEntry() const = 0; | 228 virtual NavigationEntry* GetActiveEntry() const = 0; |
233 | 229 |
234 // Returns the same entry as GetActiveEntry, except that it ignores pending | 230 // Returns the entry that should be displayed to the user in the address bar. |
235 // history navigation entries. This should be used when displaying info to | 231 // This is the transient entry if any, the pending entry if a navigation is |
236 // the user, so that the location bar and other indicators do not update for | 232 // in progress *and* is safe to display to the user (see below), or the last |
237 // a back/forward navigation until the pending entry commits. This approach | 233 // committed entry otherwise. |
238 // guards against URL spoofs on slow history navigations. | 234 // NOTE: This can be NULL if no entry has committed! |
| 235 // |
| 236 // A pending entry is safe to display if it started in the browser process or |
| 237 // if it's a renderer-initiated navigation in a new tab which hasn't been |
| 238 // accessed by another tab. (If it has been accessed, it risks a URL spoof.) |
239 virtual NavigationEntry* GetVisibleEntry() const = 0; | 239 virtual NavigationEntry* GetVisibleEntry() const = 0; |
240 | 240 |
241 // Returns the index from which we would go back/forward or reload. This is | 241 // Returns the index from which we would go back/forward or reload. This is |
242 // the last_committed_entry_index_ if pending_entry_index_ is -1. Otherwise, | 242 // the last_committed_entry_index_ if pending_entry_index_ is -1. Otherwise, |
243 // it is the pending_entry_index_. | 243 // it is the pending_entry_index_. |
244 virtual int GetCurrentEntryIndex() const = 0; | 244 virtual int GetCurrentEntryIndex() const = 0; |
245 | 245 |
246 // Returns the last committed entry, which may be null if there are no | 246 // Returns the last committed entry, which may be null if there are no |
247 // committed entries. | 247 // committed entries. |
248 virtual NavigationEntry* GetLastCommittedEntry() const = 0; | 248 virtual NavigationEntry* GetLastCommittedEntry() const = 0; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 private: | 447 private: |
448 // This interface should only be implemented inside content. | 448 // This interface should only be implemented inside content. |
449 friend class NavigationControllerImpl; | 449 friend class NavigationControllerImpl; |
450 NavigationController() {} | 450 NavigationController() {} |
451 }; | 451 }; |
452 | 452 |
453 } // namespace content | 453 } // namespace content |
454 | 454 |
455 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 455 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
OLD | NEW |