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_delegate.h" | 5 #include "ui/views/window/dialog_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/ui_base_switches_util.h" | 10 #include "ui/base/ui_base_switches_util.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 bool DialogDelegate::Accept(bool window_closing) { | 80 bool DialogDelegate::Accept(bool window_closing) { |
81 return Accept(); | 81 return Accept(); |
82 } | 82 } |
83 | 83 |
84 bool DialogDelegate::Accept() { | 84 bool DialogDelegate::Accept() { |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
| 88 bool DialogDelegate::Close() { |
| 89 int buttons = GetDialogButtons(); |
| 90 if ((buttons & ui::DIALOG_BUTTON_CANCEL) || |
| 91 (buttons == ui::DIALOG_BUTTON_NONE)) { |
| 92 return Cancel(); |
| 93 } |
| 94 return Accept(true); |
| 95 } |
| 96 |
88 base::string16 DialogDelegate::GetDialogLabel() const { | 97 base::string16 DialogDelegate::GetDialogLabel() const { |
89 return base::string16(); | 98 return base::string16(); |
90 } | 99 } |
91 | 100 |
92 base::string16 DialogDelegate::GetDialogTitle() const { | 101 base::string16 DialogDelegate::GetDialogTitle() const { |
93 return GetWindowTitle(); | 102 return GetWindowTitle(); |
94 } | 103 } |
95 | 104 |
96 int DialogDelegate::GetDialogButtons() const { | 105 int DialogDelegate::GetDialogButtons() const { |
97 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | 106 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 238 |
230 const Widget* DialogDelegateView::GetWidget() const { | 239 const Widget* DialogDelegateView::GetWidget() const { |
231 return View::GetWidget(); | 240 return View::GetWidget(); |
232 } | 241 } |
233 | 242 |
234 View* DialogDelegateView::GetContentsView() { | 243 View* DialogDelegateView::GetContentsView() { |
235 return this; | 244 return this; |
236 } | 245 } |
237 | 246 |
238 } // namespace views | 247 } // namespace views |
OLD | NEW |