From cbab76d1c74c93837bc76298d1a2e43646154194 Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Mon, 13 Oct 2008 22:42:47 +0000 Subject: This is the first pass at refactoring the interstitial page. The SSL and malware blocking pages were doing similar things in 2 different classes. There is now a base class called InterstitialPage that contains the common logic. As part of that refactoring, the safe browsing was changed so that the SafeBrowsingBlockingPage is only used from the UI thread. This CL also adds transient entries to the navigation controller: that type of entry gets deleted as soon as a navigation occurs. It is used by interstitial that need to create such a temporary entry while they show. BUG=3013 TEST=Run the unit tests and ui tests. Review URL: http://codereview.chromium.org/6311 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3324 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser_commands.cc | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'chrome/browser/browser_commands.cc') diff --git a/chrome/browser/browser_commands.cc b/chrome/browser/browser_commands.cc index e4e5938d..12d70ce 100644 --- a/chrome/browser/browser_commands.cc +++ b/chrome/browser/browser_commands.cc @@ -18,7 +18,7 @@ #include "chrome/browser/debugger/debugger_window.h" #include "chrome/browser/views/download_tab_view.h" #include "chrome/browser/history_tab_ui.h" -#include "chrome/browser/interstitial_page_delegate.h" +#include "chrome/browser/interstitial_page.h" #include "chrome/browser/navigation_entry.h" #include "chrome/browser/options_window.h" #include "chrome/browser/tab_restore_service.h" @@ -732,35 +732,10 @@ void Browser::GoBack() { TabContents* current_tab = GetSelectedTabContents(); if (current_tab) { WebContents* web_contents = current_tab->AsWebContents(); - // If we are showing an interstitial page, we don't need to navigate back - // to the previous page as it is already available in a render view host - // of the WebContents. This makes the back more snappy and avoids potential - // reloading of POST pages. if (web_contents && web_contents->showing_interstitial_page()) { - // Let the delegate decide (if any) if it wants to handle the back - // navigation (it may have extra things to do). - if (web_contents->interstitial_page_delegate() && - web_contents->interstitial_page_delegate()->GoBack()) { - return; - } - // TODO(jcampan): #1283764 once we refactored and only use the - // interstitial delegate, the code below should go away. - NavigationEntry* prev_nav_entry = web_contents->controller()-> - GetEntryAtOffset(-1); - DCHECK(prev_nav_entry); - // We do a normal back if: - // - the page is not a WebContents, its TabContents might have to be - // recreated. - // - we have not yet visited that navigation entry (typically session - // restore), in which case the page is not already available. - if (prev_nav_entry->tab_type() == TAB_CONTENTS_WEB && - !prev_nav_entry->restored()) { - // It is the job of the code that shows the interstitial to listen for - // notifications of the interstitial getting hidden and appropriately - // dealing with the navigation entries. - web_contents->HideInterstitialPage(false, false); - return; - } + // Pressing back on an interstitial page means "don't proceed". + web_contents->interstitial_page()->DontProceed(); + return; } } NavigationController* nc = GetSelectedNavigationController(); -- cgit v1.1