diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 23:00:42 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 23:00:42 +0000 |
commit | 84a761ee5394832fe52e3bba7e158d94254d3709 (patch) | |
tree | 2adb2981f3c8899c34c81b773a92e165321e623a /app | |
parent | 05f0f9d02bf3c8124f68abd3446c9a981ec51913 (diff) | |
download | chromium_src-84a761ee5394832fe52e3bba7e158d94254d3709.zip chromium_src-84a761ee5394832fe52e3bba7e158d94254d3709.tar.gz chromium_src-84a761ee5394832fe52e3bba7e158d94254d3709.tar.bz2 |
Convert ElideFilename from using wstring to string16.
Some small cleanups of wstring::npos usage.
BUG=23581
Review URL: http://codereview.chromium.org/3390035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/text_elider.cc | 11 | ||||
-rw-r--r-- | app/text_elider.h | 6 | ||||
-rw-r--r-- | app/text_elider_unittest.cc | 4 |
3 files changed, 10 insertions, 11 deletions
diff --git a/app/text_elider.cc b/app/text_elider.cc index ec44057..3fdb001 100644 --- a/app/text_elider.cc +++ b/app/text_elider.cc @@ -40,9 +40,8 @@ std::wstring CutString(const std::wstring& text, } // TODO(tony): Get rid of wstrings. -std::wstring GetDisplayStringInLTRDirectionality(const std::wstring& text) { - return UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality( - WideToUTF16(text))); +string16 GetDisplayStringInLTRDirectionality(const std::wstring& text) { + return base::i18n::GetDisplayStringInLTRDirectionality(WideToUTF16(text)); } } // namespace @@ -287,9 +286,9 @@ std::wstring ElideUrl(const GURL& url, return ElideText(final_elided_url_string, font, available_pixel_width, false); } -std::wstring ElideFilename(const FilePath& filename, - const gfx::Font& font, - int available_pixel_width) { +string16 ElideFilename(const FilePath& filename, + const gfx::Font& font, + int available_pixel_width) { int full_width = font.GetStringWidth(filename.ToWStringHack()); if (full_width <= available_pixel_width) { std::wstring elided_name = filename.ToWStringHack(); diff --git a/app/text_elider.h b/app/text_elider.h index 06ebbf0..6e86b05 100644 --- a/app/text_elider.h +++ b/app/text_elider.h @@ -51,9 +51,9 @@ std::wstring ElideText(const std::wstring& text, // filename is forced to have LTR directionality, which means that in RTL UI // the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and // PDF (Pop Directional Formatting) mark. -std::wstring ElideFilename(const FilePath& filename, - const gfx::Font& font, - int available_pixel_width); +string16 ElideFilename(const FilePath& filename, + const gfx::Font& font, + int available_pixel_width); // SortedDisplayURL maintains a string from a URL suitable for display to the // use. SortedDisplayURL also provides a function used for comparing two diff --git a/app/text_elider_unittest.cc b/app/text_elider_unittest.cc index 2dd76e2..174be59 100644 --- a/app/text_elider_unittest.cc +++ b/app/text_elider_unittest.cc @@ -181,9 +181,9 @@ TEST(TextEliderTest, TestFilenameEliding) { FilePath filepath(testcases[i].input); string16 expected = WideToUTF16(testcases[i].output); expected = base::i18n::GetDisplayStringInLTRDirectionality(expected); - EXPECT_EQ(expected, WideToUTF16(ElideFilename(filepath, + EXPECT_EQ(expected, ElideFilename(filepath, font, - font.GetStringWidth(testcases[i].output)))); + font.GetStringWidth(testcases[i].output))); } } |