navigation_controller_impl.h revision f2477e01787aa58f445919b809d89e252beef54f
15821806d5e7f356e8fa4b058a389a808ea183019Torne (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)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "base/callback.h"
958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "base/compiler_specific.h"
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/gtest_prod_util.h"
117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "base/memory/linked_ptr.h"
12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "base/time/time.h"
1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "build/build_config.h"
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/frame_host/navigation_controller_delegate.h"
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/ssl/ssl_manager.h"
16effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "content/public/browser/navigation_controller.h"
17effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "content/public/browser/navigation_type.h"
1858537e28ecd584eab876aee8be7156509866d23aTorne (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;
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class NavigationEntryScreenshotManager;
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SiteInstance;
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct LoadCommittedDetails;
274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CONTENT_EXPORT NavigationControllerImpl
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    : public NON_EXPORTED_BASE(NavigationController) {
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
31f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  NavigationControllerImpl(
32f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      NavigationControllerDelegate* delegate,
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      BrowserContext* browser_context);
34f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual ~NavigationControllerImpl();
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // NavigationController implementation:
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual WebContents* GetWebContents() const OVERRIDE;
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual BrowserContext* GetBrowserContext() const OVERRIDE;
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void SetBrowserContext(
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      BrowserContext* browser_context) OVERRIDE;
41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void Restore(
4258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      int selected_navigation,
43f2477e01787aa58f445919b809d89e252beef54fTorne (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;
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual NavigationEntry* GetPendingEntry() const OVERRIDE;
5658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual int GetPendingEntryIndex() const OVERRIDE;
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual NavigationEntry* GetTransientEntry() const OVERRIDE;
585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void SetTransientEntry(NavigationEntry* entry) OVERRIDE;
59cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void LoadURL(const GURL& url,
60f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                       const Referrer& referrer,
61c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                       PageTransition type,
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                       const std::string& extra_headers) OVERRIDE;
632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void LoadURLWithParams(const LoadURLParams& params) OVERRIDE;
6458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual void LoadIfNecessary() OVERRIDE;
65f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual bool CanGoBack() const OVERRIDE;
66c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual bool CanGoForward() const OVERRIDE;
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanGoToOffset(int offset) const OVERRIDE;
685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void GoBack() OVERRIDE;
695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void GoForward() OVERRIDE;
705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void GoToIndex(int index) OVERRIDE;
715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void GoToOffset(int offset) OVERRIDE;
72c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual bool RemoveEntryAtIndex(int index) OVERRIDE;
73c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual const SessionStorageNamespaceMap&
74c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      GetSessionStorageNamespaceMap() const OVERRIDE;
75c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual SessionStorageNamespace*
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      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;
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetNeedsReload() OVERRIDE;
812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void CancelPendingReload() OVERRIDE;
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ContinuePendingReload() OVERRIDE;
835821806d5e7f356e8fa4b058a389a808ea183019Torne (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;
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void CopyStateFromAndPrune(
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      NavigationController* source) OVERRIDE;
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanPruneAllButLastCommitted() OVERRIDE;
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void PruneAllButLastCommitted() OVERRIDE;
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ClearAllScreenshots() OVERRIDE;
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The session storage namespace that all child RenderViews belonging to
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |instance| should use.
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SessionStorageNamespace* GetSessionStorageNamespace(
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      SiteInstance* instance);
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the index of the specified entry, or -1 if entry is not contained
103c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // in this NavigationController.
104c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (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,
1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // or -1 if not found.
108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  int GetEntryIndexWithPageID(SiteInstance* instance,
1094e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                              int32 page_id) const;
1104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (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(
11490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      SiteInstance* instance,
11590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      int32 page_id) const;
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NavigationControllerDelegate* delegate() const {
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return delegate_;
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // For use by WebContentsImpl ------------------------------------------------
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Allow renderer-initiated navigations to create a pending entry when the
12468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // provisional load starts.
12568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void SetPendingEntry(content::NavigationEntryImpl* entry);
1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
12768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (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
13668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // and it will return false.
1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool RendererDidNavigate(const ViewHostMsg_FrameNavigate_Params& params,
13868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (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
155f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // refs without reload, only change to "#" which we don't count as empty).
156c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  bool IsURLInPageNavigation(const GURL& url) const {
157f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    return IsURLInPageNavigation(url, false, NAVIGATION_TYPE_UNKNOWN);
158f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  }
159f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
160f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The situation is made murkier by history.replaceState(), which could
161f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // provide the same URL as part of an in-page navigation, not a reload. So
162f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // we need this form which lets the (untrustworthy) renderer resolve the
163f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // ambiguity, but only when the URLs are equal. This should be safe since the
164f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // origin isn't changing.
165f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool IsURLInPageNavigation(
166f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      const GURL& url,
167f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      bool renderer_says_in_page,
168f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      NavigationType navigation_type) const;
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the SessionStorageNamespace for the given |partition_id|. This is
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // used during initialization of a new NavigationController to allow
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // pre-population of the SessionStorageNamespace objects. Session restore,
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // prerendering, and the implementaion of window.open() are the primary users
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // of this API.
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calling this function when a SessionStorageNamespace has already been
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // associated with a |partition_id| will CHECK() fail.
178c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  void SetSessionStorageNamespace(
179c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      const std::string& partition_id,
180c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      SessionStorageNamespace* session_storage_namespace);
181c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
182c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Random data ---------------------------------------------------------------
183c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
184c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  SSLManager* ssl_manager() { return &ssl_manager_; }
185c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
186c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // 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) {
188868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    max_entry_count_for_testing_ = max_entry_count;
1895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static size_t max_entry_count();
1915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetGetTimestampCallbackForTest(
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const base::Callback<base::Time()>& get_timestamp_callback);
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Takes a screenshot of the page at the current state.
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void TakeScreenshot();
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the screenshot manager for this NavigationControllerImpl. The
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // controller takes ownership of the screenshot manager and destroys it when
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // a new screenshot-manager is set, or when the controller is destroyed.
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Setting a NULL manager recreates the default screenshot manager and uses
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // that.
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetScreenshotManager(NavigationEntryScreenshotManager* manager);
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Discards only the pending entry.
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DiscardPendingEntry();
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class RestoreHelper;
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest,
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (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 {
221effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch   public:
222effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch    // Returns |t| with possibly some time added on.
223effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch    base::Time GetSmoothedTime(base::Time t);
224effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
225effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch   private:
226effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch    // |low_water_mark_| is the first time in a sequence of adjusted
227effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch    // times and |high_water_mark_| is the last.
228effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch    base::Time low_water_mark_;
229effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch    base::Time high_water_mark_;
230effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  };
231effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
232effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Classifies the given renderer navigation (see the NavigationType enum).
233effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  NavigationType ClassifyNavigation(
234effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch      const ViewHostMsg_FrameNavigate_Params& params) const;
235effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
236effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Causes the controller to load the specified entry. The function assumes
237effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // ownership of the pointer since it is put in the navigation list.
238effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // NOTE: Do not pass an entry that the controller already owns!
239effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  void LoadEntry(NavigationEntryImpl* entry);
240effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
241effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Handlers for the different types of navigation types. They will actually
242effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // handle the navigations corresponding to the different NavClasses above.
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // They will NOT broadcast the commit notification, that should be handled by
24490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (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)  //
2502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // The functions taking |did_replace_entry| will fill into the given variable
251868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // whether the last entry has been replaced or not.
252868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // See LoadCommittedDetails.did_replace_entry.
253868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  void RendererDidNavigateToNewPage(
254868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params, bool replace_entry);
2552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void RendererDidNavigateToExistingPage(
2562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params);
2572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void RendererDidNavigateToSamePage(
258c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      const ViewHostMsg_FrameNavigate_Params& params);
259c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  void RendererDidNavigateInPage(
260c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry);
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RendererDidNavigateNewSubframe(
2625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params);
2635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool RendererDidNavigateAutoSubframe(
2645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      const ViewHostMsg_FrameNavigate_Params& params);
2655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
2665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Helper function for code shared between Reload() and ReloadIgnoringCache().
267c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  void ReloadInternal(bool check_for_repost, ReloadType reload_type);
268c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
269c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Actually issues the navigation held in pending_entry.
2705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void NavigateToPendingEntry(ReloadType reload_type);
271c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
272c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Allows the derived class to issue notifications that a load has been
2735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // committed. This will fill in the active entry to the details structure.
2745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void NotifyNavigationEntryCommitted(LoadCommittedDetails* details);
2755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
276c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Updates the virtual URL of an entry to match a new URL, for cases where
277c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // the real renderer URL is derived from the virtual URL, like view-source:
2785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void UpdateVirtualURLToURL(NavigationEntryImpl* entry,
2795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                             const GURL& new_url);
2805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
2815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Invoked after session/tab restore or cloning a tab. Resets the transition
2825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // type of the entries, updates the max page id and creates the active
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // contents.
284c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  void FinishRestore(int selected_index, RestoreType type);
285c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
286c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Inserts a new entry or replaces the current entry with a new one, removing
287c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // all entries after it. The new entry will become the active one.
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace);
2897d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (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)
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Discards both the pending and transient entries.
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DiscardNonCommittedEntriesInternal();
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (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)
303a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Removes all entries except the last committed entry.  If there is a new
3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // pending navigation it is preserved. In contrast to
3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // PruneAllButLastCommitted() this does not update the session history of the
3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // RenderView.  Callers must ensure that |CanPruneAllButLastCommitted| returns
3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // true before calling this.
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (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.
3122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool IsLikelyAutoNavigation(base::TimeTicks now);
3132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
31458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Inserts up to |max_index| entries from |source| into this. This does NOT
31558537e28ecd584eab876aee8be7156509866d23aTorne (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
346010d83a9304c5a91596085d917d248abff47903aTorne (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
350f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // used for interstitial pages. -1 if there are no such entry.
351effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Note that this entry really appears in the list of entries, but only
352effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // temporarily (until the next navigation).  Any index pointing to an entry
353effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // after the transient entry will become invalid if you navigate forward.
354effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  int transient_entry_index_;
355effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
356effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // The delegate associated with the controller. Possibly NULL during
357effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // setup.
358effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  NavigationControllerDelegate* delegate_;
359effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
360effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // The max restored page ID in this controller, if it was restored.  We must
361effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // store this so that WebContentsImpl can tell any renderer in charge of one
362effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // of the restored entries to update its max page ID.
363f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  int32 max_restored_page_id_;
364f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
3655821806d5e7f356e8fa4b058a389a808ea183019Torne (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.
3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Becomes false when initial navigation commits.
3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool is_initial_navigation_;
374f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
375f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Used to find the appropriate SessionStorageNamespace for the storage
376f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // partition of a NavigationEntry.
377f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  //
3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A NavigationController may contain NavigationEntries that correspond to
3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // different StoragePartitions. Even though they are part of the same
3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NavigationController, only entries in the same StoragePartition may
381effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // share session storage state with one another.
382effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  SessionStorageNamespaceMap session_storage_namespace_map_;
383effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
384effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // The maximum number of entries that a navigation controller can store.
385effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  static size_t max_entry_count_for_testing_;
386effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
387effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE),
388effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // NO_RELOAD otherwise.
389effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  ReloadType pending_reload_;
390effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
391effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Used to get timestamps for newly-created navigation entries.
392effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  base::Callback<base::Time()> get_timestamp_callback_;
393effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
394effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Used to smooth out timestamps from |get_timestamp_callback_|.
395effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Without this, whenever there is a run of redirects or
396effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // code-generated navigations, those navigations may occur within
397effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // the timer resolution, leading to things sometimes showing up in
398effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // the wrong order in the history view.
399effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  TimeSmoother time_smoother_;
400effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
401effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  scoped_ptr<NavigationEntryScreenshotManager> screenshot_manager_;
4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl);
4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
4052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4064e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}  // namespace content
4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)