summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/navigation_controller.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-18 18:09:36 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-18 18:09:36 +0000
commit59b49a66c3cd959fcf9d7b4bd9c6d88c70b39919 (patch)
treeda55718682e3a4d7da3c6f3d70870eee0542d0b9 /chrome/browser/tab_contents/navigation_controller.h
parentd940627c90386df7844092dae635ed2f20535f28 (diff)
downloadchromium_src-59b49a66c3cd959fcf9d7b4bd9c6d88c70b39919.zip
chromium_src-59b49a66c3cd959fcf9d7b4bd9c6d88c70b39919.tar.gz
chromium_src-59b49a66c3cd959fcf9d7b4bd9c6d88c70b39919.tar.bz2
Fix the ownership model of TabContents and NavigationController. Previously the
NavigationController owned the TabContents, and there were extra steps required at creation and destruction to clean everything up properly. NavigationController is now a member of TabContents, and there is no setup or tear down necessary other than the constructor and destructor. I could remove the tab contents creation in the NavigationController, as well as all the weird destruction code in WebContents which got moved to the destructor. I made the controller getter return a reference since the ownership is clear and there is no possibility of NULL. This required changing a lot of tiles, but many of them were simplified since they no longer have to NULL check. Review URL: http://codereview.chromium.org/69043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/navigation_controller.h')
-rw-r--r--chrome/browser/tab_contents/navigation_controller.h44
1 files changed, 13 insertions, 31 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.h b/chrome/browser/tab_contents/navigation_controller.h
index af7cf60..e42f4ad 100644
--- a/chrome/browser/tab_contents/navigation_controller.h
+++ b/chrome/browser/tab_contents/navigation_controller.h
@@ -123,34 +123,21 @@ class NavigationController {
// ---------------------------------------------------------------------------
- NavigationController(TabContents* initial_contents, Profile* profile);
-
- // Creates a NavigationController from the specified history. Processing
- // for this is asynchronous and handled via the RestoreHelper (in
- // navigation_controller.cc).
- NavigationController(
- Profile* profile,
- const std::vector<TabNavigation>& navigations,
- int selected_navigation);
+ NavigationController(TabContents* tab_contents, Profile* profile);
~NavigationController();
- // Begin the destruction sequence for this NavigationController and all its
- // registered tabs. The sequence is as follows:
- // 1. All tabs are asked to Destroy themselves.
- // 2. When each tab is finished Destroying, it will notify the controller.
- // 3. Once all tabs are Destroyed, the NavigationController deletes itself.
- // This ensures that all the TabContents outlive the NavigationController.
- void Destroy();
-
- // Clone the receiving navigation controller. Only the active tab contents is
- // duplicated.
- NavigationController* Clone();
-
// Returns the profile for this controller. It can never be NULL.
Profile* profile() const {
return profile_;
}
+ // Initializes this NavigationController with the given saved navigations,
+ // using selected_navigation as the currently loaded entry. Before this call
+ // the controller should be unused (there should be no current entry). This is
+ // used for session restore.
+ void RestoreFromState(const std::vector<TabNavigation>& navigations,
+ int selected_navigation);
+
// Active entry --------------------------------------------------------------
// Returns the active entry, which is the transient entry if any, the pending
@@ -295,10 +282,6 @@ class NavigationController {
// TabContents ---------------------------------------------------------------
- // Notifies the controller that a TabContents that it owns has been destroyed.
- // This is part of the NavigationController's Destroy sequence.
- void TabContentsWasDestroyed();
-
// Returns the tab contents associated with this controller. Non-NULL except
// during set-up of the tab.
TabContents* tab_contents() const {
@@ -346,13 +329,17 @@ class NavigationController {
// refs without reload, only change to "#" which we don't count as empty).
bool IsURLInPageNavigation(const GURL& url) const;
+ // Copies the navigation state from the given controller to this one. This
+ // one should be empty (just created).
+ void CopyStateFrom(const NavigationController& source);
+
// Random data ---------------------------------------------------------------
// Returns true if this NavigationController is is configured to load a URL
// lazily. If true, use GetLazyTitle() and GetLazyFavIcon() to discover the
// titles and favicons. Since no request was made, this is the only info
// we have about this page. This feature is used by web application clusters.
- bool LoadingURLLazily();
+ bool LoadingURLLazily() const;
const string16& GetLazyTitle() const;
const SkBitmap& GetLazyFavIcon() const;
@@ -425,11 +412,6 @@ class NavigationController {
// committed. This will fill in the active entry to the details structure.
void NotifyNavigationEntryCommitted(LoadCommittedDetails* details);
- // Returns the TabContents for the |entry|'s type. If the TabContents
- // doesn't yet exist, it is created. If a new TabContents is created, its
- // parent is |parent|. Becomes part of |entry|'s SiteInstance.
- TabContents* GetTabContentsCreateIfNecessary(const NavigationEntry& entry);
-
// Sets the max restored page ID this NavigationController has seen, if it
// was restored from a previous session.
void set_max_restored_page_id(int max_id) { max_restored_page_id_ = max_id; }