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

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

Issue 18863: Review request: fix issue 6099 -- bad display of multi-line English message in pop ups (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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
« no previous file with comments | « chrome/views/message_box_view.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/message_box_view.h" 5 #include "chrome/views/message_box_view.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/views/standard_layout.h" 9 #include "chrome/browser/views/standard_layout.h"
10 #include "chrome/common/l10n_util.h" 10 #include "chrome/common/l10n_util.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 prompt_field_->SelectAll(); 88 prompt_field_->SelectAll();
89 } 89 }
90 } 90 }
91 91
92 /////////////////////////////////////////////////////////////////////////////// 92 ///////////////////////////////////////////////////////////////////////////////
93 // MessageBoxView, private: 93 // MessageBoxView, private:
94 94
95 void MessageBoxView::Init(int dialog_flags, 95 void MessageBoxView::Init(int dialog_flags,
96 const std::wstring& default_prompt) { 96 const std::wstring& default_prompt) {
97 message_label_->SetMultiLine(true); 97 message_label_->SetMultiLine(true);
98 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 98 if (dialog_flags & kAutoDetectAlignment) {
99 // Determine the alignment and directionality based on the first character
100 // with strong directionality.
101 l10n_util::TextDirection direction =
102 l10n_util::GetFirstStrongCharacterDirection(message_label_->GetText());
103 views::Label::Alignment alignment;
104 if (direction == l10n_util::RIGHT_TO_LEFT)
105 alignment = views::Label::ALIGN_RIGHT;
106 else
107 alignment = views::Label::ALIGN_LEFT;
108 // In addition, we should set the RTL alignment mode as
109 // AUTO_DETECT_ALIGNMENT so that the alignment will not be flipped around
110 // in RTL locales.
111 message_label_->SetRTLAlignmentMode(views::Label::AUTO_DETECT_ALIGNMENT);
112 message_label_->SetHorizontalAlignment(alignment);
113 } else {
114 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
115 }
99 116
100 if (dialog_flags & kFlagHasPromptField) { 117 if (dialog_flags & kFlagHasPromptField) {
101 prompt_field_ = new views::TextField; 118 prompt_field_ = new views::TextField;
102 prompt_field_->SetText(default_prompt); 119 prompt_field_->SetText(default_prompt);
103 } 120 }
104 121
105 ResetLayoutManager(); 122 ResetLayoutManager();
106 } 123 }
107 124
108 void MessageBoxView::ResetLayoutManager() { 125 void MessageBoxView::ResetLayoutManager() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 185
169 if (check_box_) { 186 if (check_box_) {
170 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 187 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
171 layout->StartRow(0, checkbox_column_view_set_id); 188 layout->StartRow(0, checkbox_column_view_set_id);
172 layout->AddView(check_box_); 189 layout->AddView(check_box_);
173 } 190 }
174 191
175 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 192 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
176 } 193 }
177 194
OLDNEW
« no previous file with comments | « chrome/views/message_box_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698