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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 bool DialogDelegate::Accept(bool window_closing) { | 78 bool DialogDelegate::Accept(bool window_closing) { |
79 return Accept(); | 79 return Accept(); |
80 } | 80 } |
81 | 81 |
82 bool DialogDelegate::Accept() { | 82 bool DialogDelegate::Accept() { |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
| 86 bool DialogDelegate::Dismiss() { |
| 87 int buttons = GetDialogButtons(); |
| 88 if ((buttons & ui::DIALOG_BUTTON_CANCEL) || |
| 89 (buttons == ui::DIALOG_BUTTON_NONE)) { |
| 90 return Cancel(); |
| 91 } |
| 92 return Accept(true); |
| 93 } |
| 94 |
86 base::string16 DialogDelegate::GetDialogLabel() const { | 95 base::string16 DialogDelegate::GetDialogLabel() const { |
87 return base::string16(); | 96 return base::string16(); |
88 } | 97 } |
89 | 98 |
90 base::string16 DialogDelegate::GetDialogTitle() const { | 99 base::string16 DialogDelegate::GetDialogTitle() const { |
91 return base::string16(); | 100 return base::string16(); |
92 } | 101 } |
93 | 102 |
94 int DialogDelegate::GetDialogButtons() const { | 103 int DialogDelegate::GetDialogButtons() const { |
95 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | 104 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 241 |
233 const Widget* DialogDelegateView::GetWidget() const { | 242 const Widget* DialogDelegateView::GetWidget() const { |
234 return View::GetWidget(); | 243 return View::GetWidget(); |
235 } | 244 } |
236 | 245 |
237 View* DialogDelegateView::GetContentsView() { | 246 View* DialogDelegateView::GetContentsView() { |
238 return this; | 247 return this; |
239 } | 248 } |
240 | 249 |
241 } // namespace views | 250 } // namespace views |
OLD | NEW |