| 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 5f069efeb02c523fd6f00b722cdef1ab5d8dce24..f6567a290acced9eca464dded26de5d10b45b2bc 100644
|
| --- a/ui/views/window/dialog_client_view.cc
|
| +++ b/ui/views/window/dialog_client_view.cc
|
| @@ -58,24 +58,25 @@
|
| cancel_button_(NULL),
|
| extra_view_(NULL),
|
| footnote_view_(NULL),
|
| - delegate_allowed_close_(false) {}
|
| + notified_delegate_(false) {
|
| +}
|
|
|
| DialogClientView::~DialogClientView() {
|
| }
|
|
|
| void DialogClientView::AcceptWindow() {
|
| - // Only notify the delegate once. See |delegate_allowed_close_|'s comment.
|
| - if (!delegate_allowed_close_ && GetDialogDelegate()->Accept(false)) {
|
| - delegate_allowed_close_ = true;
|
| - GetWidget()->Close();
|
| + // Only notify the delegate once. See |notified_delegate_|'s comment.
|
| + if (!notified_delegate_ && GetDialogDelegate()->Accept(false)) {
|
| + notified_delegate_ = true;
|
| + Close();
|
| }
|
| }
|
|
|
| void DialogClientView::CancelWindow() {
|
| - // Only notify the delegate once. See |delegate_allowed_close_|'s comment.
|
| - if (!delegate_allowed_close_ && GetDialogDelegate()->Cancel()) {
|
| - delegate_allowed_close_ = true;
|
| - GetWidget()->Close();
|
| + // Only notify the delegate once. See |notified_delegate_|'s comment.
|
| + if (!notified_delegate_ && GetDialogDelegate()->Cancel()) {
|
| + notified_delegate_ = true;
|
| + Close();
|
| }
|
| }
|
|
|
| @@ -121,11 +122,17 @@
|
| // DialogClientView, ClientView overrides:
|
|
|
| bool DialogClientView::CanClose() {
|
| - // 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_;
|
| + 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;
|
| }
|
|
|
| DialogClientView* DialogClientView::AsDialogClientView() {
|
| @@ -232,7 +239,7 @@
|
|
|
| bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) {
|
| DCHECK_EQ(accelerator.key_code(), ui::VKEY_ESCAPE);
|
| - GetWidget()->Close();
|
| + Close();
|
| return true;
|
| }
|
|
|
| @@ -293,7 +300,7 @@
|
| cancel_button_(NULL),
|
| extra_view_(NULL),
|
| footnote_view_(NULL),
|
| - delegate_allowed_close_(false) {}
|
| + notified_delegate_(false) {}
|
|
|
| DialogDelegate* DialogClientView::GetDialogDelegate() const {
|
| return GetWidget()->widget_delegate()->AsDialogDelegate();
|
| @@ -374,7 +381,10 @@
|
| kButtonVEdgeMarginNew, kButtonHEdgeMarginNew);
|
| }
|
|
|
| -
|
| +void DialogClientView::Close() {
|
| + GetWidget()->Close();
|
| + GetDialogDelegate()->OnClosed();
|
| +}
|
|
|
| void DialogClientView::SetupFocusChain() {
|
| // Create a vector of child views in the order of intended focus.
|
|
|