diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 19:19:10 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 19:19:10 +0000 |
commit | 25396dab596e7e47262a8a9569c7570d72b1a5ea (patch) | |
tree | 47dc52b0a84bb59f78b163142fa86df9e77aaaee /chrome/browser/tab_contents/navigation_controller.cc | |
parent | 905e1d172dc2055a813b6cd30099ad747b8fe20b (diff) | |
download | chromium_src-25396dab596e7e47262a8a9569c7570d72b1a5ea.zip chromium_src-25396dab596e7e47262a8a9569c7570d72b1a5ea.tar.gz chromium_src-25396dab596e7e47262a8a9569c7570d72b1a5ea.tar.bz2 |
Fixes navigation issues with interstitial pages.
Updates NavigationController so that the back and forward menus can
be used while an interstitial page is showing. Also fixes tab cloning
while an interstitial page is showing, so that the cloned tab does not
have the interstitial navigation entry.
BUG=37215
BUG=37894
TEST=SSLUITest.TestHTTPSExpiredCertAndGo{Back,Forward}
TEST=NavigationControllerTest.CloneOmitsInterstitials
Review URL: http://codereview.chromium.org/861001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/navigation_controller.cc')
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.cc | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index 27d502a..85eaa1d 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -18,6 +18,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/site_instance.h" #include "chrome/browser/sessions/session_types.h" +#include "chrome/browser/tab_contents/interstitial_page.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" @@ -297,6 +298,13 @@ void NavigationController::GoBack() { return; } + // If an interstitial page is showing, going back is equivalent to hiding the + // interstitial. + if (tab_contents_->interstitial_page()) { + tab_contents_->interstitial_page()->DontProceed(); + return; + } + // Base the navigation on where we are now... int current_index = GetCurrentEntryIndex(); @@ -312,6 +320,14 @@ void NavigationController::GoForward() { return; } + // If an interstitial page is showing, the previous renderer is blocked and + // cannot make new requests. Unblock (and disable) it to allow this + // navigation to succeed. The interstitial will stay visible until the + // resulting DidNavigate. + if (tab_contents_->interstitial_page()) { + tab_contents_->interstitial_page()->CancelForNavigation(); + } + bool transient = (transient_entry_index_ != -1); // Base the navigation on where we are now... @@ -345,6 +361,21 @@ void NavigationController::GoToIndex(int index) { } } + // If an interstitial page is showing, the previous renderer is blocked and + // cannot make new requests. + if (tab_contents_->interstitial_page()) { + if (index == GetCurrentEntryIndex() - 1) { + // Going back one entry is equivalent to hiding the interstitial. + tab_contents_->interstitial_page()->DontProceed(); + return; + } else { + // Unblock the renderer (and disable the interstitial) to allow this + // navigation to succeed. The interstitial will stay visible until the + // resulting DidNavigate. + tab_contents_->interstitial_page()->CancelForNavigation(); + } + } + DiscardNonCommittedEntries(); pending_entry_index_ = index; @@ -886,8 +917,12 @@ void NavigationController::CopyStateFrom(const NavigationController& source) { needs_reload_ = true; for (int i = 0; i < source.entry_count(); i++) { - entries_.push_back(linked_ptr<NavigationEntry>( - new NavigationEntry(*source.entries_[i]))); + // When cloning a tab, copy all entries except interstitial pages + if (source.entries_[i].get()->page_type() != + NavigationEntry::INTERSTITIAL_PAGE) { + entries_.push_back(linked_ptr<NavigationEntry>( + new NavigationEntry(*source.entries_[i]))); + } } session_storage_namespace_id_ = |