navigation_controller_impl.h revision 116680a4aac90f2aa7413d9095a592090648e557
14b6829f0d28990dd645e16386eb226d0f10c8731shiqian// Copyright 2013 The Chromium Authors. All rights reserved.
24b6829f0d28990dd645e16386eb226d0f10c8731shiqian// Use of this source code is governed by a BSD-style license that can be
34b6829f0d28990dd645e16386eb226d0f10c8731shiqian// found in the LICENSE file.
44b6829f0d28990dd645e16386eb226d0f10c8731shiqian
54b6829f0d28990dd645e16386eb226d0f10c8731shiqian#ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
64b6829f0d28990dd645e16386eb226d0f10c8731shiqian#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
74b6829f0d28990dd645e16386eb226d0f10c8731shiqian
84b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "base/callback.h"
94b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "base/compiler_specific.h"
104b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "base/gtest_prod_util.h"
114b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "base/memory/linked_ptr.h"
124b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "base/time/time.h"
134b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "build/build_config.h"
144b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "content/browser/frame_host/navigation_controller_delegate.h"
154b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "content/browser/ssl/ssl_manager.h"
164b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "content/public/browser/navigation_controller.h"
174b6829f0d28990dd645e16386eb226d0f10c8731shiqian#include "content/public/browser/navigation_type.h"
184b6829f0d28990dd645e16386eb226d0f10c8731shiqian
194b6829f0d28990dd645e16386eb226d0f10c8731shiqianstruct FrameHostMsg_DidCommitProvisionalLoad_Params;
204b6829f0d28990dd645e16386eb226d0f10c8731shiqian
214b6829f0d28990dd645e16386eb226d0f10c8731shiqiannamespace content {
224b6829f0d28990dd645e16386eb226d0f10c8731shiqianclass NavigationEntryImpl;
234b6829f0d28990dd645e16386eb226d0f10c8731shiqianclass RenderViewHost;
244b6829f0d28990dd645e16386eb226d0f10c8731shiqianclass NavigationEntryScreenshotManager;
254b6829f0d28990dd645e16386eb226d0f10c8731shiqianclass SiteInstance;
264b6829f0d28990dd645e16386eb226d0f10c8731shiqianstruct LoadCommittedDetails;
274b6829f0d28990dd645e16386eb226d0f10c8731shiqian
284b6829f0d28990dd645e16386eb226d0f10c8731shiqianclass CONTENT_EXPORT NavigationControllerImpl
294b6829f0d28990dd645e16386eb226d0f10c8731shiqian    : public NON_EXPORTED_BASE(NavigationController) {
304b6829f0d28990dd645e16386eb226d0f10c8731shiqian public:
314b6829f0d28990dd645e16386eb226d0f10c8731shiqian  NavigationControllerImpl(
324b6829f0d28990dd645e16386eb226d0f10c8731shiqian      NavigationControllerDelegate* delegate,
334b6829f0d28990dd645e16386eb226d0f10c8731shiqian      BrowserContext* browser_context);
344b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual ~NavigationControllerImpl();
352620c79810d4741922e9fa89050c0af564994f24zhanyong.wan
360ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  // NavigationController implementation:
370ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual WebContents* GetWebContents() const OVERRIDE;
380ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual BrowserContext* GetBrowserContext() const OVERRIDE;
390ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual void SetBrowserContext(
400ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan      BrowserContext* browser_context) OVERRIDE;
410ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual void Restore(
420ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan      int selected_navigation,
430ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan      RestoreType type,
440ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan      std::vector<NavigationEntry*>* entries) OVERRIDE;
450ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual NavigationEntry* GetActiveEntry() const OVERRIDE;
460ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual NavigationEntry* GetVisibleEntry() const OVERRIDE;
470ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual int GetCurrentEntryIndex() const OVERRIDE;
480ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual NavigationEntry* GetLastCommittedEntry() const OVERRIDE;
499b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  virtual int GetLastCommittedEntryIndex() const OVERRIDE;
500ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual bool CanViewSource() const OVERRIDE;
510ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual int GetEntryCount() const OVERRIDE;
529b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  virtual NavigationEntry* GetEntryAtIndex(int index) const OVERRIDE;
53b0fe69fcbfaa44ae05f6f2429d9c4bbb326b5ea5zhanyong.wan  virtual NavigationEntry* GetEntryAtOffset(int offset) const OVERRIDE;
54c95489ee7dd54fc6a2cd1d3e890c330718ead714zhanyong.wan  virtual void DiscardNonCommittedEntries() OVERRIDE;
55b0fe69fcbfaa44ae05f6f2429d9c4bbb326b5ea5zhanyong.wan  virtual NavigationEntry* GetPendingEntry() const OVERRIDE;
560ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual int GetPendingEntryIndex() const OVERRIDE;
570ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual NavigationEntry* GetTransientEntry() const OVERRIDE;
580ebc16a68eea644a9f8a718fbdef95112a4a0ff2zhanyong.wan  virtual void SetTransientEntry(NavigationEntry* entry) OVERRIDE;
5993fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev  virtual void LoadURL(const GURL& url,
6093fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev                       const Referrer& referrer,
6193fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev                       PageTransition type,
6293fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev                       const std::string& extra_headers) OVERRIDE;
6393fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev  virtual void LoadURLWithParams(const LoadURLParams& params) OVERRIDE;
6493fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev  virtual void LoadIfNecessary() OVERRIDE;
6593fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev  virtual bool CanGoBack() const OVERRIDE;
6693fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev  virtual bool CanGoForward() const OVERRIDE;
6793fed47dbf8e6bc3d39d3f769cb5039551747257vladlosev  virtual bool CanGoToOffset(int offset) const OVERRIDE;
682620c79810d4741922e9fa89050c0af564994f24zhanyong.wan  virtual void GoBack() OVERRIDE;
694b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual void GoForward() OVERRIDE;
704b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual void GoToIndex(int index) OVERRIDE;
714b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual void GoToOffset(int offset) OVERRIDE;
724b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual bool RemoveEntryAtIndex(int index) OVERRIDE;
734b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual const SessionStorageNamespaceMap&
744b6829f0d28990dd645e16386eb226d0f10c8731shiqian      GetSessionStorageNamespaceMap() const OVERRIDE;
754cd62602913a032a7aec091d4c8055ff9af95e37zhanyong.wan  virtual SessionStorageNamespace*
764b6829f0d28990dd645e16386eb226d0f10c8731shiqian      GetDefaultSessionStorageNamespace() OVERRIDE;
774cd62602913a032a7aec091d4c8055ff9af95e37zhanyong.wan  virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE;
784b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual int32 GetMaxRestoredPageID() const OVERRIDE;
794b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual bool NeedsReload() const OVERRIDE;
804b6829f0d28990dd645e16386eb226d0f10c8731shiqian  virtual void SetNeedsReload() OVERRIDE;
81b7ec0f7b3b21338babc9a6ab5a593a40634a8062zhanyong.wan  virtual void CancelPendingReload() OVERRIDE;
82a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void ContinuePendingReload() OVERRIDE;
83a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual bool IsInitialNavigation() const OVERRIDE;
84a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void Reload(bool check_for_repost) OVERRIDE;
85a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE;
86a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void ReloadOriginalRequestURL(bool check_for_repost) OVERRIDE;
87a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void NotifyEntryChanged(const NavigationEntry* entry,
88a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com                                 int index) OVERRIDE;
89a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void CopyStateFrom(
90a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com      const NavigationController& source) OVERRIDE;
91a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void CopyStateFromAndPrune(NavigationController* source,
92a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com                                     bool replace_entry) OVERRIDE;
93a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual bool CanPruneAllButLastCommitted() OVERRIDE;
94a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void PruneAllButLastCommitted() OVERRIDE;
95a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  virtual void ClearAllScreenshots() OVERRIDE;
96a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
97a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Whether this is the initial navigation in an unmodified new tab.  In this
98a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // case, we know there is no content displayed in the page.
99a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  bool IsUnmodifiedBlankTab() const;
100a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
101a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // The session storage namespace that all child RenderViews belonging to
102a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // |instance| should use.
103a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  SessionStorageNamespace* GetSessionStorageNamespace(
104a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com      SiteInstance* instance);
105a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
106a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Returns the index of the specified entry, or -1 if entry is not contained
107a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // in this NavigationController.
108a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  int GetIndexOfEntry(const NavigationEntryImpl* entry) const;
109a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
110a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Return the index of the entry with the corresponding instance and page_id,
111a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // or -1 if not found.
112a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  int GetEntryIndexWithPageID(SiteInstance* instance,
113a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com                              int32 page_id) const;
114a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
115a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Return the entry with the corresponding instance and page_id, or NULL if
116a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // not found.
117a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  NavigationEntryImpl* GetEntryWithPageID(
118a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com      SiteInstance* instance,
119a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com      int32 page_id) const;
120a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
121a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  NavigationControllerDelegate* delegate() const {
122a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com    return delegate_;
123a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  }
124a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
125a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // For use by WebContentsImpl ------------------------------------------------
126a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
127a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Allow renderer-initiated navigations to create a pending entry when the
128a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // provisional load starts.
129a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  void SetPendingEntry(content::NavigationEntryImpl* entry);
130a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
131a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Handles updating the navigation state after the renderer has navigated.
132a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // This is used by the WebContentsImpl.
133a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  //
134a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // If a new entry is created, it will return true and will have filled the
135a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED
136a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // notification. The caller can then use the details without worrying about
137a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // listening for the notification.
138a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  //
139a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // In the case that nothing has changed, the details structure is undefined
140a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // and it will return false.
141a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  bool RendererDidNavigate(
142a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com      RenderFrameHost* rfh,
143a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com      const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
144a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com      LoadCommittedDetails* details);
145a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
146a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Notifies us that we just became active. This is used by the WebContentsImpl
147a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // so that we know to load URLs that were pending as "lazy" loads.
148a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  void SetActive(bool is_active);
149a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com
150a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Returns true if the given URL would be an in-page navigation (i.e. only
151a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // the reference fragment is different) from the "last committed entry". We do
152a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // not compare it against the "active entry" since the active entry can be
153a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // pending and in page navigations only happen on committed pages. If there
154a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // is no last committed entry, then nothing will be in-page.
155a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  //
156a032cfff4091c87a137a8d24ce2eb97c740cf4c8kosak@google.com  // Special note: if the URLs are the same, it does NOT automatically count as
157f6d087b78d230d875bf5d8281112662795044680zhanyong.wan  // an in-page navigation. Neither does an input URL that has no ref, even if
158f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // the rest is the same. This may seem weird, but when we're considering
159f6d087b78d230d875bf5d8281112662795044680zhanyong.wan  // whether a navigation happened without loading anything, the same URL could
160f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // be a reload, while only a different ref would be in-page (pages can't clear
161f6d087b78d230d875bf5d8281112662795044680zhanyong.wan  // refs without reload, only change to "#" which we don't count as empty).
162fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan  //
163fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan  // The situation is made murkier by history.replaceState(), which could
164f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // provide the same URL as part of an in-page navigation, not a reload. So
165f6d087b78d230d875bf5d8281112662795044680zhanyong.wan  // we need to let the (untrustworthy) renderer resolve the ambiguity, but
166fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan  // only when the URLs are on the same origin.
167f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  bool IsURLInPageNavigation(
168f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan      const GURL& url,
169f6d087b78d230d875bf5d8281112662795044680zhanyong.wan      bool renderer_says_in_page,
170fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan      RenderFrameHost* rfh) const;
171f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan
172f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // Sets the SessionStorageNamespace for the given |partition_id|. This is
173f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // used during initialization of a new NavigationController to allow
174f6d087b78d230d875bf5d8281112662795044680zhanyong.wan  // pre-population of the SessionStorageNamespace objects. Session restore,
175f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // prerendering, and the implementaion of window.open() are the primary users
176f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // of this API.
177f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  //
178f6d087b78d230d875bf5d8281112662795044680zhanyong.wan  // Calling this function when a SessionStorageNamespace has already been
179f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  // associated with a |partition_id| will CHECK() fail.
180f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan  void SetSessionStorageNamespace(
181f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan      const std::string& partition_id,
182f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan      SessionStorageNamespace* session_storage_namespace);
183dfbdf0bab51520595679a99710983daba6fc18ebvladlosev
184dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  // Random data ---------------------------------------------------------------
185dfbdf0bab51520595679a99710983daba6fc18ebvladlosev
186dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  SSLManager* ssl_manager() { return &ssl_manager_; }
187dfbdf0bab51520595679a99710983daba6fc18ebvladlosev
188dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  // Maximum number of entries before we start removing entries from the front.
189dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  static void set_max_entry_count_for_testing(size_t max_entry_count) {
190dfbdf0bab51520595679a99710983daba6fc18ebvladlosev    max_entry_count_for_testing_ = max_entry_count;
191dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  }
192dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  static size_t max_entry_count();
193dfbdf0bab51520595679a99710983daba6fc18ebvladlosev
194dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  void SetGetTimestampCallbackForTest(
1954b6829f0d28990dd645e16386eb226d0f10c8731shiqian      const base::Callback<base::Time()>& get_timestamp_callback);
1964b6829f0d28990dd645e16386eb226d0f10c8731shiqian
1974b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // Takes a screenshot of the page at the current state.
198760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  void TakeScreenshot();
199760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian
200760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  // Sets the screenshot manager for this NavigationControllerImpl. The
201760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  // controller takes ownership of the screenshot manager and destroys it when
202fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan  // a new screenshot-manager is set, or when the controller is destroyed.
203dfbdf0bab51520595679a99710983daba6fc18ebvladlosev  // Setting a NULL manager recreates the default screenshot manager and uses
204760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  // that.
205ca6949fd2a0a317fd7c7c48aa86670aac50a48c6shiqian  void SetScreenshotManager(NavigationEntryScreenshotManager* manager);
206760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian
207760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  // Discards only the pending entry.
2084b6829f0d28990dd645e16386eb226d0f10c8731shiqian  void DiscardPendingEntry();
2091cdc76325936ad3312be0d456b4936c8b8e6bf70zhanyong.wan
210760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian private:
211760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  friend class RestoreHelper;
212760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian
213760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest,
2149b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan                           PurgeScreenshot);
215760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, Basic);
216760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, SingleDuplicate);
2179b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ManyDuplicates);
218760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ClockBackwardsJump);
219c95489ee7dd54fc6a2cd1d3e890c330718ead714zhanyong.wan
220b0fe69fcbfaa44ae05f6f2429d9c4bbb326b5ea5zhanyong.wan  // Helper class to smooth out runs of duplicate timestamps while still
221760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  // allowing time to jump backwards.
222760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  class CONTENT_EXPORT TimeSmoother {
223760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian   public:
2244b6829f0d28990dd645e16386eb226d0f10c8731shiqian    // Returns |t| with possibly some time added on.
22521d43d1a7e09d960b790d992f1bb4e92c70391d4shiqian    base::Time GetSmoothedTime(base::Time t);
2261cdc76325936ad3312be0d456b4936c8b8e6bf70zhanyong.wan
227fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan   private:
228678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan    // |low_water_mark_| is the first time in a sequence of adjusted
229dfbdf0bab51520595679a99710983daba6fc18ebvladlosev    // times and |high_water_mark_| is the last.
2301cdc76325936ad3312be0d456b4936c8b8e6bf70zhanyong.wan    base::Time low_water_mark_;
2311cdc76325936ad3312be0d456b4936c8b8e6bf70zhanyong.wan    base::Time high_water_mark_;
232fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan  };
233fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan
2348883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  // Classifies the given renderer navigation (see the NavigationType enum).
2354b6829f0d28990dd645e16386eb226d0f10c8731shiqian  NavigationType ClassifyNavigation(
236678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan      RenderFrameHost* rfh,
237f6d087b78d230d875bf5d8281112662795044680zhanyong.wan      const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const;
238f6d087b78d230d875bf5d8281112662795044680zhanyong.wan
2394b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // Causes the controller to load the specified entry. The function assumes
240678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan  // ownership of the pointer since it is put in the navigation list.
241678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan  // NOTE: Do not pass an entry that the controller already owns!
242e006e686a4230b548709d6ba2d42bfdf4f9f1638vladlosev  void LoadEntry(NavigationEntryImpl* entry);
243678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan
244678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan  // Handlers for the different types of navigation types. They will actually
24593d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan  // handle the navigations corresponding to the different NavClasses above.
2464b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // They will NOT broadcast the commit notification, that should be handled by
247760af5c16f8af7d34b7ef75a0e4d0b18f023f3f3shiqian  // the caller.
24893d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan  //
2498883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  // RendererDidNavigateAutoSubframe is special, it may not actually change
250678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan  // anything if some random subframe is loaded. It will return true if anything
2511cdc76325936ad3312be0d456b4936c8b8e6bf70zhanyong.wan  // changed, or false if not.
252f904a612d9444ab36c07a8e619c113432e046f49vladlosev  //
25393d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan  // The functions taking |did_replace_entry| will fill into the given variable
2549b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // whether the last entry has been replaced or not.
2559b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // See LoadCommittedDetails.did_replace_entry.
256fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  void RendererDidNavigateToNewPage(
2578883b42f2a78976dde09f31ca72806072e33bd5fvladlosev      RenderFrameHost* rfh,
258fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian      const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
259a80f23f103e1a008c1df7ecc68eef9aa4ffbdc37zhanyong.wan      bool replace_entry);
260678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan  void RendererDidNavigateToExistingPage(
2614b6829f0d28990dd645e16386eb226d0f10c8731shiqian      RenderFrameHost* rfh,
262905074c42ba4d0c5b472730b00e43a01d6a50134zhanyong.wan      const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
263678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan  void RendererDidNavigateToSamePage(
264678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan      RenderFrameHost* rfh,
265678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan      const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
266678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan  void RendererDidNavigateInPage(
267678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan      RenderFrameHost* rfh,
268f6d087b78d230d875bf5d8281112662795044680zhanyong.wan      const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
269f0d7f455d0ba1b1da1891c3ee54961a162e8fbc4billydonahue@google.com      bool* did_replace_entry);
270f0d7f455d0ba1b1da1891c3ee54961a162e8fbc4billydonahue@google.com  void RendererDidNavigateNewSubframe(
271678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan      RenderFrameHost* rfh,
272678f92b8f17c8edf1a21efb401c91b355fe7bb2bzhanyong.wan      const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
273905074c42ba4d0c5b472730b00e43a01d6a50134zhanyong.wan  bool RendererDidNavigateAutoSubframe(
274905074c42ba4d0c5b472730b00e43a01d6a50134zhanyong.wan      RenderFrameHost* rfh,
2754b6829f0d28990dd645e16386eb226d0f10c8731shiqian      const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
27693d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan
27793d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan  // Helper function for code shared between Reload() and ReloadIgnoringCache().
2789748de060f19f81fd9dd7ccabf2be4bb624237b5zhanyong.wan  void ReloadInternal(bool check_for_repost, ReloadType reload_type);
2794b6829f0d28990dd645e16386eb226d0f10c8731shiqian
2804b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // Actually issues the navigation held in pending_entry.
281f6d087b78d230d875bf5d8281112662795044680zhanyong.wan  void NavigateToPendingEntry(ReloadType reload_type);
282b7ec0f7b3b21338babc9a6ab5a593a40634a8062zhanyong.wan
28385f555add7acc03149b76db239a4cdd18433a558zhanyong.wan  // Allows the derived class to issue notifications that a load has been
284e006e686a4230b548709d6ba2d42bfdf4f9f1638vladlosev  // committed. This will fill in the active entry to the details structure.
285d9abf3b04db54a8081365ab131aeb0943b5aab36kosak@google.com  void NotifyNavigationEntryCommitted(LoadCommittedDetails* details);
286d9abf3b04db54a8081365ab131aeb0943b5aab36kosak@google.com
287d9abf3b04db54a8081365ab131aeb0943b5aab36kosak@google.com  // Updates the virtual URL of an entry to match a new URL, for cases where
288fff033497b70e96a5dcadb6ba9570c12b5921d74zhanyong.wan  // the real renderer URL is derived from the virtual URL, like view-source:
2891cdc76325936ad3312be0d456b4936c8b8e6bf70zhanyong.wan  void UpdateVirtualURLToURL(NavigationEntryImpl* entry,
290f39160b423e8f90902066cf6774e4180667dcbeezhanyong.wan                             const GURL& new_url);
291f0d7f455d0ba1b1da1891c3ee54961a162e8fbc4billydonahue@google.com
2924b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // Invoked after session/tab restore or cloning a tab. Resets the transition
2935d0c3dc09ece41c649deea59f975d0ff5548424azhanyong.wan  // type of the entries, updates the max page id and creates the active
294cf8a584c9971a7d646d58be41dd3547e62cb538fzhanyong.wan  // contents.
295cf8a584c9971a7d646d58be41dd3547e62cb538fzhanyong.wan  void FinishRestore(int selected_index, RestoreType type);
2965d0c3dc09ece41c649deea59f975d0ff5548424azhanyong.wan
297cf8a584c9971a7d646d58be41dd3547e62cb538fzhanyong.wan  // Inserts a new entry or replaces the current entry with a new one, removing
298f6fb532f0825024feda89c863e33a51b6ff377f5zhanyong.wan  // all entries after it. The new entry will become the active one.
299f6fb532f0825024feda89c863e33a51b6ff377f5zhanyong.wan  void InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace);
300f6fb532f0825024feda89c863e33a51b6ff377f5zhanyong.wan
301f6fb532f0825024feda89c863e33a51b6ff377f5zhanyong.wan  // Removes the entry at |index|, as long as it is not the current entry.
30293d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan  void RemoveEntryAtIndexInternal(int index);
303f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan
304f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan  // Discards both the pending and transient entries.
305f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan  void DiscardNonCommittedEntriesInternal();
306f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan
307f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan  // Discards only the transient entry.
30893d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan  void DiscardTransientEntry();
30993d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cczhanyong.wan
310f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan  // If we have the maximum number of entries, remove the oldest one in
311f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan  // preparation to add another.
312f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan  void PruneOldestEntryIfFull();
313f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan
314f19450f3ad156e1dea624b4d37e645bef067ab5czhanyong.wan  // Removes all entries except the last committed entry.  If there is a new
3154b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // pending navigation it is preserved. In contrast to
3164b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // PruneAllButLastCommitted() this does not update the session history of the
3174b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // RenderView.  Callers must ensure that |CanPruneAllButLastCommitted| returns
3189b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // true before calling this.
3199b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  void PruneAllButLastCommittedInternal();
3209b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3219b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // Returns true if the navigation is likley to be automatic rather than
3229b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // user-initiated.
3239b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  bool IsLikelyAutoNavigation(base::TimeTicks now);
3249b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3259b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // Inserts up to |max_index| entries from |source| into this. This does NOT
3269b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // adjust any of the members that reference entries_
3279b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // (last_committed_entry_index_, pending_entry_index_ or
3289b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // transient_entry_index_).
3299b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  void InsertEntriesFrom(const NavigationControllerImpl& source, int max_index);
3309b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3319b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // Returns the navigation index that differs from the current entry by the
3329b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // specified |offset|.  The index returned is not guaranteed to be valid.
3339b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  int GetIndexForOffset(int offset) const;
3349b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3359b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // ---------------------------------------------------------------------------
3369b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3379b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // The user browser context associated with this controller.
3389b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  BrowserContext* browser_context_;
3399b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3409b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // List of NavigationEntry for this tab
3419b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  typedef std::vector<linked_ptr<NavigationEntryImpl> > NavigationEntries;
3429b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  NavigationEntries entries_;
3439b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3449b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // An entry we haven't gotten a response for yet.  This will be discarded
3459b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // when we navigate again.  It's used only so we know what the currently
3469b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // displayed tab is.
3479b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  //
3489b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // This may refer to an item in the entries_ list if the pending_entry_index_
3499b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // == -1, or it may be its own entry that should be deleted. Be careful with
3509b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // the memory management.
3519b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  NavigationEntryImpl* pending_entry_;
3529b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan
3539b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  // currently visible entry
3549b9794ffb9cfafb94f5def851f76b9a104fcb891zhanyong.wan  int last_committed_entry_index_;
355b7ec0f7b3b21338babc9a6ab5a593a40634a8062zhanyong.wan
356b7ec0f7b3b21338babc9a6ab5a593a40634a8062zhanyong.wan  // index of pending entry if it is in entries_, or -1 if pending_entry_ is a
357b7ec0f7b3b21338babc9a6ab5a593a40634a8062zhanyong.wan  // new entry (created by LoadURL).
358b7ec0f7b3b21338babc9a6ab5a593a40634a8062zhanyong.wan  int pending_entry_index_;
359b7ec0f7b3b21338babc9a6ab5a593a40634a8062zhanyong.wan
360fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // The index for the entry that is shown until a navigation occurs.  This is
361fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // used for interstitial pages. -1 if there are no such entry.
362fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // Note that this entry really appears in the list of entries, but only
363fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // temporarily (until the next navigation).  Any index pointing to an entry
364fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // after the transient entry will become invalid if you navigate forward.
365fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  int transient_entry_index_;
366fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian
367fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // The delegate associated with the controller. Possibly NULL during
368fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // setup.
369fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  NavigationControllerDelegate* delegate_;
370fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian
371fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // The max restored page ID in this controller, if it was restored.  We must
372fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // store this so that WebContentsImpl can tell any renderer in charge of one
373fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // of the restored entries to update its max page ID.
374fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  int32 max_restored_page_id_;
375fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian
376fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // Manages the SSL security UI.
377fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  SSLManager ssl_manager_;
378fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian
379fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // Whether we need to be reloaded when made active.
380fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  bool needs_reload_;
381fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian
382fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // Whether this is the initial navigation.
383fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  // Becomes false when initial navigation commits.
384fe6a9a48c2a8280439e58c2e9020268a80df89b3shiqian  bool is_initial_navigation_;
385f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian
386f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  // Prevent unsafe re-entrant calls to NavigateToPendingEntry.
387f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  bool in_navigate_to_pending_entry_;
38865de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan
389f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  // Used to find the appropriate SessionStorageNamespace for the storage
390f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  // partition of a NavigationEntry.
391f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  //
39265de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  // A NavigationController may contain NavigationEntries that correspond to
39365de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  // different StoragePartitions. Even though they are part of the same
39465de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  // NavigationController, only entries in the same StoragePartition may
39565de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  // share session storage state with one another.
39665de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  SessionStorageNamespaceMap session_storage_namespace_map_;
397f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian
398f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  // The maximum number of entries that a navigation controller can store.
399f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  static size_t max_entry_count_for_testing_;
40065de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan
40165de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE),
40265de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  // NO_RELOAD otherwise.
40365de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan  ReloadType pending_reload_;
40465de7e062b96a0b579ba832ec8e5527528b8fa51zhanyong.wan
405f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  // Used to get timestamps for newly-created navigation entries.
406f0e809a3c9946e99595d4faeb0a16bdc2ca9ffd5shiqian  base::Callback<base::Time()> get_timestamp_callback_;
4078883b42f2a78976dde09f31ca72806072e33bd5fvladlosev
4088883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  // Used to smooth out timestamps from |get_timestamp_callback_|.
4098883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  // Without this, whenever there is a run of redirects or
4108883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  // code-generated navigations, those navigations may occur within
4118883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  // the timer resolution, leading to things sometimes showing up in
4128883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  // the wrong order in the history view.
4138883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  TimeSmoother time_smoother_;
4148883b42f2a78976dde09f31ca72806072e33bd5fvladlosev
4158883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  scoped_ptr<NavigationEntryScreenshotManager> screenshot_manager_;
4168883b42f2a78976dde09f31ca72806072e33bd5fvladlosev
4178883b42f2a78976dde09f31ca72806072e33bd5fvladlosev  DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl);
4188883b42f2a78976dde09f31ca72806072e33bd5fvladlosev};
4198883b42f2a78976dde09f31ca72806072e33bd5fvladlosev
4208883b42f2a78976dde09f31ca72806072e33bd5fvladlosev}  // namespace content
4218883b42f2a78976dde09f31ca72806072e33bd5fvladlosev
4228883b42f2a78976dde09f31ca72806072e33bd5fvladlosev#endif  // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
423f0d7f455d0ba1b1da1891c3ee54961a162e8fbc4billydonahue@google.com