| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/window/dialog_client_view.h" | 5 #include "ui/views/window/dialog_client_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 ok_button_(NULL), | 61 ok_button_(NULL), |
| 62 cancel_button_(NULL), | 62 cancel_button_(NULL), |
| 63 extra_view_(NULL), | 63 extra_view_(NULL), |
| 64 delegate_allowed_close_(false) {} | 64 delegate_allowed_close_(false) {} |
| 65 | 65 |
| 66 DialogClientView::~DialogClientView() { | 66 DialogClientView::~DialogClientView() { |
| 67 } | 67 } |
| 68 | 68 |
| 69 void DialogClientView::AcceptWindow() { | 69 void DialogClientView::AcceptWindow() { |
| 70 // Only notify the delegate once. See |delegate_allowed_close_|'s comment. | 70 // Only notify the delegate once. See |delegate_allowed_close_|'s comment. |
| 71 if (!delegate_allowed_close_ && GetDialogDelegate()->Accept(false)) { | 71 if (!delegate_allowed_close_ && GetDialogDelegate()->Accept()) { |
| 72 delegate_allowed_close_ = true; | 72 delegate_allowed_close_ = true; |
| 73 GetWidget()->Close(); | 73 GetWidget()->Close(); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 void DialogClientView::CancelWindow() { | 77 void DialogClientView::CancelWindow() { |
| 78 // Only notify the delegate once. See |delegate_allowed_close_|'s comment. | 78 // Only notify the delegate once. See |delegate_allowed_close_|'s comment. |
| 79 if (!delegate_allowed_close_ && GetDialogDelegate()->Cancel()) { | 79 if (!delegate_allowed_close_ && GetDialogDelegate()->Cancel()) { |
| 80 delegate_allowed_close_ = true; | 80 delegate_allowed_close_ = true; |
| 81 GetWidget()->Close(); | 81 GetWidget()->Close(); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 child_views.end()); | 360 child_views.end()); |
| 361 | 361 |
| 362 // Setup focus. | 362 // Setup focus. |
| 363 for (size_t i = 0; i < child_views.size(); i++) { | 363 for (size_t i = 0; i < child_views.size(); i++) { |
| 364 child_views[i]->SetNextFocusableView( | 364 child_views[i]->SetNextFocusableView( |
| 365 i + 1 != child_views.size() ? child_views[i + 1] : nullptr); | 365 i + 1 != child_views.size() ? child_views[i + 1] : nullptr); |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace views | 369 } // namespace views |
| OLD | NEW |