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

Unified Diff: trunk/src/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc

Issue 21372006: Revert 212329 "Reland "Close web contents modal dialogs on conte..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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: trunk/src/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
===================================================================
--- trunk/src/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc (revision 214772)
+++ trunk/src/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc (working copy)
@@ -16,9 +16,11 @@
TabModalConfirmDialogDelegate::TabModalConfirmDialogDelegate(
WebContents* web_contents)
- : operations_delegate_(NULL),
+ : close_delegate_(NULL),
closing_(false) {
NavigationController* controller = &web_contents->GetController();
+ registrar_.Add(this, content::NOTIFICATION_LOAD_START,
+ content::Source<NavigationController>(controller));
registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING,
content::Source<NavigationController>(controller));
}
@@ -26,7 +28,7 @@
TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() {
// If we end up here, the window has been closed, so make sure we don't close
// it again.
- operations_delegate_ = NULL;
+ close_delegate_ = NULL;
// Make sure everything is cleaned up.
Cancel();
}
@@ -65,8 +67,10 @@
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- // Close the dialog if the tab is closed.
- if (type == chrome::NOTIFICATION_TAB_CLOSING) {
+ // Close the dialog if we load a page (because the action might not apply to
+ // the same page anymore) or if the tab is closed.
+ if (type == content::NOTIFICATION_LOAD_START ||
+ type == chrome::NOTIFICATION_TAB_CLOSING) {
Cancel();
} else {
NOTREACHED();
@@ -108,6 +112,6 @@
}
void TabModalConfirmDialogDelegate::CloseDialog() {
- if (operations_delegate_)
- operations_delegate_->CloseDialog();
+ if (close_delegate_)
+ close_delegate_->CloseDialog();
}

Powered by Google App Engine
This is Rietveld 408576698