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

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

Issue 18179004: Dismiss action in tab modal dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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: chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
index 903fed1aa9912ae2f370b0a7e7d5952244148b8b..c823d42b95405807cde9be6f7b0bfcadea51d0b7 100644
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
+++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
@@ -33,34 +33,45 @@ TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() {
Cancel();
}
-void TabModalConfirmDialogDelegate::Cancel() {
+bool TabModalConfirmDialogDelegate::Cancel() {
if (closing_)
- return;
- // Make sure we won't do anything when |Cancel()| or |Accept()| is called
- // again.
+ return false;
+ // Make sure we won't do anything when another action occurs.
closing_ = true;
OnCanceled();
CloseDialog();
+ return true;
}
-void TabModalConfirmDialogDelegate::Accept() {
+bool TabModalConfirmDialogDelegate::Accept() {
if (closing_)
- return;
- // Make sure we won't do anything when |Cancel()| or |Accept()| is called
- // again.
+ return false;
+ // Make sure we won't do anything when another action occurs.
closing_ = true;
OnAccepted();
CloseDialog();
+ return true;
}
-void TabModalConfirmDialogDelegate::LinkClicked(
+bool TabModalConfirmDialogDelegate::LinkClicked(
WindowOpenDisposition disposition) {
if (closing_)
- return;
+ return false;
// Make sure we won't do anything when another action occurs.
closing_ = true;
OnLinkClicked(disposition);
CloseDialog();
+ return true;
+}
+
+bool TabModalConfirmDialogDelegate::Dismissed() {
+ if (closing_)
+ return false;
+ // Make sure we won't do anything when another action occurs.
+ closing_ = true;
+ OnDismissed();
+ CloseDialog();
+ return true;
}
void TabModalConfirmDialogDelegate::Observe(
@@ -71,7 +82,7 @@ void TabModalConfirmDialogDelegate::Observe(
// the same page anymore) or if the tab is closed.
if (type == content::NOTIFICATION_LOAD_START ||
type == chrome::NOTIFICATION_TAB_CLOSING) {
- Cancel();
+ Dismissed();
} else {
NOTREACHED();
}
@@ -111,6 +122,9 @@ void TabModalConfirmDialogDelegate::OnLinkClicked(
WindowOpenDisposition disposition) {
}
+void TabModalConfirmDialogDelegate::OnDismissed() {
+}
+
void TabModalConfirmDialogDelegate::CloseDialog() {
if (close_delegate_)
close_delegate_->CloseDialog();

Powered by Google App Engine
This is Rietveld 408576698