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

Unified Diff: app/text_elider.cc

Issue 3108027: Convert GetDisplayStringInLTRDirectionality from wstring to string16. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | app/text_elider_unittest.cc » ('j') | chrome/browser/tab_contents/tab_contents.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/text_elider.cc
diff --git a/app/text_elider.cc b/app/text_elider.cc
index 1ee1d1cfe48022f16f02203fac4aca0d476254ff..995ac95959681963029bd50fa23b429218811d8d 100644
--- a/app/text_elider.cc
+++ b/app/text_elider.cc
@@ -38,6 +38,12 @@ std::wstring CutString(const std::wstring& text,
text.substr(text.length() - half_length, half_length);
}
+// TODO(tony): Get rid of wstrings.
+std::wstring GetDisplayStringInLTRDirectionality(const std::wstring& text) {
+ return UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
+ WideToUTF16(text)));
+}
+
} // namespace
namespace gfx {
@@ -285,7 +291,7 @@ std::wstring ElideFilename(const FilePath& filename,
int full_width = font.GetStringWidth(filename.ToWStringHack());
if (full_width <= available_pixel_width) {
std::wstring elided_name = filename.ToWStringHack();
- return base::i18n::GetDisplayStringInLTRDirectionality(&elided_name);
+ return GetDisplayStringInLTRDirectionality(elided_name);
}
#if defined(OS_WIN)
@@ -299,7 +305,7 @@ std::wstring ElideFilename(const FilePath& filename,
if (rootname.empty() || extension.empty()) {
std::wstring elided_name = ElideText(filename.ToWStringHack(), font,
available_pixel_width, false);
- return base::i18n::GetDisplayStringInLTRDirectionality(&elided_name);
+ return GetDisplayStringInLTRDirectionality(elided_name);
}
int ext_width = font.GetStringWidth(extension);
@@ -308,14 +314,14 @@ std::wstring ElideFilename(const FilePath& filename,
// We may have trimmed the path.
if (root_width + ext_width <= available_pixel_width) {
std::wstring elided_name = rootname + extension;
- return base::i18n::GetDisplayStringInLTRDirectionality(&elided_name);
+ return GetDisplayStringInLTRDirectionality(elided_name);
}
int available_root_width = available_pixel_width - ext_width;
std::wstring elided_name =
ElideText(rootname, font, available_root_width, false);
elided_name += extension;
- return base::i18n::GetDisplayStringInLTRDirectionality(&elided_name);
+ return GetDisplayStringInLTRDirectionality(elided_name);
}
// This function adds an ellipsis at the end of the text if the text
« no previous file with comments | « no previous file | app/text_elider_unittest.cc » ('j') | chrome/browser/tab_contents/tab_contents.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698