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/controls/message_box_view.h" | 5 #include "ui/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/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 void MessageBoxView::Init(const InitParams& params) { | 176 void MessageBoxView::Init(const InitParams& params) { |
177 if (params.options & DETECT_DIRECTIONALITY) { | 177 if (params.options & DETECT_DIRECTIONALITY) { |
178 std::vector<base::string16> texts; | 178 std::vector<base::string16> texts; |
179 SplitStringIntoParagraphs(params.message, &texts); | 179 SplitStringIntoParagraphs(params.message, &texts); |
180 for (size_t i = 0; i < texts.size(); ++i) { | 180 for (size_t i = 0; i < texts.size(); ++i) { |
181 Label* message_label = new Label(texts[i]); | 181 Label* message_label = new Label(texts[i]); |
182 // Avoid empty multi-line labels, which have a height of 0. | 182 // Avoid empty multi-line labels, which have a height of 0. |
183 message_label->SetMultiLine(!texts[i].empty()); | 183 message_label->SetMultiLine(!texts[i].empty()); |
184 message_label->SetAllowCharacterBreak(true); | 184 message_label->SetAllowCharacterBreak(true); |
185 message_label->set_directionality_mode(gfx::DIRECTIONALITY_FROM_TEXT); | |
186 message_label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); | 185 message_label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); |
187 message_labels_.push_back(message_label); | 186 message_labels_.push_back(message_label); |
188 } | 187 } |
189 } else { | 188 } else { |
190 Label* message_label = new Label(params.message); | 189 Label* message_label = new Label(params.message); |
191 message_label->SetMultiLine(true); | 190 message_label->SetMultiLine(true); |
192 message_label->SetAllowCharacterBreak(true); | 191 message_label->SetAllowCharacterBreak(true); |
193 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 192 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
194 message_labels_.push_back(message_label); | 193 message_labels_.push_back(message_label); |
195 } | 194 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 261 } |
263 | 262 |
264 if (link_) { | 263 if (link_) { |
265 layout->AddPaddingRow(0, inter_row_vertical_spacing_); | 264 layout->AddPaddingRow(0, inter_row_vertical_spacing_); |
266 layout->StartRow(0, extra_column_view_set_id); | 265 layout->StartRow(0, extra_column_view_set_id); |
267 layout->AddView(link_); | 266 layout->AddView(link_); |
268 } | 267 } |
269 } | 268 } |
270 | 269 |
271 } // namespace views | 270 } // namespace views |
OLD | NEW |