OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/simple_message_box_views.h" | 5 #include "chrome/browser/ui/views/simple_message_box_views.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/simple_message_box.h" | 9 #include "chrome/browser/simple_message_box.h" |
10 #include "chrome/browser/ui/views/window.h" | 10 #include "chrome/browser/ui/views/window.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 bool SimpleMessageBoxViews::Accept() { | 81 bool SimpleMessageBoxViews::Accept() { |
82 disposition_ = DISPOSITION_OK; | 82 disposition_ = DISPOSITION_OK; |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 int SimpleMessageBoxViews::GetDialogButtons() const { | 86 int SimpleMessageBoxViews::GetDialogButtons() const { |
87 // NOTE: It seems unsafe to assume that the flags for OK/cancel will always | 87 // NOTE: It seems unsafe to assume that the flags for OK/cancel will always |
88 // have the same value as the button ids. | 88 // have the same value as the button ids. |
89 return (dialog_flags_ & ui::MessageBoxFlags::kFlagHasOKButton | 89 int dialog_buttons = ui::DIALOG_BUTTON_NONE; |
90 ? ui::DIALOG_BUTTON_OK : 0) | | 90 if (dialog_flags_ & ui::MessageBoxFlags::kFlagHasOKButton) |
91 (dialog_flags_ & ui::MessageBoxFlags::kFlagHasCancelButton | 91 dialog_buttons = ui::DIALOG_BUTTON_OK; |
92 ? ui::DIALOG_BUTTON_CANCEL : 0); | 92 |
| 93 if (dialog_flags_ & ui::MessageBoxFlags::kFlagHasCancelButton) |
| 94 dialog_buttons |= ui::DIALOG_BUTTON_CANCEL; |
| 95 |
| 96 return dialog_buttons; |
93 } | 97 } |
94 | 98 |
95 string16 SimpleMessageBoxViews::GetDialogButtonLabel( | 99 string16 SimpleMessageBoxViews::GetDialogButtonLabel( |
96 ui::DialogButton button) const { | 100 ui::DialogButton button) const { |
97 return button == ui::DIALOG_BUTTON_OK ? l10n_util::GetStringUTF16(IDS_OK) | 101 return button == ui::DIALOG_BUTTON_OK ? l10n_util::GetStringUTF16(IDS_OK) |
98 : l10n_util::GetStringUTF16(IDS_CLOSE); | 102 : l10n_util::GetStringUTF16(IDS_CLOSE); |
99 } | 103 } |
100 | 104 |
101 bool SimpleMessageBoxViews::ShouldShowWindowTitle() const { | 105 bool SimpleMessageBoxViews::ShouldShowWindowTitle() const { |
102 return true; | 106 return true; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (disposition_ == DISPOSITION_UNKNOWN) | 167 if (disposition_ == DISPOSITION_UNKNOWN) |
164 return base::MessagePumpDispatcher::EVENT_PROCESSED; | 168 return base::MessagePumpDispatcher::EVENT_PROCESSED; |
165 return base::MessagePumpDispatcher::EVENT_QUIT; | 169 return base::MessagePumpDispatcher::EVENT_QUIT; |
166 } | 170 } |
167 #else | 171 #else |
168 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { | 172 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { |
169 gtk_main_do_event(event); | 173 gtk_main_do_event(event); |
170 return disposition_ == DISPOSITION_UNKNOWN; | 174 return disposition_ == DISPOSITION_UNKNOWN; |
171 } | 175 } |
172 #endif | 176 #endif |
OLD | NEW |