| 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_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "content/browser/ssl/ssl_manager.h" | 14 #include "content/browser/ssl/ssl_manager.h" |
| 15 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
| 16 #include "content/public/browser/navigation_type.h" | 16 #include "content/public/browser/navigation_type.h" |
| 17 | 17 |
| 18 struct ViewHostMsg_FrameNavigate_Params; | 18 struct ViewHostMsg_FrameNavigate_Params; |
| 19 class WebContentsImpl; | |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 class NavigationEntryImpl; | 21 class NavigationEntryImpl; |
| 22 class WebContentsImpl; |
| 23 class SiteInstance; |
| 23 struct LoadCommittedDetails; | 24 struct LoadCommittedDetails; |
| 24 class SiteInstance; | |
| 25 } | |
| 26 | 25 |
| 27 class CONTENT_EXPORT NavigationControllerImpl | 26 class CONTENT_EXPORT NavigationControllerImpl |
| 28 : public NON_EXPORTED_BASE(content::NavigationController) { | 27 : public NON_EXPORTED_BASE(NavigationController) { |
| 29 public: | 28 public: |
| 30 NavigationControllerImpl( | 29 NavigationControllerImpl( |
| 31 WebContentsImpl* web_contents, | 30 WebContentsImpl* web_contents, |
| 32 content::BrowserContext* browser_context); | 31 BrowserContext* browser_context); |
| 33 virtual ~NavigationControllerImpl(); | 32 virtual ~NavigationControllerImpl(); |
| 34 | 33 |
| 35 // NavigationController implementation: | 34 // NavigationController implementation: |
| 36 virtual content::WebContents* GetWebContents() const OVERRIDE; | 35 virtual WebContents* GetWebContents() const OVERRIDE; |
| 37 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; | 36 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
| 38 virtual void SetBrowserContext( | 37 virtual void SetBrowserContext( |
| 39 content::BrowserContext* browser_context) OVERRIDE; | 38 BrowserContext* browser_context) OVERRIDE; |
| 40 virtual void Restore( | 39 virtual void Restore( |
| 41 int selected_navigation, | 40 int selected_navigation, |
| 42 RestoreType type, | 41 RestoreType type, |
| 43 std::vector<content::NavigationEntry*>* entries) OVERRIDE; | 42 std::vector<NavigationEntry*>* entries) OVERRIDE; |
| 44 virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE; | 43 virtual NavigationEntry* GetActiveEntry() const OVERRIDE; |
| 45 virtual content::NavigationEntry* GetVisibleEntry() const OVERRIDE; | 44 virtual NavigationEntry* GetVisibleEntry() const OVERRIDE; |
| 46 virtual int GetCurrentEntryIndex() const OVERRIDE; | 45 virtual int GetCurrentEntryIndex() const OVERRIDE; |
| 47 virtual content::NavigationEntry* GetLastCommittedEntry() const OVERRIDE; | 46 virtual NavigationEntry* GetLastCommittedEntry() const OVERRIDE; |
| 48 virtual int GetLastCommittedEntryIndex() const OVERRIDE; | 47 virtual int GetLastCommittedEntryIndex() const OVERRIDE; |
| 49 virtual bool CanViewSource() const OVERRIDE; | 48 virtual bool CanViewSource() const OVERRIDE; |
| 50 virtual int GetEntryCount() const OVERRIDE; | 49 virtual int GetEntryCount() const OVERRIDE; |
| 51 virtual content::NavigationEntry* GetEntryAtIndex(int index) const OVERRIDE; | 50 virtual NavigationEntry* GetEntryAtIndex(int index) const OVERRIDE; |
| 52 virtual content::NavigationEntry* GetEntryAtOffset(int offset) const OVERRIDE; | 51 virtual NavigationEntry* GetEntryAtOffset(int offset) const OVERRIDE; |
| 53 virtual void DiscardNonCommittedEntries() OVERRIDE; | 52 virtual void DiscardNonCommittedEntries() OVERRIDE; |
| 54 virtual content::NavigationEntry* GetPendingEntry() const OVERRIDE; | 53 virtual NavigationEntry* GetPendingEntry() const OVERRIDE; |
| 55 virtual int GetPendingEntryIndex() const OVERRIDE; | 54 virtual int GetPendingEntryIndex() const OVERRIDE; |
| 56 virtual content::NavigationEntry* GetTransientEntry() const OVERRIDE; | 55 virtual NavigationEntry* GetTransientEntry() const OVERRIDE; |
| 57 virtual void LoadURL(const GURL& url, | 56 virtual void LoadURL(const GURL& url, |
| 58 const content::Referrer& referrer, | 57 const Referrer& referrer, |
| 59 content::PageTransition type, | 58 PageTransition type, |
| 60 const std::string& extra_headers) OVERRIDE; | 59 const std::string& extra_headers) OVERRIDE; |
| 61 virtual void LoadURLWithParams(const LoadURLParams& params) OVERRIDE; | 60 virtual void LoadURLWithParams(const LoadURLParams& params) OVERRIDE; |
| 62 virtual void LoadIfNecessary() OVERRIDE; | 61 virtual void LoadIfNecessary() OVERRIDE; |
| 63 virtual bool CanGoBack() const OVERRIDE; | 62 virtual bool CanGoBack() const OVERRIDE; |
| 64 virtual bool CanGoForward() const OVERRIDE; | 63 virtual bool CanGoForward() const OVERRIDE; |
| 65 virtual bool CanGoToOffset(int offset) const OVERRIDE; | 64 virtual bool CanGoToOffset(int offset) const OVERRIDE; |
| 66 virtual void GoBack() OVERRIDE; | 65 virtual void GoBack() OVERRIDE; |
| 67 virtual void GoForward() OVERRIDE; | 66 virtual void GoForward() OVERRIDE; |
| 68 virtual void GoToIndex(int index) OVERRIDE; | 67 virtual void GoToIndex(int index) OVERRIDE; |
| 69 virtual void GoToOffset(int offset) OVERRIDE; | 68 virtual void GoToOffset(int offset) OVERRIDE; |
| 70 virtual void RemoveEntryAtIndex(int index) OVERRIDE; | 69 virtual void RemoveEntryAtIndex(int index) OVERRIDE; |
| 71 virtual const content::SessionStorageNamespaceMap& | 70 virtual const SessionStorageNamespaceMap& |
| 72 GetSessionStorageNamespaceMap() const OVERRIDE; | 71 GetSessionStorageNamespaceMap() const OVERRIDE; |
| 73 virtual content::SessionStorageNamespace* | 72 virtual SessionStorageNamespace* |
| 74 GetDefaultSessionStorageNamespace() OVERRIDE; | 73 GetDefaultSessionStorageNamespace() OVERRIDE; |
| 75 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE; | 74 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE; |
| 76 virtual int32 GetMaxRestoredPageID() const OVERRIDE; | 75 virtual int32 GetMaxRestoredPageID() const OVERRIDE; |
| 77 virtual bool NeedsReload() const OVERRIDE; | 76 virtual bool NeedsReload() const OVERRIDE; |
| 78 virtual void CancelPendingReload() OVERRIDE; | 77 virtual void CancelPendingReload() OVERRIDE; |
| 79 virtual void ContinuePendingReload() OVERRIDE; | 78 virtual void ContinuePendingReload() OVERRIDE; |
| 80 virtual bool IsInitialNavigation() OVERRIDE; | 79 virtual bool IsInitialNavigation() OVERRIDE; |
| 81 virtual void Reload(bool check_for_repost) OVERRIDE; | 80 virtual void Reload(bool check_for_repost) OVERRIDE; |
| 82 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE; | 81 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE; |
| 83 virtual void ReloadOriginalRequestURL(bool check_for_repost) OVERRIDE; | 82 virtual void ReloadOriginalRequestURL(bool check_for_repost) OVERRIDE; |
| 84 virtual void NotifyEntryChanged(const content::NavigationEntry* entry, | 83 virtual void NotifyEntryChanged(const NavigationEntry* entry, |
| 85 int index) OVERRIDE; | 84 int index) OVERRIDE; |
| 86 virtual void CopyStateFrom( | 85 virtual void CopyStateFrom( |
| 87 const content::NavigationController& source) OVERRIDE; | 86 const NavigationController& source) OVERRIDE; |
| 88 virtual void CopyStateFromAndPrune( | 87 virtual void CopyStateFromAndPrune( |
| 89 content::NavigationController* source) OVERRIDE; | 88 NavigationController* source) OVERRIDE; |
| 90 virtual void PruneAllButActive() OVERRIDE; | 89 virtual void PruneAllButActive() OVERRIDE; |
| 91 | 90 |
| 92 // The session storage namespace that all child RenderViews belonging to | 91 // The session storage namespace that all child RenderViews belonging to |
| 93 // |instance| should use. | 92 // |instance| should use. |
| 94 content::SessionStorageNamespace* GetSessionStorageNamespace( | 93 SessionStorageNamespace* GetSessionStorageNamespace( |
| 95 content::SiteInstance* instance); | 94 SiteInstance* instance); |
| 96 | 95 |
| 97 // Returns the index of the specified entry, or -1 if entry is not contained | 96 // Returns the index of the specified entry, or -1 if entry is not contained |
| 98 // in this NavigationController. | 97 // in this NavigationController. |
| 99 int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const; | 98 int GetIndexOfEntry(const NavigationEntryImpl* entry) const; |
| 100 | 99 |
| 101 // Return the index of the entry with the corresponding instance and page_id, | 100 // Return the index of the entry with the corresponding instance and page_id, |
| 102 // or -1 if not found. | 101 // or -1 if not found. |
| 103 int GetEntryIndexWithPageID(content::SiteInstance* instance, | 102 int GetEntryIndexWithPageID(SiteInstance* instance, |
| 104 int32 page_id) const; | 103 int32 page_id) const; |
| 105 | 104 |
| 106 // Return the entry with the corresponding instance and page_id, or NULL if | 105 // Return the entry with the corresponding instance and page_id, or NULL if |
| 107 // not found. | 106 // not found. |
| 108 content::NavigationEntryImpl* GetEntryWithPageID( | 107 NavigationEntryImpl* GetEntryWithPageID( |
| 109 content::SiteInstance* instance, | 108 SiteInstance* instance, |
| 110 int32 page_id) const; | 109 int32 page_id) const; |
| 111 | 110 |
| 112 // Transient entry ----------------------------------------------------------- | 111 // Transient entry ----------------------------------------------------------- |
| 113 | 112 |
| 114 // Adds an entry that is returned by GetActiveEntry(). The entry is | 113 // Adds an entry that is returned by GetActiveEntry(). The entry is |
| 115 // transient: any navigation causes it to be removed and discarded. | 114 // transient: any navigation causes it to be removed and discarded. |
| 116 // The NavigationController becomes the owner of |entry| and deletes it when | 115 // The NavigationController becomes the owner of |entry| and deletes it when |
| 117 // it discards it. This is useful with interstitial page that need to be | 116 // it discards it. This is useful with interstitial page that need to be |
| 118 // represented as an entry, but should go away when the user navigates away | 117 // represented as an entry, but should go away when the user navigates away |
| 119 // from them. | 118 // from them. |
| 120 // Note that adding a transient entry does not change the active contents. | 119 // Note that adding a transient entry does not change the active contents. |
| 121 void AddTransientEntry(content::NavigationEntryImpl* entry); | 120 void AddTransientEntry(NavigationEntryImpl* entry); |
| 122 | 121 |
| 123 // WebContentsImpl ----------------------------------------------------------- | 122 // WebContentsImpl ----------------------------------------------------------- |
| 124 | 123 |
| 125 WebContentsImpl* web_contents() const { | 124 WebContentsImpl* web_contents() const { |
| 126 return web_contents_; | 125 return web_contents_; |
| 127 } | 126 } |
| 128 | 127 |
| 129 // Called when a document has been loaded in a frame. | 128 // Called when a document has been loaded in a frame. |
| 130 void DocumentLoadedInFrame(); | 129 void DocumentLoadedInFrame(); |
| 131 | 130 |
| 132 // For use by WebContentsImpl ------------------------------------------------ | 131 // For use by WebContentsImpl ------------------------------------------------ |
| 133 | 132 |
| 134 // Handles updating the navigation state after the renderer has navigated. | 133 // Handles updating the navigation state after the renderer has navigated. |
| 135 // This is used by the WebContentsImpl. | 134 // This is used by the WebContentsImpl. |
| 136 // | 135 // |
| 137 // If a new entry is created, it will return true and will have filled the | 136 // If a new entry is created, it will return true and will have filled the |
| 138 // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED | 137 // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED |
| 139 // notification. The caller can then use the details without worrying about | 138 // notification. The caller can then use the details without worrying about |
| 140 // listening for the notification. | 139 // listening for the notification. |
| 141 // | 140 // |
| 142 // In the case that nothing has changed, the details structure is undefined | 141 // In the case that nothing has changed, the details structure is undefined |
| 143 // and it will return false. | 142 // and it will return false. |
| 144 bool RendererDidNavigate(const ViewHostMsg_FrameNavigate_Params& params, | 143 bool RendererDidNavigate(const ViewHostMsg_FrameNavigate_Params& params, |
| 145 content::LoadCommittedDetails* details); | 144 LoadCommittedDetails* details); |
| 146 | 145 |
| 147 // Notifies us that we just became active. This is used by the WebContentsImpl | 146 // Notifies us that we just became active. This is used by the WebContentsImpl |
| 148 // so that we know to load URLs that were pending as "lazy" loads. | 147 // so that we know to load URLs that were pending as "lazy" loads. |
| 149 void SetActive(bool is_active); | 148 void SetActive(bool is_active); |
| 150 | 149 |
| 151 // Returns true if the given URL would be an in-page navigation (i.e. only | 150 // Returns true if the given URL would be an in-page navigation (i.e. only |
| 152 // the reference fragment is different) from the "last committed entry". We do | 151 // the reference fragment is different) from the "last committed entry". We do |
| 153 // not compare it against the "active entry" since the active entry can be | 152 // not compare it against the "active entry" since the active entry can be |
| 154 // pending and in page navigations only happen on committed pages. If there | 153 // pending and in page navigations only happen on committed pages. If there |
| 155 // is no last committed entry, then nothing will be in-page. | 154 // is no last committed entry, then nothing will be in-page. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 174 // Sets the SessionStorageNamespace for the given |partition_id|. This is | 173 // Sets the SessionStorageNamespace for the given |partition_id|. This is |
| 175 // used during initialization of a new NavigationController to allow | 174 // used during initialization of a new NavigationController to allow |
| 176 // pre-population of the SessionStorageNamespace objects. Session restore, | 175 // pre-population of the SessionStorageNamespace objects. Session restore, |
| 177 // prerendering, and the implementaion of window.open() are the primary users | 176 // prerendering, and the implementaion of window.open() are the primary users |
| 178 // of this API. | 177 // of this API. |
| 179 // | 178 // |
| 180 // Calling this function when a SessionStorageNamespace has already been | 179 // Calling this function when a SessionStorageNamespace has already been |
| 181 // associated with a |partition_id| will CHECK() fail. | 180 // associated with a |partition_id| will CHECK() fail. |
| 182 void SetSessionStorageNamespace( | 181 void SetSessionStorageNamespace( |
| 183 const std::string& partition_id, | 182 const std::string& partition_id, |
| 184 content::SessionStorageNamespace* session_storage_namespace); | 183 SessionStorageNamespace* session_storage_namespace); |
| 185 | 184 |
| 186 // Random data --------------------------------------------------------------- | 185 // Random data --------------------------------------------------------------- |
| 187 | 186 |
| 188 SSLManager* ssl_manager() { return &ssl_manager_; } | 187 SSLManager* ssl_manager() { return &ssl_manager_; } |
| 189 | 188 |
| 190 // Maximum number of entries before we start removing entries from the front. | 189 // Maximum number of entries before we start removing entries from the front. |
| 191 static void set_max_entry_count_for_testing(size_t max_entry_count) { | 190 static void set_max_entry_count_for_testing(size_t max_entry_count) { |
| 192 max_entry_count_for_testing_ = max_entry_count; | 191 max_entry_count_for_testing_ = max_entry_count; |
| 193 } | 192 } |
| 194 static size_t max_entry_count(); | 193 static size_t max_entry_count(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 215 base::Time GetSmoothedTime(base::Time t); | 214 base::Time GetSmoothedTime(base::Time t); |
| 216 | 215 |
| 217 private: | 216 private: |
| 218 // |low_water_mark_| is the first time in a sequence of adjusted | 217 // |low_water_mark_| is the first time in a sequence of adjusted |
| 219 // times and |high_water_mark_| is the last. | 218 // times and |high_water_mark_| is the last. |
| 220 base::Time low_water_mark_; | 219 base::Time low_water_mark_; |
| 221 base::Time high_water_mark_; | 220 base::Time high_water_mark_; |
| 222 }; | 221 }; |
| 223 | 222 |
| 224 // Classifies the given renderer navigation (see the NavigationType enum). | 223 // Classifies the given renderer navigation (see the NavigationType enum). |
| 225 content::NavigationType ClassifyNavigation( | 224 NavigationType ClassifyNavigation( |
| 226 const ViewHostMsg_FrameNavigate_Params& params) const; | 225 const ViewHostMsg_FrameNavigate_Params& params) const; |
| 227 | 226 |
| 228 // Causes the controller to load the specified entry. The function assumes | 227 // Causes the controller to load the specified entry. The function assumes |
| 229 // ownership of the pointer since it is put in the navigation list. | 228 // ownership of the pointer since it is put in the navigation list. |
| 230 // NOTE: Do not pass an entry that the controller already owns! | 229 // NOTE: Do not pass an entry that the controller already owns! |
| 231 void LoadEntry(content::NavigationEntryImpl* entry); | 230 void LoadEntry(NavigationEntryImpl* entry); |
| 232 | 231 |
| 233 // Handlers for the different types of navigation types. They will actually | 232 // Handlers for the different types of navigation types. They will actually |
| 234 // handle the navigations corresponding to the different NavClasses above. | 233 // handle the navigations corresponding to the different NavClasses above. |
| 235 // They will NOT broadcast the commit notification, that should be handled by | 234 // They will NOT broadcast the commit notification, that should be handled by |
| 236 // the caller. | 235 // the caller. |
| 237 // | 236 // |
| 238 // RendererDidNavigateAutoSubframe is special, it may not actually change | 237 // RendererDidNavigateAutoSubframe is special, it may not actually change |
| 239 // anything if some random subframe is loaded. It will return true if anything | 238 // anything if some random subframe is loaded. It will return true if anything |
| 240 // changed, or false if not. | 239 // changed, or false if not. |
| 241 // | 240 // |
| (...skipping 14 matching lines...) Expand all Loading... |
| 256 const ViewHostMsg_FrameNavigate_Params& params); | 255 const ViewHostMsg_FrameNavigate_Params& params); |
| 257 | 256 |
| 258 // Helper function for code shared between Reload() and ReloadIgnoringCache(). | 257 // Helper function for code shared between Reload() and ReloadIgnoringCache(). |
| 259 void ReloadInternal(bool check_for_repost, ReloadType reload_type); | 258 void ReloadInternal(bool check_for_repost, ReloadType reload_type); |
| 260 | 259 |
| 261 // Actually issues the navigation held in pending_entry. | 260 // Actually issues the navigation held in pending_entry. |
| 262 void NavigateToPendingEntry(ReloadType reload_type); | 261 void NavigateToPendingEntry(ReloadType reload_type); |
| 263 | 262 |
| 264 // Allows the derived class to issue notifications that a load has been | 263 // Allows the derived class to issue notifications that a load has been |
| 265 // committed. This will fill in the active entry to the details structure. | 264 // committed. This will fill in the active entry to the details structure. |
| 266 void NotifyNavigationEntryCommitted(content::LoadCommittedDetails* details); | 265 void NotifyNavigationEntryCommitted(LoadCommittedDetails* details); |
| 267 | 266 |
| 268 // Updates the virtual URL of an entry to match a new URL, for cases where | 267 // Updates the virtual URL of an entry to match a new URL, for cases where |
| 269 // the real renderer URL is derived from the virtual URL, like view-source: | 268 // the real renderer URL is derived from the virtual URL, like view-source: |
| 270 void UpdateVirtualURLToURL(content::NavigationEntryImpl* entry, | 269 void UpdateVirtualURLToURL(NavigationEntryImpl* entry, |
| 271 const GURL& new_url); | 270 const GURL& new_url); |
| 272 | 271 |
| 273 // Invoked after session/tab restore or cloning a tab. Resets the transition | 272 // Invoked after session/tab restore or cloning a tab. Resets the transition |
| 274 // type of the entries, updates the max page id and creates the active | 273 // type of the entries, updates the max page id and creates the active |
| 275 // contents. | 274 // contents. |
| 276 void FinishRestore(int selected_index, RestoreType type); | 275 void FinishRestore(int selected_index, RestoreType type); |
| 277 | 276 |
| 278 // Inserts a new entry or replaces the current entry with a new one, removing | 277 // Inserts a new entry or replaces the current entry with a new one, removing |
| 279 // all entries after it. The new entry will become the active one. | 278 // all entries after it. The new entry will become the active one. |
| 280 void InsertOrReplaceEntry(content::NavigationEntryImpl* entry, bool replace); | 279 void InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace); |
| 281 | 280 |
| 282 // Removes the entry at |index|, as long as it is not the current entry. | 281 // Removes the entry at |index|, as long as it is not the current entry. |
| 283 void RemoveEntryAtIndexInternal(int index); | 282 void RemoveEntryAtIndexInternal(int index); |
| 284 | 283 |
| 285 // Discards the pending and transient entries. | 284 // Discards the pending and transient entries. |
| 286 void DiscardNonCommittedEntriesInternal(); | 285 void DiscardNonCommittedEntriesInternal(); |
| 287 | 286 |
| 288 // Discards the transient entry. | 287 // Discards the transient entry. |
| 289 void DiscardTransientEntry(); | 288 void DiscardTransientEntry(); |
| 290 | 289 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 305 // transient_entry_index_). | 304 // transient_entry_index_). |
| 306 void InsertEntriesFrom(const NavigationControllerImpl& source, int max_index); | 305 void InsertEntriesFrom(const NavigationControllerImpl& source, int max_index); |
| 307 | 306 |
| 308 // Returns the navigation index that differs from the current entry by the | 307 // Returns the navigation index that differs from the current entry by the |
| 309 // specified |offset|. The index returned is not guaranteed to be valid. | 308 // specified |offset|. The index returned is not guaranteed to be valid. |
| 310 int GetIndexForOffset(int offset) const; | 309 int GetIndexForOffset(int offset) const; |
| 311 | 310 |
| 312 // --------------------------------------------------------------------------- | 311 // --------------------------------------------------------------------------- |
| 313 | 312 |
| 314 // The user browser context associated with this controller. | 313 // The user browser context associated with this controller. |
| 315 content::BrowserContext* browser_context_; | 314 BrowserContext* browser_context_; |
| 316 | 315 |
| 317 // List of NavigationEntry for this tab | 316 // List of NavigationEntry for this tab |
| 318 typedef std::vector<linked_ptr<content::NavigationEntryImpl> > | 317 typedef std::vector<linked_ptr<NavigationEntryImpl> > NavigationEntries; |
| 319 NavigationEntries; | |
| 320 NavigationEntries entries_; | 318 NavigationEntries entries_; |
| 321 | 319 |
| 322 // An entry we haven't gotten a response for yet. This will be discarded | 320 // An entry we haven't gotten a response for yet. This will be discarded |
| 323 // when we navigate again. It's used only so we know what the currently | 321 // when we navigate again. It's used only so we know what the currently |
| 324 // displayed tab is. | 322 // displayed tab is. |
| 325 // | 323 // |
| 326 // This may refer to an item in the entries_ list if the pending_entry_index_ | 324 // This may refer to an item in the entries_ list if the pending_entry_index_ |
| 327 // == -1, or it may be its own entry that should be deleted. Be careful with | 325 // == -1, or it may be its own entry that should be deleted. Be careful with |
| 328 // the memory management. | 326 // the memory management. |
| 329 content::NavigationEntryImpl* pending_entry_; | 327 NavigationEntryImpl* pending_entry_; |
| 330 | 328 |
| 331 // currently visible entry | 329 // currently visible entry |
| 332 int last_committed_entry_index_; | 330 int last_committed_entry_index_; |
| 333 | 331 |
| 334 // index of pending entry if it is in entries_, or -1 if pending_entry_ is a | 332 // index of pending entry if it is in entries_, or -1 if pending_entry_ is a |
| 335 // new entry (created by LoadURL). | 333 // new entry (created by LoadURL). |
| 336 int pending_entry_index_; | 334 int pending_entry_index_; |
| 337 | 335 |
| 338 // The index for the entry that is shown until a navigation occurs. This is | 336 // The index for the entry that is shown until a navigation occurs. This is |
| 339 // used for interstitial pages. -1 if there are no such entry. | 337 // used for interstitial pages. -1 if there are no such entry. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 361 // Becomes false when initial navigation is loaded. | 359 // Becomes false when initial navigation is loaded. |
| 362 bool is_initial_navigation_; | 360 bool is_initial_navigation_; |
| 363 | 361 |
| 364 // Used to find the appropriate SessionStorageNamespace for the storage | 362 // Used to find the appropriate SessionStorageNamespace for the storage |
| 365 // partition of a NavigationEntry. | 363 // partition of a NavigationEntry. |
| 366 // | 364 // |
| 367 // A NavigationController may contain NavigationEntries that correspond to | 365 // A NavigationController may contain NavigationEntries that correspond to |
| 368 // different StoragePartitions. Even though they are part of the same | 366 // different StoragePartitions. Even though they are part of the same |
| 369 // NavigationController, only entries in the same StoragePartition may | 367 // NavigationController, only entries in the same StoragePartition may |
| 370 // share session storage state with one another. | 368 // share session storage state with one another. |
| 371 content::SessionStorageNamespaceMap session_storage_namespace_map_; | 369 SessionStorageNamespaceMap session_storage_namespace_map_; |
| 372 | 370 |
| 373 // The maximum number of entries that a navigation controller can store. | 371 // The maximum number of entries that a navigation controller can store. |
| 374 static size_t max_entry_count_for_testing_; | 372 static size_t max_entry_count_for_testing_; |
| 375 | 373 |
| 376 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE), | 374 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE), |
| 377 // NO_RELOAD otherwise. | 375 // NO_RELOAD otherwise. |
| 378 ReloadType pending_reload_; | 376 ReloadType pending_reload_; |
| 379 | 377 |
| 380 // Used to get timestamps for newly-created navigation entries. | 378 // Used to get timestamps for newly-created navigation entries. |
| 381 base::Callback<base::Time()> get_timestamp_callback_; | 379 base::Callback<base::Time()> get_timestamp_callback_; |
| 382 | 380 |
| 383 // Used to smooth out timestamps from |get_timestamp_callback_|. | 381 // Used to smooth out timestamps from |get_timestamp_callback_|. |
| 384 // Without this, whenever there is a run of redirects or | 382 // Without this, whenever there is a run of redirects or |
| 385 // code-generated navigations, those navigations may occur within | 383 // code-generated navigations, those navigations may occur within |
| 386 // the timer resolution, leading to things sometimes showing up in | 384 // the timer resolution, leading to things sometimes showing up in |
| 387 // the wrong order in the history view. | 385 // the wrong order in the history view. |
| 388 TimeSmoother time_smoother_; | 386 TimeSmoother time_smoother_; |
| 389 | 387 |
| 390 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); | 388 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); |
| 391 }; | 389 }; |
| 392 | 390 |
| 391 } // namespace content |
| 392 |
| 393 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ | 393 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ |
| OLD | NEW |