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

Unified Diff: ui/views/window/dialog_client_view.cc

Issue 1686433002: Remove DialogDelegate::OnClosed() which is redundant with (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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
« no previous file with comments | « ui/views/window/dialog_client_view.h ('k') | ui/views/window/dialog_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/dialog_client_view.cc
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index f6567a290acced9eca464dded26de5d10b45b2bc..5f069efeb02c523fd6f00b722cdef1ab5d8dce24 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -58,25 +58,24 @@ DialogClientView::DialogClientView(Widget* owner, View* contents_view)
cancel_button_(NULL),
extra_view_(NULL),
footnote_view_(NULL),
- notified_delegate_(false) {
-}
+ delegate_allowed_close_(false) {}
DialogClientView::~DialogClientView() {
}
void DialogClientView::AcceptWindow() {
- // Only notify the delegate once. See |notified_delegate_|'s comment.
- if (!notified_delegate_ && GetDialogDelegate()->Accept(false)) {
- notified_delegate_ = true;
- Close();
+ // Only notify the delegate once. See |delegate_allowed_close_|'s comment.
+ if (!delegate_allowed_close_ && GetDialogDelegate()->Accept(false)) {
+ delegate_allowed_close_ = true;
+ GetWidget()->Close();
}
}
void DialogClientView::CancelWindow() {
- // Only notify the delegate once. See |notified_delegate_|'s comment.
- if (!notified_delegate_ && GetDialogDelegate()->Cancel()) {
- notified_delegate_ = true;
- Close();
+ // Only notify the delegate once. See |delegate_allowed_close_|'s comment.
+ if (!delegate_allowed_close_ && GetDialogDelegate()->Cancel()) {
+ delegate_allowed_close_ = true;
+ GetWidget()->Close();
}
}
@@ -122,17 +121,11 @@ void DialogClientView::UpdateDialogButtons() {
// DialogClientView, ClientView overrides:
bool DialogClientView::CanClose() {
- if (notified_delegate_)
- return true;
-
- // The dialog is closing but no Accept or Cancel action has been performed
- // before: it's a Close action.
- if (GetDialogDelegate()->Close()) {
- notified_delegate_ = true;
- GetDialogDelegate()->OnClosed();
- return true;
- }
- return false;
+ // If the dialog is closing but no Accept or Cancel action has been performed
+ // before, it's a Close action.
+ if (!delegate_allowed_close_)
+ delegate_allowed_close_ = GetDialogDelegate()->Close();
+ return delegate_allowed_close_;
}
DialogClientView* DialogClientView::AsDialogClientView() {
@@ -239,7 +232,7 @@ void DialogClientView::Layout() {
bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) {
DCHECK_EQ(accelerator.key_code(), ui::VKEY_ESCAPE);
- Close();
+ GetWidget()->Close();
return true;
}
@@ -300,7 +293,7 @@ DialogClientView::DialogClientView(View* contents_view)
cancel_button_(NULL),
extra_view_(NULL),
footnote_view_(NULL),
- notified_delegate_(false) {}
+ delegate_allowed_close_(false) {}
DialogDelegate* DialogClientView::GetDialogDelegate() const {
return GetWidget()->widget_delegate()->AsDialogDelegate();
@@ -381,10 +374,7 @@ gfx::Insets DialogClientView::GetButtonRowInsets() const {
kButtonVEdgeMarginNew, kButtonHEdgeMarginNew);
}
-void DialogClientView::Close() {
- GetWidget()->Close();
- GetDialogDelegate()->OnClosed();
-}
+
void DialogClientView::SetupFocusChain() {
// Create a vector of child views in the order of intended focus.
« no previous file with comments | « ui/views/window/dialog_client_view.h ('k') | ui/views/window/dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698