diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/menu/menu_controller.cc | 18 | ||||
-rw-r--r-- | views/controls/menu/menu_controller.h | 6 | ||||
-rw-r--r-- | views/controls/menu/menu_item_view.cc | 12 | ||||
-rw-r--r-- | views/controls/menu/menu_item_view.h | 2 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.cc | 8 |
5 files changed, 23 insertions, 23 deletions
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 5a0ed2d..1af598f 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -52,17 +52,17 @@ namespace views { namespace { // Returns true if the mnemonic of |menu| matches key. -bool MatchesMnemonic(MenuItemView* menu, wchar_t key) { +bool MatchesMnemonic(MenuItemView* menu, char16 key) { return menu->GetMnemonic() == key; } // Returns true if |menu| doesn't have a mnemonic and first character of the its // title is |key|. -bool TitleMatchesMnemonic(MenuItemView* menu, wchar_t key) { +bool TitleMatchesMnemonic(MenuItemView* menu, char16 key) { if (menu->GetMnemonic()) return false; - std::wstring lower_title = base::i18n::WideToLower(menu->GetTitle()); + string16 lower_title = base::i18n::ToLower(WideToUTF16(menu->GetTitle())); return !lower_title.empty() && lower_title[0] == key; } @@ -827,7 +827,7 @@ bool MenuController::Dispatch(const MSG& msg) { return OnKeyDown(msg.wParam, msg); case WM_CHAR: - return !SelectByChar(static_cast<wchar_t>(msg.wParam)); + return !SelectByChar(static_cast<char16>(msg.wParam)); case WM_KEYUP: return true; @@ -1607,8 +1607,8 @@ void MenuController::CloseSubmenu() { MenuController::SelectByCharDetails MenuController::FindChildForMnemonic( MenuItemView* parent, - wchar_t key, - bool (*match_function)(MenuItemView* menu, wchar_t mnemonic)) { + char16 key, + bool (*match_function)(MenuItemView* menu, char16 mnemonic)) { SubmenuView* submenu = parent->GetSubmenu(); DCHECK(submenu); SelectByCharDetails details; @@ -1659,9 +1659,9 @@ bool MenuController::AcceptOrSelect(MenuItemView* parent, return false; } -bool MenuController::SelectByChar(wchar_t character) { - wchar_t char_array[1] = { character }; - wchar_t key = base::i18n::WideToLower(char_array)[0]; +bool MenuController::SelectByChar(char16 character) { + char16 char_array[] = { character, 0 }; + char16 key = base::i18n::ToLower(char_array)[0]; MenuItemView* item = pending_state_.item; if (!item->HasSubmenu() || !item->GetSubmenu()->IsShowing()) item = item->GetParentMenuItem(); diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h index 17a5dc0..9524497 100644 --- a/views/controls/menu/menu_controller.h +++ b/views/controls/menu/menu_controller.h @@ -357,8 +357,8 @@ class MenuController : public MessageLoopForUI::Dispatcher { // |match_function| is used to determine which menus match. SelectByCharDetails FindChildForMnemonic( MenuItemView* parent, - wchar_t key, - bool (*match_function)(MenuItemView* menu, wchar_t mnemonic)); + char16 key, + bool (*match_function)(MenuItemView* menu, char16 mnemonic)); // Selects or accepts the appropriate menu item based on |details|. Returns // true if |Accept| was invoked (which happens if there aren't multiple item @@ -367,7 +367,7 @@ class MenuController : public MessageLoopForUI::Dispatcher { // Selects by mnemonic, and if that doesn't work tries the first character of // the title. Returns true if a match was selected and the menu should exit. - bool SelectByChar(wchar_t key); + bool SelectByChar(char16 key); #if defined(OS_WIN) // If there is a window at the location of the event, a new mouse event is diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc index 2d49c8f..c2c266b8 100644 --- a/views/controls/menu/menu_item_view.cc +++ b/views/controls/menu/menu_item_view.cc @@ -383,26 +383,26 @@ MenuItemView* MenuItemView::GetRootMenuItem() { return NULL; } -wchar_t MenuItemView::GetMnemonic() { +char16 MenuItemView::GetMnemonic() { if (!GetRootMenuItem()->has_mnemonics_) return 0; - const std::wstring& title = GetTitle(); + string16 title = WideToUTF16(GetTitle()); size_t index = 0; do { index = title.find('&', index); - if (index != std::wstring::npos) { + if (index != string16::npos) { if (index + 1 != title.size() && title[index + 1] != '&') { - wchar_t char_array[1] = { title[index + 1] }; + char16 char_array[] = { title[index + 1], 0 }; // TODO(jshin): What about Turkish locale? See http://crbug.com/81719. // If the mnemonic is capital I and the UI language is Turkish, // lowercasing it results in 'small dotless i', which is different // from a 'dotted i'. Similar issues may exist for az and lt locales. - return base::i18n::WideToLower(char_array)[0]; + return base::i18n::ToLower(char_array)[0]; } index++; } - } while (index != std::wstring::npos); + } while (index != string16::npos); return 0; } diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h index 980f2d6..308c3e2 100644 --- a/views/controls/menu/menu_item_view.h +++ b/views/controls/menu/menu_item_view.h @@ -261,7 +261,7 @@ class MenuItemView : public View { // Returns the mnemonic for this MenuItemView, or 0 if this MenuItemView // doesn't have a mnemonic. - wchar_t GetMnemonic(); + char16 GetMnemonic(); // Do we have icons? This only has effect on the top menu. Turning this on // makes the menus slightly wider and taller. diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index 5811cf9..b59e168 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -189,12 +189,12 @@ string16 NativeTextfieldWin::GetText() const { } void NativeTextfieldWin::UpdateText() { - std::wstring text = textfield_->text(); + string16 text = textfield_->text(); // Adjusting the string direction before setting the text in order to make // sure both RTL and LTR strings are displayed properly. base::i18n::AdjustStringForLocaleDirection(&text); if (textfield_->style() & Textfield::STYLE_LOWERCASE) - text = base::i18n::WideToLower(text); + text = base::i18n::ToLower(text); SetWindowText(text.c_str()); UpdateAccessibleValue(text); } @@ -905,9 +905,9 @@ void NativeTextfieldWin::OnPaste() { std::wstring clipboard_str; clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_str); if (!clipboard_str.empty()) { - std::wstring collapsed(CollapseWhitespace(clipboard_str, false)); + string16 collapsed(CollapseWhitespace(clipboard_str, false)); if (textfield_->style() & Textfield::STYLE_LOWERCASE) - collapsed = base::i18n::WideToLower(collapsed); + collapsed = base::i18n::ToLower(collapsed); // Force a Paste operation to trigger ContentsChanged, even if identical // contents are pasted into the text box. See http://crbug.com/79002 ReplaceSel(L"", false); |