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

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | « views/controls/menu/native_menu_gtk.cc ('k') | views/controls/table/table_view.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/clipboard/clipboard.h" 7 #include "app/clipboard/clipboard.h"
8 #include "app/clipboard/scoped_clipboard_writer.h" 8 #include "app/clipboard/scoped_clipboard_writer.h"
9 #include "app/l10n_util.h"
10 #include "app/message_box_flags.h" 9 #include "app/message_box_flags.h"
10 #include "base/i18n/rtl.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "views/controls/button/checkbox.h" 13 #include "views/controls/button/checkbox.h"
14 #include "views/standard_layout.h" 14 #include "views/standard_layout.h"
15 #include "views/views_delegate.h" 15 #include "views/views_delegate.h"
16 #include "views/window/client_view.h" 16 #include "views/window/client_view.h"
17 17
18 static const int kDefaultMessageWidth = 320; 18 static const int kDefaultMessageWidth = 320;
19 19
20 /////////////////////////////////////////////////////////////////////////////// 20 ///////////////////////////////////////////////////////////////////////////////
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 /////////////////////////////////////////////////////////////////////////////// 113 ///////////////////////////////////////////////////////////////////////////////
114 // MessageBoxView, private: 114 // MessageBoxView, private:
115 115
116 void MessageBoxView::Init(int dialog_flags, 116 void MessageBoxView::Init(int dialog_flags,
117 const std::wstring& default_prompt) { 117 const std::wstring& default_prompt) {
118 message_label_->SetMultiLine(true); 118 message_label_->SetMultiLine(true);
119 message_label_->SetAllowCharacterBreak(true); 119 message_label_->SetAllowCharacterBreak(true);
120 if (dialog_flags & MessageBoxFlags::kAutoDetectAlignment) { 120 if (dialog_flags & MessageBoxFlags::kAutoDetectAlignment) {
121 // Determine the alignment and directionality based on the first character 121 // Determine the alignment and directionality based on the first character
122 // with strong directionality. 122 // with strong directionality.
123 l10n_util::TextDirection direction = 123 base::i18n::TextDirection direction =
124 l10n_util::GetFirstStrongCharacterDirection(message_label_->GetText()); 124 base::i18n::GetFirstStrongCharacterDirection(message_label_->GetText());
125 views::Label::Alignment alignment; 125 views::Label::Alignment alignment;
126 if (direction == l10n_util::RIGHT_TO_LEFT) 126 if (direction == base::i18n::RIGHT_TO_LEFT)
127 alignment = views::Label::ALIGN_RIGHT; 127 alignment = views::Label::ALIGN_RIGHT;
128 else 128 else
129 alignment = views::Label::ALIGN_LEFT; 129 alignment = views::Label::ALIGN_LEFT;
130 // In addition, we should set the RTL alignment mode as 130 // In addition, we should set the RTL alignment mode as
131 // AUTO_DETECT_ALIGNMENT so that the alignment will not be flipped around 131 // AUTO_DETECT_ALIGNMENT so that the alignment will not be flipped around
132 // in RTL locales. 132 // in RTL locales.
133 message_label_->SetRTLAlignmentMode(views::Label::AUTO_DETECT_ALIGNMENT); 133 message_label_->SetRTLAlignmentMode(views::Label::AUTO_DETECT_ALIGNMENT);
134 message_label_->SetHorizontalAlignment(alignment); 134 message_label_->SetHorizontalAlignment(alignment);
135 } else { 135 } else {
136 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 136 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 if (checkbox_) { 208 if (checkbox_) {
209 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 209 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
210 layout->StartRow(0, checkbox_column_view_set_id); 210 layout->StartRow(0, checkbox_column_view_set_id);
211 layout->AddView(checkbox_); 211 layout->AddView(checkbox_);
212 } 212 }
213 213
214 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 214 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
215 } 215 }
OLDNEW
« no previous file with comments | « views/controls/menu/native_menu_gtk.cc ('k') | views/controls/table/table_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698