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

Side by Side Diff: views/controls/message_box_view.cc

Issue 8536026: Convert MessageBoxFlags class into an enum. (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 unified diff | Download patch | Annotate | Revision Log
« ui/base/message_box_flags.h ('K') | « ui/base/message_box_flags.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "views/controls/message_box_view.h" 5 #include "views/controls/message_box_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 10 #include "ui/base/accessibility/accessible_view_state.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return true; 123 return true;
124 } 124 }
125 125
126 /////////////////////////////////////////////////////////////////////////////// 126 ///////////////////////////////////////////////////////////////////////////////
127 // MessageBoxView, private: 127 // MessageBoxView, private:
128 128
129 void MessageBoxView::Init(int dialog_flags, 129 void MessageBoxView::Init(int dialog_flags,
130 const string16& default_prompt) { 130 const string16& default_prompt) {
131 message_label_->SetMultiLine(true); 131 message_label_->SetMultiLine(true);
132 message_label_->SetAllowCharacterBreak(true); 132 message_label_->SetAllowCharacterBreak(true);
133 if (dialog_flags & ui::MessageBoxFlags::kAutoDetectAlignment) { 133 if (dialog_flags & ui::MESSAGE_BOX_AUTO_DETECT_ALIGNMENT) {
134 // Determine the alignment and directionality based on the first character 134 // Determine the alignment and directionality based on the first character
135 // with strong directionality. 135 // with strong directionality.
136 base::i18n::TextDirection direction = 136 base::i18n::TextDirection direction =
137 base::i18n::GetFirstStrongCharacterDirection( 137 base::i18n::GetFirstStrongCharacterDirection(
138 message_label_->GetText()); 138 message_label_->GetText());
139 Label::Alignment alignment; 139 Label::Alignment alignment;
140 if (direction == base::i18n::RIGHT_TO_LEFT) 140 if (direction == base::i18n::RIGHT_TO_LEFT)
141 alignment = Label::ALIGN_RIGHT; 141 alignment = Label::ALIGN_RIGHT;
142 else 142 else
143 alignment = Label::ALIGN_LEFT; 143 alignment = Label::ALIGN_LEFT;
144 // In addition, we should set the RTL alignment mode as 144 // In addition, we should set the RTL alignment mode as
145 // AUTO_DETECT_ALIGNMENT so that the alignment will not be flipped around 145 // AUTO_DETECT_ALIGNMENT so that the alignment will not be flipped around
146 // in RTL locales. 146 // in RTL locales.
147 message_label_->set_rtl_alignment_mode(Label::AUTO_DETECT_ALIGNMENT); 147 message_label_->set_rtl_alignment_mode(Label::AUTO_DETECT_ALIGNMENT);
148 message_label_->SetHorizontalAlignment(alignment); 148 message_label_->SetHorizontalAlignment(alignment);
149 } else { 149 } else {
150 message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); 150 message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
151 } 151 }
152 152
153 if (dialog_flags & ui::MessageBoxFlags::kFlagHasPromptField) { 153 if (dialog_flags & ui::MESSAGE_BOX_HAS_PROMPT_FIELD) {
154 prompt_field_ = new Textfield; 154 prompt_field_ = new Textfield;
155 prompt_field_->SetText(default_prompt); 155 prompt_field_->SetText(default_prompt);
156 } 156 }
157 157
158 ResetLayoutManager(); 158 ResetLayoutManager();
159 } 159 }
160 160
161 void MessageBoxView::ResetLayoutManager() { 161 void MessageBoxView::ResetLayoutManager() {
162 // Initialize the Grid Layout Manager used for this dialog box. 162 // Initialize the Grid Layout Manager used for this dialog box.
163 GridLayout* layout = GridLayout::CreatePanel(this); 163 GridLayout* layout = GridLayout::CreatePanel(this);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (checkbox_) { 219 if (checkbox_) {
220 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 220 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
221 layout->StartRow(0, checkbox_column_view_set_id); 221 layout->StartRow(0, checkbox_column_view_set_id);
222 layout->AddView(checkbox_); 222 layout->AddView(checkbox_);
223 } 223 }
224 224
225 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 225 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
226 } 226 }
227 227
228 } // namespace views 228 } // namespace views
OLDNEW
« ui/base/message_box_flags.h ('K') | « ui/base/message_box_flags.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698