11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
51e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
61e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/callback.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/gtest_prod_util.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/linked_ptr.h"
12eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/time/time.h"
13eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "build/build_config.h"
141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "content/browser/frame_host/navigation_controller_delegate.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/ssl/ssl_manager.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/navigation_controller.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/navigation_type.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct ViewHostMsg_FrameNavigate_Params;
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NavigationEntryImpl;
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class RenderViewHost;
24f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class NavigationEntryScreenshotManager;
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SiteInstance;
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct LoadCommittedDetails;
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CONTENT_EXPORT NavigationControllerImpl
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    : public NON_EXPORTED_BASE(NavigationController) {
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NavigationControllerImpl(
321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      NavigationControllerDelegate* delegate,
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      BrowserContext* browser_context);
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~NavigationControllerImpl();
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NavigationController implementation:
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual WebContents* GetWebContents() const OVERRIDE;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual BrowserContext* GetBrowserContext() const OVERRIDE;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetBrowserContext(
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      BrowserContext* browser_context) OVERRIDE;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Restore(
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      int selected_navigation,
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      RestoreType type,
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      std::vector<NavigationEntry*>* entries) OVERRIDE;
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NavigationEntry* GetActiveEntry() const OVERRIDE;
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NavigationEntry* GetVisibleEntry() const OVERRIDE;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetCurrentEntryIndex() const OVERRIDE;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NavigationEntry* GetLastCommittedEntry() const OVERRIDE;
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetLastCommittedEntryIndex() const OVERRIDE;
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanViewSource() const OVERRIDE;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetEntryCount() const OVERRIDE;
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NavigationEntry* GetEntryAtIndex(int index) const OVERRIDE;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NavigationEntry* GetEntryAtOffset(int offset) const OVERRIDE;
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void DiscardNonCommittedEntries() OVERRIDE;
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NavigationEntry* GetPendingEntry() const OVERRIDE;
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetPendingEntryIndex() const OVERRIDE;
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NavigationEntry* GetTransientEntry() const OVERRIDE;
582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void SetTransientEntry(NavigationEntry* entry) OVERRIDE;
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void LoadURL(const GURL& url,
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       const Referrer& referrer,
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       PageTransition type,
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       const std::string& extra_headers) OVERRIDE;
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void LoadURLWithParams(const LoadURLParams& params) OVERRIDE;
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void LoadIfNecessary() OVERRIDE;
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanGoBack() const OVERRIDE;
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanGoForward() const OVERRIDE;
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanGoToOffset(int offset) const OVERRIDE;
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GoBack() OVERRIDE;
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GoForward() OVERRIDE;
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GoToIndex(int index) OVERRIDE;
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GoToOffset(int offset) OVERRIDE;
72a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch  virtual bool RemoveEntryAtIndex(int index) OVERRIDE;
73ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  virtual const SessionStorageNamespaceMap&
74ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      GetSessionStorageNamespaceMap() const OVERRIDE;
75ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  virtual SessionStorageNamespace*
76ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      GetDefaultSessionStorageNamespace() OVERRIDE;
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE;
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int32 GetMaxRestoredPageID() const OVERRIDE;
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool NeedsReload() const OVERRIDE;
804e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void SetNeedsReload() OVERRIDE;
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void CancelPendingReload() OVERRIDE;
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ContinuePendingReload() OVERRIDE;
832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual bool IsInitialNavigation() const OVERRIDE;
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Reload(bool check_for_repost) OVERRIDE;
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE;
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ReloadOriginalRequestURL(bool check_for_repost) OVERRIDE;
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void NotifyEntryChanged(const NavigationEntry* entry,
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                 int index) OVERRIDE;
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void CopyStateFrom(
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const NavigationController& source) OVERRIDE;
91d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)  virtual void CopyStateFromAndPrune(NavigationController* source,
92d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)                                     bool replace_entry) OVERRIDE;
93f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual bool CanPruneAllButLastCommitted() OVERRIDE;
94f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void PruneAllButLastCommitted() OVERRIDE;
952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void ClearAllScreenshots() OVERRIDE;
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
97ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // The session storage namespace that all child RenderViews belonging to
98ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // |instance| should use.
99ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  SessionStorageNamespace* GetSessionStorageNamespace(
100ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      SiteInstance* instance);
101ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the index of the specified entry, or -1 if entry is not contained
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in this NavigationController.
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int GetIndexOfEntry(const NavigationEntryImpl* entry) const;
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Return the index of the entry with the corresponding instance and page_id,
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // or -1 if not found.
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int GetEntryIndexWithPageID(SiteInstance* instance,
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                              int32 page_id) const;
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Return the entry with the corresponding instance and page_id, or NULL if
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // not found.
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NavigationEntryImpl* GetEntryWithPageID(
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      SiteInstance* instance,
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      int32 page_id) const;
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  NavigationControllerDelegate* delegate() const {
1181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    return delegate_;
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // For use by WebContentsImpl ------------------------------------------------
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
123868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Allow renderer-initiated navigations to create a pending entry when the
124868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // provisional load starts.
125868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  void SetPendingEntry(content::NavigationEntryImpl* entry);
126868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Handles updating the navigation state after the renderer has navigated.
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is used by the WebContentsImpl.
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If a new entry is created, it will return true and will have filled the
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // notification. The caller can then use the details without worrying about
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // listening for the notification.
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // In the case that nothing has changed, the details structure is undefined
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // and it will return false.
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool RendererDidNavigate(const ViewHostMsg_FrameNavigate_Params& params,
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                           LoadCommittedDetails* details);
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notifies us that we just became active. This is used by the WebContentsImpl
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // so that we know to load URLs that were pending as "lazy" loads.
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetActive(bool is_active);
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the given URL would be an in-page navigation (i.e. only
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the reference fragment is different) from the "last committed entry". We do
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // not compare it against the "active entry" since the active entry can be
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // pending and in page navigations only happen on committed pages. If there
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // is no last committed entry, then nothing will be in-page.
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Special note: if the URLs are the same, it does NOT automatically count as
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // an in-page navigation. Neither does an input URL that has no ref, even if
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the rest is the same. This may seem weird, but when we're considering
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // whether a navigation happened without loading anything, the same URL could
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be a reload, while only a different ref would be in-page (pages can't clear
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // refs without reload, only change to "#" which we don't count as empty).
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsURLInPageNavigation(const GURL& url) const {
157bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch    return IsURLInPageNavigation(url, false, NAVIGATION_TYPE_UNKNOWN);
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The situation is made murkier by history.replaceState(), which could
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // provide the same URL as part of an in-page navigation, not a reload. So
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // we need this form which lets the (untrustworthy) renderer resolve the
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ambiguity, but only when the URLs are equal. This should be safe since the
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // origin isn't changing.
165bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  bool IsURLInPageNavigation(
166bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch      const GURL& url,
167bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch      bool renderer_says_in_page,
168bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch      NavigationType navigation_type) const;
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
170ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // Sets the SessionStorageNamespace for the given |partition_id|. This is
171ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // used during initialization of a new NavigationController to allow
172ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // pre-population of the SessionStorageNamespace objects. Session restore,
173ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // prerendering, and the implementaion of window.open() are the primary users
174ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // of this API.
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calling this function when a SessionStorageNamespace has already been
177ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // associated with a |partition_id| will CHECK() fail.
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetSessionStorageNamespace(
179ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      const std::string& partition_id,
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      SessionStorageNamespace* session_storage_namespace);
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Random data ---------------------------------------------------------------
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SSLManager* ssl_manager() { return &ssl_manager_; }
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Maximum number of entries before we start removing entries from the front.
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void set_max_entry_count_for_testing(size_t max_entry_count) {
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    max_entry_count_for_testing_ = max_entry_count;
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static size_t max_entry_count();
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetGetTimestampCallbackForTest(
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const base::Callback<base::Time()>& get_timestamp_callback);
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Takes a screenshot of the page at the current state.
1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void TakeScreenshot();
1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
198c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Sets the screenshot manager for this NavigationControllerImpl. The
199c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // controller takes ownership of the screenshot manager and destroys it when
200c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // a new screenshot-manager is set, or when the controller is destroyed.
201c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Setting a NULL manager recreates the default screenshot manager and uses
202c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // that.
203f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void SetScreenshotManager(NavigationEntryScreenshotManager* manager);
2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2051e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Discards only the pending entry.
2061e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void DiscardPendingEntry();
2071e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class RestoreHelper;
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest,
2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                           PurgeScreenshot);
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, Basic);
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, SingleDuplicate);
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ManyDuplicates);
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ClockBackwardsJump);
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Helper class to smooth out runs of duplicate timestamps while still
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // allowing time to jump backwards.
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  class CONTENT_EXPORT TimeSmoother {
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Returns |t| with possibly some time added on.
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    base::Time GetSmoothedTime(base::Time t);
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   private:
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // |low_water_mark_| is the first time in a sequence of adjusted
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // times and |high_water_mark_| is the last.
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    base::Time low_water_mark_;
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    base::Time high_water_mark_;
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Classifies the given renderer navigation (see the NavigationType enum).
2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NavigationType ClassifyNavigation(
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params) const;
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Causes the controller to load the specified entry. The function assumes
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ownership of the pointer since it is put in the navigation list.
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NOTE: Do not pass an entry that the controller already owns!
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void LoadEntry(NavigationEntryImpl* entry);
2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Handlers for the different types of navigation types. They will actually
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // handle the navigations corresponding to the different NavClasses above.
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // They will NOT broadcast the commit notification, that should be handled by
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the caller.
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // RendererDidNavigateAutoSubframe is special, it may not actually change
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // anything if some random subframe is loaded. It will return true if anything
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // changed, or false if not.
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The functions taking |did_replace_entry| will fill into the given variable
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // whether the last entry has been replaced or not.
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // See LoadCommittedDetails.did_replace_entry.
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RendererDidNavigateToNewPage(
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params, bool replace_entry);
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RendererDidNavigateToExistingPage(
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params);
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RendererDidNavigateToSamePage(
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params);
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RendererDidNavigateInPage(
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry);
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RendererDidNavigateNewSubframe(
2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params);
2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool RendererDidNavigateAutoSubframe(
2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params);
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Helper function for code shared between Reload() and ReloadIgnoringCache().
2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ReloadInternal(bool check_for_repost, ReloadType reload_type);
2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Actually issues the navigation held in pending_entry.
2705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NavigateToPendingEntry(ReloadType reload_type);
2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Allows the derived class to issue notifications that a load has been
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // committed. This will fill in the active entry to the details structure.
2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyNavigationEntryCommitted(LoadCommittedDetails* details);
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates the virtual URL of an entry to match a new URL, for cases where
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the real renderer URL is derived from the virtual URL, like view-source:
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateVirtualURLToURL(NavigationEntryImpl* entry,
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                             const GURL& new_url);
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Invoked after session/tab restore or cloning a tab. Resets the transition
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // type of the entries, updates the max page id and creates the active
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // contents.
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void FinishRestore(int selected_index, RestoreType type);
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Inserts a new entry or replaces the current entry with a new one, removing
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // all entries after it. The new entry will become the active one.
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace);
2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Removes the entry at |index|, as long as it is not the current entry.
2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RemoveEntryAtIndexInternal(int index);
2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
29358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Discards both the pending and transient entries.
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DiscardNonCommittedEntriesInternal();
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
29658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Discards only the transient entry.
2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DiscardTransientEntry();
2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If we have the maximum number of entries, remove the oldest one in
3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // preparation to add another.
3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PruneOldestEntryIfFull();
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
303868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Removes all entries except the last committed entry.  If there is a new
304f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // pending navigation it is preserved. In contrast to
305f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // PruneAllButLastCommitted() this does not update the session history of the
306f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // RenderView.  Callers must ensure that |CanPruneAllButLastCommitted| returns
307f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // true before calling this.
308f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void PruneAllButLastCommittedInternal();
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the navigation is likley to be automatic rather than
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // user-initiated.
3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsLikelyAutoNavigation(base::TimeTicks now);
3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Inserts up to |max_index| entries from |source| into this. This does NOT
3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // adjust any of the members that reference entries_
3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // (last_committed_entry_index_, pending_entry_index_ or
3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // transient_entry_index_).
3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void InsertEntriesFrom(const NavigationControllerImpl& source, int max_index);
3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the navigation index that differs from the current entry by the
3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // specified |offset|.  The index returned is not guaranteed to be valid.
3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int GetIndexForOffset(int offset) const;
3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ---------------------------------------------------------------------------
3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The user browser context associated with this controller.
3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserContext* browser_context_;
3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // List of NavigationEntry for this tab
3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef std::vector<linked_ptr<NavigationEntryImpl> > NavigationEntries;
3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NavigationEntries entries_;
3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // An entry we haven't gotten a response for yet.  This will be discarded
3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // when we navigate again.  It's used only so we know what the currently
3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // displayed tab is.
3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
3375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This may refer to an item in the entries_ list if the pending_entry_index_
3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // == -1, or it may be its own entry that should be deleted. Be careful with
3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the memory management.
3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NavigationEntryImpl* pending_entry_;
3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // currently visible entry
3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int last_committed_entry_index_;
3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // index of pending entry if it is in entries_, or -1 if pending_entry_ is a
3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // new entry (created by LoadURL).
3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int pending_entry_index_;
3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The index for the entry that is shown until a navigation occurs.  This is
3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // used for interstitial pages. -1 if there are no such entry.
3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Note that this entry really appears in the list of entries, but only
3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // temporarily (until the next navigation).  Any index pointing to an entry
3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // after the transient entry will become invalid if you navigate forward.
3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int transient_entry_index_;
3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3561e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // The delegate associated with the controller. Possibly NULL during
3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // setup.
3581e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  NavigationControllerDelegate* delegate_;
3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The max restored page ID in this controller, if it was restored.  We must
3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // store this so that WebContentsImpl can tell any renderer in charge of one
3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // of the restored entries to update its max page ID.
3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int32 max_restored_page_id_;
3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
36558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Manages the SSL security UI.
3665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SSLManager ssl_manager_;
3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether we need to be reloaded when made active.
3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool needs_reload_;
3705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether this is the initial navigation.
3722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Becomes false when initial navigation commits.
3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool is_initial_navigation_;
3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // Used to find the appropriate SessionStorageNamespace for the storage
376ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // partition of a NavigationEntry.
377ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  //
378ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // A NavigationController may contain NavigationEntries that correspond to
379ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // different StoragePartitions. Even though they are part of the same
380ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // NavigationController, only entries in the same StoragePartition may
381ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // share session storage state with one another.
382ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  SessionStorageNamespaceMap session_storage_namespace_map_;
3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The maximum number of entries that a navigation controller can store.
3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static size_t max_entry_count_for_testing_;
3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE),
3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NO_RELOAD otherwise.
3895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ReloadType pending_reload_;
3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used to get timestamps for newly-created navigation entries.
3925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::Callback<base::Time()> get_timestamp_callback_;
3935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used to smooth out timestamps from |get_timestamp_callback_|.
3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Without this, whenever there is a run of redirects or
3965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // code-generated navigations, those navigations may occur within
3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the timer resolution, leading to things sometimes showing up in
3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the wrong order in the history view.
3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  TimeSmoother time_smoother_;
4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
401f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  scoped_ptr<NavigationEntryScreenshotManager> screenshot_manager_;
402c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl);
4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace content
4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4081e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#endif  // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
409