diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-14 15:42:43 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-14 15:42:43 +0000 |
commit | e9ba44740c88677d8b566583f7041d1dd33b6a9d (patch) | |
tree | 0d85125a089ba6c36136a22651d196a9ba86ec8f /chrome/browser/safe_browsing/safe_browsing_blocking_page.cc | |
parent | b5ef2ca48635ddf96698a11676a4625aff6ef734 (diff) | |
download | chromium_src-e9ba44740c88677d8b566583f7041d1dd33b6a9d.zip chromium_src-e9ba44740c88677d8b566583f7041d1dd33b6a9d.tar.gz chromium_src-e9ba44740c88677d8b566583f7041d1dd33b6a9d.tar.bz2 |
This is almost a complete rewrite of DidNavigate and the associated NavigationController logic. The approach is that the NavigationController should be responsible for the logic and memory management of navigation. Previously, half the logic and memory management lived in WebContents which made it very hard to figure out what was going on.
I split out the various navigation types into separate functions, which then copy and update any existing NavigationEntry as necessary. Previously, WebContents would make a new one which would be manually populated with random fields (I think some were forgotten, too), and then the NavigationController may or may not commit it.
Review URL: http://codereview.chromium.org/479
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/safe_browsing_blocking_page.cc')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index c5d0fe1..0a9d6cf 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -169,20 +169,10 @@ void SafeBrowsingBlockingPage::DisplayBlockingPage() { // (typically the navigation was initiated by the page), we create a fake // navigation entry (so the location bar shows the page's URL). if (is_main_frame_ && tab_->controller()->GetPendingEntryIndex() == -1) { - // New navigation. - NavigationEntry* nav_entry = new NavigationEntry(TAB_CONTENTS_WEB); - - // We set the page ID to max page id so to ensure the controller considers - // this dummy entry a new one. Because we'll remove the entry when the - // interstitial is going away, it will not conflict with any future - // navigations. - nav_entry->set_page_id(tab_->GetMaxPageID() + 1); - nav_entry->set_page_type(NavigationEntry::INTERSTITIAL_PAGE); - nav_entry->set_url(url_); - - // The default details is "new navigation", and that's OK with us. - NavigationController::LoadCommittedDetails details; - tab_->controller()->DidNavigateToEntry(nav_entry, &details); + NavigationEntry new_entry(TAB_CONTENTS_WEB); + new_entry.set_url(url_); + new_entry.set_page_type(NavigationEntry::INTERSTITIAL_PAGE); + tab_->controller()->AddDummyEntryForInterstitial(new_entry); created_temporary_entry_ = true; } @@ -244,7 +234,7 @@ bool SafeBrowsingBlockingPage::GoBack() { // Remove the navigation entry for the malware page. Note that we always // remove the entry even if we did not create it as it has been flagged as // malware and we don't want the user navigating back to it. - web_contents->controller()->RemoveLastEntry(); + web_contents->controller()->RemoveLastEntryForInterstitial(); return true; } @@ -296,7 +286,7 @@ void SafeBrowsingBlockingPage::Continue(const std::string& user_action) { // We are continuing, if we have created a temporary navigation entry, // delete it as a new will be created on navigation. if (created_temporary_entry_) - web->controller()->RemoveLastEntry(); + web->controller()->RemoveLastEntryForInterstitial(); if (is_main_frame_) web->HideInterstitialPage(true, true); else |