Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Unified Diff: chrome/browser/ui/views/simple_message_box_views.cc

Issue 8546003: views: Make SimpleMessageBoxViews::GetDialogButtons() more readable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/js_modal_dialog_views.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/simple_message_box_views.cc
diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc
index 6d9c1002fc1dfa1eacd9104fedca2f76c3c5c0e4..251c8fcf56ec0ef544267666ea40e1163d01b869 100644
--- a/chrome/browser/ui/views/simple_message_box_views.cc
+++ b/chrome/browser/ui/views/simple_message_box_views.cc
@@ -86,10 +86,14 @@ bool SimpleMessageBoxViews::Accept() {
int SimpleMessageBoxViews::GetDialogButtons() const {
// NOTE: It seems unsafe to assume that the flags for OK/cancel will always
// have the same value as the button ids.
- return (dialog_flags_ & ui::MessageBoxFlags::kFlagHasOKButton
- ? ui::DIALOG_BUTTON_OK : 0) |
- (dialog_flags_ & ui::MessageBoxFlags::kFlagHasCancelButton
- ? ui::DIALOG_BUTTON_CANCEL : 0);
+ int dialog_buttons = ui::DIALOG_BUTTON_NONE;
+ if (dialog_flags_ & ui::MessageBoxFlags::kFlagHasOKButton)
+ dialog_buttons = ui::DIALOG_BUTTON_OK;
+
+ if (dialog_flags_ & ui::MessageBoxFlags::kFlagHasCancelButton)
+ dialog_buttons |= ui::DIALOG_BUTTON_CANCEL;
+
+ return dialog_buttons;
}
string16 SimpleMessageBoxViews::GetDialogButtonLabel(
« no previous file with comments | « chrome/browser/ui/views/js_modal_dialog_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698