Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: content/browser/web_contents/interstitial_page_impl.cc

Issue 14651029: content: Remove usage of NOTIFICATION_WEB_CONTENTS_DESTROYED from content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo, rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/interstitial_page_impl.cc
diff --git a/content/browser/web_contents/interstitial_page_impl.cc b/content/browser/web_contents/interstitial_page_impl.cc
index 9673e98069042f1008e28f4dc21bf392e5ec45e6..9b6ada982f0804b6736831c1c05c1d290617a188 100644
--- a/content/browser/web_contents/interstitial_page_impl.cc
+++ b/content/browser/web_contents/interstitial_page_impl.cc
@@ -135,7 +135,8 @@ InterstitialPageImpl::InterstitialPageImpl(WebContents* web_contents,
bool new_navigation,
const GURL& url,
InterstitialPageDelegate* delegate)
- : web_contents_(static_cast<WebContentsImpl*>(web_contents)),
+ : WebContentsObserver(web_contents),
+ web_contents_(static_cast<WebContentsImpl*>(web_contents)),
url_(url),
new_navigation_(new_navigation),
should_discard_pending_nav_entry_(new_navigation),
@@ -224,9 +225,6 @@ void InterstitialPageImpl::Show() {
net::EscapePath(delegate_->GetHTMLContents());
render_view_host_->NavigateToURL(GURL(data_url));
- notification_registrar_.Add(this,
- NOTIFICATION_WEB_CONTENTS_DESTROYED,
- Source<WebContents>(web_contents_));
notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_COMMITTED,
Source<NavigationController>(&web_contents_->GetController()));
notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING,
@@ -324,19 +322,8 @@ void InterstitialPageImpl::Observe(
TakeActionOnResourceDispatcher(CANCEL);
}
break;
- case NOTIFICATION_WEB_CONTENTS_DESTROYED:
case NOTIFICATION_NAV_ENTRY_COMMITTED:
- if (action_taken_ == NO_ACTION) {
- // We are navigating away from the interstitial or closing a tab with an
- // interstitial. Default to DontProceed(). We don't just call Hide as
- // subclasses will almost certainly override DontProceed to do some work
- // (ex: close pending connections).
- DontProceed();
- } else {
- // User decided to proceed and either the navigation was committed or
- // the tab was closed before that.
- Hide();
- }
+ OnNavigatingAwayOrTabClosing();
break;
case NOTIFICATION_DOM_OPERATION_RESPONSE:
if (enabled()) {
@@ -350,6 +337,10 @@ void InterstitialPageImpl::Observe(
}
}
+void InterstitialPageImpl::WebContentsDestroyed(WebContents* web_contents) {
+ OnNavigatingAwayOrTabClosing();
+}
+
RenderViewHostDelegateView* InterstitialPageImpl::GetDelegateView() {
return rvh_delegate_view_.get();
}
@@ -721,6 +712,20 @@ void InterstitialPageImpl::Shutdown(RenderViewHostImpl* render_view_host) {
// We are deleted now.
}
+void InterstitialPageImpl::OnNavigatingAwayOrTabClosing() {
+ if (action_taken_ == NO_ACTION) {
+ // We are navigating away from the interstitial or closing a tab with an
+ // interstitial. Default to DontProceed(). We don't just call Hide as
+ // subclasses will almost certainly override DontProceed to do some work
+ // (ex: close pending connections).
+ DontProceed();
+ } else {
+ // User decided to proceed and either the navigation was committed or
+ // the tab was closed before that.
+ Hide();
+ }
+}
+
void InterstitialPageImpl::TakeActionOnResourceDispatcher(
ResourceRequestAction action) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)) <<
« no previous file with comments | « content/browser/web_contents/interstitial_page_impl.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698