diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-04 18:38:51 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-04 18:38:51 +0000 |
commit | d5c45b71091a6a70cb051bdcd35a125e3fba6729 (patch) | |
tree | 276bbb5f6ce2c27ab602be95093dd0dfbbc14039 /views/accelerator.cc | |
parent | 72cf2cbaab582d550edb3a5931b6c478e1b685f2 (diff) | |
download | chromium_src-d5c45b71091a6a70cb051bdcd35a125e3fba6729.zip chromium_src-d5c45b71091a6a70cb051bdcd35a125e3fba6729.tar.gz chromium_src-d5c45b71091a6a70cb051bdcd35a125e3fba6729.tar.bz2 |
Remove wstring from l10n_util. Part 4.
BUG=9911
TEST=no visible changes; all tests pass
Review URL: http://codereview.chromium.org/5958017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/accelerator.cc')
-rw-r--r-- | views/accelerator.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/views/accelerator.cc b/views/accelerator.cc index 6eeddb5..9cf6884 100644 --- a/views/accelerator.cc +++ b/views/accelerator.cc @@ -68,7 +68,7 @@ std::wstring Accelerator::GetShortcutText() const { break; } - std::wstring shortcut; + string16 shortcut; if (!string_id) { #if defined(OS_WIN) // Our fallback is to try translate the key code to a regular character @@ -95,20 +95,20 @@ std::wstring Accelerator::GetShortcutText() const { } if (name) { if (name[0] != 0 && name[1] == 0) - shortcut += static_cast<wchar_t>(g_ascii_toupper(name[0])); + shortcut += static_cast<string16::value_type>(g_ascii_toupper(name[0])); else - shortcut += UTF8ToWide(name); + shortcut += UTF8ToUTF16(name); } #endif } else { - shortcut = l10n_util::GetString(string_id); + shortcut = l10n_util::GetStringUTF16(string_id); } // Checking whether the character used for the accelerator is alphanumeric. // If it is not, then we need to adjust the string later on if the locale is // right-to-left. See below for more information of why such adjustment is // required. - std::wstring shortcut_rtl; + string16 shortcut_rtl; bool adjust_shortcut_for_rtl = false; if (base::i18n::IsRTL() && shortcut.length() == 1 && !IsAsciiAlpha(shortcut.at(0)) && !IsAsciiDigit(shortcut.at(0))) { @@ -117,15 +117,15 @@ std::wstring Accelerator::GetShortcutText() const { } if (IsShiftDown()) - shortcut = l10n_util::GetStringF(IDS_APP_SHIFT_MODIFIER, shortcut); + shortcut = l10n_util::GetStringFUTF16(IDS_APP_SHIFT_MODIFIER, shortcut); // Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut. // See http://blogs.msdn.com/oldnewthing/archive/2004/03/29/101121.aspx for // more information. if (IsCtrlDown()) - shortcut = l10n_util::GetStringF(IDS_APP_CONTROL_MODIFIER, shortcut); + shortcut = l10n_util::GetStringFUTF16(IDS_APP_CONTROL_MODIFIER, shortcut); else if (IsAltDown()) - shortcut = l10n_util::GetStringF(IDS_APP_ALT_MODIFIER, shortcut); + shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut); // For some reason, menus in Windows ignore standard Unicode directionality // marks (such as LRE, PDF, etc.). On RTL locales, we use RTL menus and @@ -150,14 +150,14 @@ std::wstring Accelerator::GetShortcutText() const { if (adjust_shortcut_for_rtl) { int key_length = static_cast<int>(shortcut_rtl.length()); DCHECK_GT(key_length, 0); - shortcut_rtl.append(L"+"); + shortcut_rtl.append(ASCIIToUTF16("+")); // Subtracting the size of the shortcut key and 1 for the '+' sign. shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); shortcut.swap(shortcut_rtl); } - return shortcut; + return UTF16ToWide(shortcut); } } // namespace views |