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 "chrome/browser/ui/simple_message_box.h" | 5 #include "chrome/browser/ui/simple_message_box.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 views::Widget::CreateWindowWithParent(this, parent_window)->Show(); | 147 views::Widget::CreateWindowWithParent(this, parent_window)->Show(); |
148 | 148 |
149 // Add reference to be released in DeleteDelegate(). | 149 // Add reference to be released in DeleteDelegate(). |
150 AddRef(); | 150 AddRef(); |
151 } | 151 } |
152 | 152 |
153 SimpleMessageBoxViews::~SimpleMessageBoxViews() { | 153 SimpleMessageBoxViews::~SimpleMessageBoxViews() { |
154 } | 154 } |
155 | 155 |
156 int SimpleMessageBoxViews::GetDialogButtons() const { | 156 int SimpleMessageBoxViews::GetDialogButtons() const { |
157 if (dialog_type_ == DIALOG_TYPE_INFORMATION || | 157 if (dialog_type_ == DIALOG_TYPE_QUESTION) |
158 dialog_type_ == DIALOG_TYPE_WARNING) | 158 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
159 return ui::DIALOG_BUTTON_OK; | 159 return ui::DIALOG_BUTTON_OK; |
160 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | |
161 } | 160 } |
162 | 161 |
163 string16 SimpleMessageBoxViews::GetDialogButtonLabel( | 162 string16 SimpleMessageBoxViews::GetDialogButtonLabel( |
164 ui::DialogButton button) const { | 163 ui::DialogButton button) const { |
165 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? | 164 if (dialog_type_ == DIALOG_TYPE_QUESTION) { |
166 IDS_OK : IDS_CLOSE); | 165 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? |
166 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL : | |
tfarina
2012/05/19 14:05:01
we could have an IDS_YES and IDS_NO.
| |
167 IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL); | |
168 } | |
169 return l10n_util::GetStringUTF16(IDS_OK); | |
167 } | 170 } |
168 | 171 |
169 bool SimpleMessageBoxViews::Cancel() { | 172 bool SimpleMessageBoxViews::Cancel() { |
170 disposition_ = DISPOSITION_CANCEL; | 173 disposition_ = DISPOSITION_CANCEL; |
171 return true; | 174 return true; |
172 } | 175 } |
173 | 176 |
174 bool SimpleMessageBoxViews::Accept() { | 177 bool SimpleMessageBoxViews::Accept() { |
175 disposition_ = DISPOSITION_OK; | 178 disposition_ = DISPOSITION_OK; |
176 return true; | 179 return true; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 SimpleMessageBoxViews::ShowMessageBox(parent, title, message, type); | 224 SimpleMessageBoxViews::ShowMessageBox(parent, title, message, type); |
222 } | 225 } |
223 | 226 |
224 bool ShowQuestionMessageBox(gfx::NativeWindow parent, | 227 bool ShowQuestionMessageBox(gfx::NativeWindow parent, |
225 const string16& title, | 228 const string16& title, |
226 const string16& message) { | 229 const string16& message) { |
227 return SimpleMessageBoxViews::ShowQuestionMessageBox(parent, title, message); | 230 return SimpleMessageBoxViews::ShowQuestionMessageBox(parent, title, message); |
228 } | 231 } |
229 | 232 |
230 } // namespace browser | 233 } // namespace browser |
OLD | NEW |