diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 22:10:17 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 22:10:17 +0000 |
commit | ecd9d87092866d04c00b5695ac56f0a026a6a2c8 (patch) | |
tree | 8af05cf2b9c524db3d40a7007ed5ec137a820d12 /chrome/browser/navigation_controller.cc | |
parent | 7ea9cbb1f61ea1b6990011d076bc09c05b9e72e8 (diff) | |
download | chromium_src-ecd9d87092866d04c00b5695ac56f0a026a6a2c8.zip chromium_src-ecd9d87092866d04c00b5695ac56f0a026a6a2c8.tar.gz chromium_src-ecd9d87092866d04c00b5695ac56f0a026a6a2c8.tar.bz2 |
Make a step on refactoring navigation. The eventual plan is to have the NavigationController create and commit the new NavigationEntries (currently WebContents does a bunch of the details of this which is hard to understand and not easily testable).
This tries to consolidate the logic that I want to move to the NavigationController without actually moving it there yet. I removed all of the "PreCommit" functions in WebContents, since when the NavigationController does
all of the committing, there won't be a phase where the NavigationEntry exists but isn't committed.
Most of the logic could be moved to the PostCommit functions without any problem, which is an indication that the current design was busted anyway. I had to precompute some data and pass it to the *PostCommit function to work around some of the components that required old data. I had to change InfoBars around since it relied on having both the committed and uncommitted entries, but I think the new design is much better anyway.
BUG=1343593,1343146
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/navigation_controller.cc')
-rw-r--r-- | chrome/browser/navigation_controller.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/chrome/browser/navigation_controller.cc b/chrome/browser/navigation_controller.cc index 715e33f7..c944d99 100644 --- a/chrome/browser/navigation_controller.cc +++ b/chrome/browser/navigation_controller.cc @@ -493,7 +493,8 @@ void NavigationController::SetAlternateNavURLFetcher( alternate_nav_url_fetcher_entry_unique_id_ = pending_entry_->unique_id(); } -void NavigationController::DidNavigateToEntry(NavigationEntry* entry) { +void NavigationController::DidNavigateToEntry(NavigationEntry* entry, + LoadCommittedDetails* details) { DCHECK(active_contents_); DCHECK(entry->tab_type() == active_contents_->type()); @@ -501,6 +502,11 @@ void NavigationController::DidNavigateToEntry(NavigationEntry* entry) { entry->set_restored(false); + // Update the details to list the last URL. Later, we'll update the current + // entry (after it's committed) and the details will be complete. + if (GetLastCommittedEntry()) + details->previous_url = GetLastCommittedEntry()->url(); + // If the entry is that of a page with PageID larger than any this Tab has // seen before, then consider it a new navigation. Note that if the entry // has a SiteInstance, it should be the same as the SiteInstance of the @@ -508,7 +514,7 @@ void NavigationController::DidNavigateToEntry(NavigationEntry* entry) { DCHECK(entry->page_id() >= 0) << "Page ID must be set before calling us."; if (entry->page_id() > GetMaxPageID()) { InsertEntry(entry); - NotifyNavigationEntryCommitted(); + NotifyNavigationEntryCommitted(details); // It is now a safe time to schedule collection for any tab contents of a // different type, because a navigation is necessary to get back to them. ScheduleTabContentsCollectionForInactiveTabs(); @@ -566,7 +572,7 @@ void NavigationController::DidNavigateToEntry(NavigationEntry* entry) { } delete entry; - NotifyNavigationEntryCommitted(); + NotifyNavigationEntryCommitted(details); if (alternate_nav_url_fetcher_.get()) { // Because this call may synchronously show an infobar, we do it last, to @@ -715,7 +721,8 @@ void NavigationController::NavigateToPendingEntry(bool reload) { DiscardPendingEntry(); } -void NavigationController::NotifyNavigationEntryCommitted() { +void NavigationController::NotifyNavigationEntryCommitted( + LoadCommittedDetails* details) { // Reset the Alternate Nav URL Fetcher if we're loading some page it doesn't // care about. We must do this before calling Notify() below as that may // result in the creation of a new fetcher. @@ -735,9 +742,11 @@ void NavigationController::NotifyNavigationEntryCommitted() { active_contents_->NotifyNavigationStateChanged( TabContents::INVALIDATE_EVERYTHING); - NotificationService::current()->Notify(NOTIFY_NAV_ENTRY_COMMITTED, - Source<NavigationController>(this), - NotificationService::NoDetails()); + details->entry = GetActiveEntry(); + NotificationService::current()->Notify( + NOTIFY_NAV_ENTRY_COMMITTED, + Source<NavigationController>(this), + Details<LoadCommittedDetails>(details)); } void NavigationController::NotifyPrunedEntries() { |