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

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: Fix test for Mac 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: 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 c8d87ea66c5d58d1d937f336aed500df8c7cf3f1..9e49df0d9902af42519eb53bab25b59cef60813e 100644
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
+++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
@@ -36,8 +36,7 @@ TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() {
void TabModalConfirmDialogDelegate::Cancel() {
if (closing_)
return;
- // Make sure we won't do anything when |Cancel()| or |Accept()| is called
- // again.
+ // Make sure we won't do anything when another action occurs.
closing_ = true;
OnCanceled();
CloseDialog();
@@ -46,8 +45,7 @@ void TabModalConfirmDialogDelegate::Cancel() {
void TabModalConfirmDialogDelegate::Accept() {
if (closing_)
return;
- // Make sure we won't do anything when |Cancel()| or |Accept()| is called
- // again.
+ // Make sure we won't do anything when another action occurs.
closing_ = true;
OnAccepted();
CloseDialog();
@@ -71,12 +69,21 @@ 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();
+ Close();
} else {
NOTREACHED();
}
}
+void TabModalConfirmDialogDelegate::Close() {
+ if (closing_)
+ return;
+ // Make sure we won't do anything when another action occurs.
+ closing_ = true;
+ OnClosed();
+ CloseDialog();
+}
+
gfx::Image* TabModalConfirmDialogDelegate::GetIcon() {
return NULL;
}
@@ -111,6 +118,9 @@ void TabModalConfirmDialogDelegate::OnLinkClicked(
WindowOpenDisposition disposition) {
}
+void TabModalConfirmDialogDelegate::OnClosed() {
+}
+
void TabModalConfirmDialogDelegate::CloseDialog() {
if (close_delegate_)
close_delegate_->CloseDialog();
« no previous file with comments | « chrome/browser/ui/tab_modal_confirm_dialog_delegate.h ('k') | chrome/browser/ui/views/bookmarks/bookmark_editor_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698