| 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.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
| 12 #include "ui/base/clipboard/clipboard.h" | 12 #include "ui/base/clipboard/clipboard.h" |
| 13 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 13 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 14 #include "ui/gfx/render_text.h" |
| 14 #include "ui/views/controls/button/checkbox.h" | 15 #include "ui/views/controls/button/checkbox.h" |
| 15 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
| 16 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.h" |
| 17 #include "ui/views/controls/textfield/textfield.h" | 18 #include "ui/views/controls/textfield/textfield.h" |
| 18 #include "ui/views/layout/grid_layout.h" | 19 #include "ui/views/layout/grid_layout.h" |
| 19 #include "ui/views/layout/layout_constants.h" | 20 #include "ui/views/layout/layout_constants.h" |
| 20 #include "ui/views/views_delegate.h" | 21 #include "ui/views/views_delegate.h" |
| 21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 22 #include "ui/views/window/client_view.h" | 23 #include "ui/views/window/client_view.h" |
| 23 | 24 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 base::i18n::GetFirstStrongCharacterDirection(params.message); | 169 base::i18n::GetFirstStrongCharacterDirection(params.message); |
| 169 Label::Alignment alignment = | 170 Label::Alignment alignment = |
| 170 (message_direction == base::i18n::RIGHT_TO_LEFT) ? | 171 (message_direction == base::i18n::RIGHT_TO_LEFT) ? |
| 171 Label::ALIGN_RIGHT : Label::ALIGN_LEFT; | 172 Label::ALIGN_RIGHT : Label::ALIGN_LEFT; |
| 172 for (size_t i = 0; i < texts.size(); ++i) { | 173 for (size_t i = 0; i < texts.size(); ++i) { |
| 173 Label* message_label = new Label(texts[i]); | 174 Label* message_label = new Label(texts[i]); |
| 174 // Don't set multi-line to true if the text is empty, else the label will | 175 // Don't set multi-line to true if the text is empty, else the label will |
| 175 // have a height of 0. | 176 // have a height of 0. |
| 176 message_label->SetMultiLine(!texts[i].empty()); | 177 message_label->SetMultiLine(!texts[i].empty()); |
| 177 message_label->SetAllowCharacterBreak(true); | 178 message_label->SetAllowCharacterBreak(true); |
| 178 message_label->set_directionality_mode(Label::AUTO_DETECT_DIRECTIONALITY); | 179 message_label->set_directionality_mode(gfx::DERIVE_FROM_TEXT); |
| 179 message_label->SetHorizontalAlignment(alignment); | 180 message_label->SetHorizontalAlignment(alignment); |
| 180 message_labels_.push_back(message_label); | 181 message_labels_.push_back(message_label); |
| 181 } | 182 } |
| 182 } else { | 183 } else { |
| 183 Label* message_label = new Label(params.message); | 184 Label* message_label = new Label(params.message); |
| 184 message_label->SetMultiLine(true); | 185 message_label->SetMultiLine(true); |
| 185 message_label->SetAllowCharacterBreak(true); | 186 message_label->SetAllowCharacterBreak(true); |
| 186 message_label->SetHorizontalAlignment(Label::ALIGN_LEFT); | 187 message_label->SetHorizontalAlignment(Label::ALIGN_LEFT); |
| 187 message_labels_.push_back(message_label); | 188 message_labels_.push_back(message_label); |
| 188 } | 189 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (checkbox_) { | 262 if (checkbox_) { |
| 262 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 263 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
| 263 layout->StartRow(0, checkbox_column_view_set_id); | 264 layout->StartRow(0, checkbox_column_view_set_id); |
| 264 layout->AddView(checkbox_); | 265 layout->AddView(checkbox_); |
| 265 } | 266 } |
| 266 | 267 |
| 267 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 268 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
| 268 } | 269 } |
| 269 | 270 |
| 270 } // namespace views | 271 } // namespace views |
| OLD | NEW |