summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/text_elider_unittest.cc5
-rw-r--r--chrome/browser/download/download_item_model.cc5
-rw-r--r--chrome/browser/download/download_util.cc5
-rw-r--r--chrome/browser/gtk/go_button_gtk.cc5
-rw-r--r--chrome/browser/possible_url_model.cc11
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc5
-rw-r--r--chrome/browser/search_engines/template_url_table_model.cc11
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc3
-rw-r--r--chrome/browser/task_manager.cc3
-rw-r--r--chrome/browser/task_manager_resource_providers.cc5
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc3
-rw-r--r--chrome/browser/views/download_item_view.cc5
-rw-r--r--chrome/browser/views/go_button.cc3
-rw-r--r--chrome/browser/views/options/passwords_page_view.cc10
-rw-r--r--chrome/browser/views/status_bubble_views.cc3
-rw-r--r--views/controls/label.cc3
16 files changed, 30 insertions, 55 deletions
diff --git a/app/text_elider_unittest.cc b/app/text_elider_unittest.cc
index caf619d..cc421fb 100644
--- a/app/text_elider_unittest.cc
+++ b/app/text_elider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -179,8 +179,7 @@ TEST(TextEliderTest, TestFilenameEliding) {
for (size_t i = 0; i < arraysize(testcases); ++i) {
FilePath filepath(testcases[i].input);
std::wstring expected = testcases[i].output;
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&expected);
+ base::i18n::GetDisplayStringInLTRDirectionality(&expected);
EXPECT_EQ(expected, ElideFilename(filepath,
font,
font.GetStringWidth(testcases[i].output)));
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc
index b69d85f..2dc4c1e 100644
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -39,8 +39,7 @@ std::wstring DownloadItemModel::GetStatusText() {
// we mark the total string as an LTR string if the UI layout is
// right-to-left so that the string "456 MB" is treated as an LTR run.
std::wstring simple_total = FormatBytes(total, amount_units, true);
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&simple_total);
+ base::i18n::GetDisplayStringInLTRDirectionality(&simple_total);
TimeDelta remaining;
std::wstring simple_time;
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 720d203..0972ddc 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -367,8 +367,7 @@ DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id) {
file_value->SetString(L"file_path", download->full_path().ToWStringHack());
// Keep file names as LTR.
std::wstring file_name = download->GetFileName().ToWStringHack();
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&file_name);
+ base::i18n::GetDisplayStringInLTRDirectionality(&file_name);
file_value->SetString(L"file_name", file_name);
file_value->SetString(L"url", download->url().spec());
file_value->SetBoolean(L"otr", download->is_otr());
diff --git a/chrome/browser/gtk/go_button_gtk.cc b/chrome/browser/gtk/go_button_gtk.cc
index 187ace0..fe66f71 100644
--- a/chrome/browser/gtk/go_button_gtk.cc
+++ b/chrome/browser/gtk/go_button_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -176,8 +176,7 @@ gboolean GoButtonGtk::OnQueryTooltip(GtkTooltip* tooltip) {
std::string text;
if (visible_mode_ == MODE_GO) {
std::wstring current_text_wstr(location_bar_->location_entry()->GetText());
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&current_text_wstr);
+ base::i18n::GetDisplayStringInLTRDirectionality(&current_text_wstr);
string16 current_text = WideToUTF16Hack(
l10n_util::TruncateString(current_text_wstr, kMaxTooltipTextLength));
diff --git a/chrome/browser/possible_url_model.cc b/chrome/browser/possible_url_model.cc
index 2f4fdc8..70b4319 100644
--- a/chrome/browser/possible_url_model.cc
+++ b/chrome/browser/possible_url_model.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -121,13 +121,10 @@ std::wstring PossibleURLModel::GetText(int row, int col_id) {
// TODO(brettw): this should probably pass the GURL up so the URL elider
// can be used at a higher level when we know the width.
- const string16& url = results_[row].display_url.display_url();
- if (!base::i18n::IsRTL())
- return UTF16ToWideHack(url);
// Force URL to be LTR.
- std::wstring localized_url = UTF16ToWideHack(url);
- base::i18n::WrapStringWithLTRFormatting(&localized_url);
- return localized_url;
+ std::wstring url(UTF16ToWideHack(results_[row].display_url.display_url()));
+ base::i18n::GetDisplayStringInLTRDirectionality(&url);
+ return url;
}
SkBitmap PossibleURLModel::GetIcon(int row) {
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 0cca1a9..88729ea 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -1292,10 +1292,9 @@ void RenderViewHost::OnMsgSetTooltipText(
// but we use the current approach to match Fx & IE's behavior.
std::wstring wrapped_tooltip_text = tooltip_text;
if (!tooltip_text.empty()) {
- if (text_direction_hint == WebKit::WebTextDirectionLeftToRight &&
- base::i18n::IsRTL()) {
+ if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) {
// Force the tooltip to have LTR directionality.
- base::i18n::WrapStringWithLTRFormatting(&wrapped_tooltip_text);
+ base::i18n::GetDisplayStringInLTRDirectionality(&wrapped_tooltip_text);
} else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft &&
!base::i18n::IsRTL()) {
// Force the tooltip to have RTL directionality.
diff --git a/chrome/browser/search_engines/template_url_table_model.cc b/chrome/browser/search_engines/template_url_table_model.cc
index 961506e..dcad47e 100644
--- a/chrome/browser/search_engines/template_url_table_model.cc
+++ b/chrome/browser/search_engines/template_url_table_model.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -189,15 +189,10 @@ std::wstring TemplateURLTableModel::GetText(int row, int col_id) {
}
case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: {
- const std::wstring& keyword = url.keyword();
// Keyword should be domain name. Force it to have LTR directionality.
- if (base::i18n::IsRTL()) {
- std::wstring localized_keyword = keyword;
- base::i18n::WrapStringWithLTRFormatting(&localized_keyword);
- return localized_keyword;
- }
+ std::wstring keyword(url.keyword());
+ base::i18n::GetDisplayStringInLTRDirectionality(&keyword);
return keyword;
- break;
}
default:
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index c705ec6..3eaf91a 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -3043,8 +3043,7 @@ std::wstring TabContents::GetMessageBoxTitle(const GURL& frame_url,
std::wstring base_address = gfx::ElideUrl(clean_url, gfx::Font(), 0,
profile()->GetPrefs()->GetString(prefs::kAcceptLanguages));
// Force URL to have LTR directionality.
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&base_address);
+ base::i18n::GetDisplayStringInLTRDirectionality(&base_address);
return l10n_util::GetStringF(
is_alert ? IDS_JAVASCRIPT_ALERT_TITLE : IDS_JAVASCRIPT_MESSAGEBOX_TITLE,
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index fa46c81..a604b70 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -127,8 +127,7 @@ std::wstring TaskManagerModel::GetResourceNetworkUsage(int index) const {
std::wstring net_byte =
FormatSpeed(net_usage, GetByteDisplayUnits(net_usage), true);
// Force number string to have LTR directionality.
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&net_byte);
+ base::i18n::GetDisplayStringInLTRDirectionality(&net_byte);
return net_byte;
}
diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index 369a2dd..dfaa76d 100644
--- a/chrome/browser/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager_resource_providers.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -77,8 +77,7 @@ std::wstring TaskManagerTabContentsResource::GetTitle() const {
if (tab_title.empty()) {
tab_title = UTF8ToWide(tab_contents_->GetURL().spec());
// Force URL to be LTR.
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&tab_title);
+ base::i18n::GetDisplayStringInLTRDirectionality(&tab_title);
} else {
// Since the tab_title will be concatenated with
// IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 0cf4a71..e67d212 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -160,8 +160,7 @@ static std::wstring CreateToolTipForURLAndTitle(const gfx::Point& screen_loc,
// the Unicode BiDi algorithm puts certain characters on the left by
// default.
std::wstring elided_url(gfx::ElideUrl(url, tt_font, max_width, languages));
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&elided_url);
+ base::i18n::GetDisplayStringInLTRDirectionality(&elided_url);
result.append(elided_url);
}
return result;
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index 900c0cc..4ae499e 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/views/download_item_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -288,8 +288,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download,
} else {
ElideString(rootname, kFileNameMaxLength - extension.length(), &rootname);
std::wstring filename = rootname + L"." + extension;
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&filename);
+ base::i18n::GetDisplayStringInLTRDirectionality(&filename);
dangerous_download_label_ = new views::Label(
l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename));
}
diff --git a/chrome/browser/views/go_button.cc b/chrome/browser/views/go_button.cc
index f674c72..80d993b 100644
--- a/chrome/browser/views/go_button.cc
+++ b/chrome/browser/views/go_button.cc
@@ -105,8 +105,7 @@ bool GoButton::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
// Note that we mark the URL's text as LTR (instead of examining the
// characters and guessing the text directionality) since URLs are always
// treated as left-to-right text, even when they contain RTL characters.
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(&current_text);
+ base::i18n::GetDisplayStringInLTRDirectionality(&current_text);
AutocompleteEditModel* edit_model = location_bar_->location_entry()->model();
if (edit_model->CurrentTextIsURL()) {
diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/views/options/passwords_page_view.cc
index c03700f..eed3fe1 100644
--- a/chrome/browser/views/options/passwords_page_view.cc
+++ b/chrome/browser/views/options/passwords_page_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -70,13 +70,9 @@ std::wstring PasswordsTableModel::GetText(int row,
int col_id) {
switch (col_id) {
case IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN: { // Site.
- const std::wstring& url = saved_signons_[row]->display_url.display_url();
// Force URL to have LTR directionality.
- if (base::i18n::IsRTL()) {
- std::wstring localized_url = url;
- base::i18n::WrapStringWithLTRFormatting(&localized_url);
- return localized_url;
- }
+ std::wstring url(saved_signons_[row]->display_url.display_url());
+ base::i18n::GetDisplayStringInLTRDirectionality(&url);
return url;
}
case IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN: { // Username.
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc
index f020ef4..ff874f2 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/views/status_bubble_views.cc
@@ -667,8 +667,7 @@ void StatusBubbleViews::SetURL(const GURL& url, const std::wstring& languages) {
// An URL is always treated as a left-to-right string. On right-to-left UIs
// we need to explicitly mark the URL as LTR to make sure it is displayed
// correctly.
- if (base::i18n::IsRTL() && !url_text_.empty())
- base::i18n::WrapStringWithLTRFormatting(&url_text_);
+ base::i18n::GetDisplayStringInLTRDirectionality(&url_text_);
if (IsFrameVisible()) {
view_->SetTextAndAnimate(url_text_);
diff --git a/views/controls/label.cc b/views/controls/label.cc
index 89e9a572..861fc46 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -318,8 +318,7 @@ void Label::CalculateDrawStringParams(std::wstring* paint_text,
// characters. We use the locale settings because an URL is always treated
// as an LTR string, even if its containing view does not use an RTL UI
// layout.
- if (base::i18n::IsRTL())
- base::i18n::WrapStringWithLTRFormatting(paint_text);
+ base::i18n::GetDisplayStringInLTRDirectionality(paint_text);
} else {
*paint_text = text_;
}