diff options
Diffstat (limited to 'chrome/browser/chromeos/input_method')
7 files changed, 32 insertions, 30 deletions
diff --git a/chrome/browser/chromeos/input_method/accessibility.cc b/chrome/browser/chromeos/input_method/accessibility.cc index 0dac232..5047d12 100644 --- a/chrome/browser/chromeos/input_method/accessibility.cc +++ b/chrome/browser/chromeos/input_method/accessibility.cc @@ -45,7 +45,7 @@ void Accessibility::InputMethodChanged(InputMethodManager* imm, // Get the medium name of the changed input method (e.g. US, INTL, etc.) const InputMethodDescriptor descriptor = imm_->GetCurrentInputMethod(); - const std::string medium_name = UTF16ToUTF8( + const std::string medium_name = base::UTF16ToUTF8( imm_->GetInputMethodUtil()->GetInputMethodMediumName(descriptor)); AccessibilityAlertInfo event(ProfileManager::GetActiveUserProfile(), diff --git a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc index 131fd50..41e2710 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc +++ b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc @@ -141,8 +141,8 @@ void CandidateWindowControllerImpl::ConvertLookupTableToInfolistEntry( if (ibus_entry.description_title.empty() && ibus_entry.description_body.empty()) continue; - InfolistEntry entry(UTF8ToUTF16(ibus_entry.description_title), - UTF8ToUTF16(ibus_entry.description_body)); + InfolistEntry entry(base::UTF8ToUTF16(ibus_entry.description_title), + base::UTF8ToUTF16(ibus_entry.description_body)); if (i == cursor_index_in_page) { entry.highlighted = true; *has_highlighted = true; diff --git a/chrome/browser/chromeos/input_method/candidate_window_view.cc b/chrome/browser/chromeos/input_method/candidate_window_view.cc index f2423f7..7efcdd5 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_view.cc +++ b/chrome/browser/chromeos/input_method/candidate_window_view.cc @@ -75,12 +75,12 @@ views::View* WrapWithPadding(views::View* view, const gfx::Insets& insets) { base::string16 CreateShortcutText(size_t index, const CandidateWindow& candidate_window) { if (index >= candidate_window.candidates().size()) - return UTF8ToUTF16(""); + return base::string16(); std::string shortcut_text = candidate_window.candidates()[index].label; if (!shortcut_text.empty() && candidate_window.orientation() != CandidateWindow::VERTICAL) shortcut_text += '.'; - return UTF8ToUTF16(shortcut_text); + return base::UTF8ToUTF16(shortcut_text); } // Creates the shortcut label, and returns it (never returns NULL). @@ -245,7 +245,7 @@ gfx::Size ComputeCandidateColumnSize( const size_t index = start_from + i; candidate_label->SetText( - UTF8ToUTF16(candidate_window.candidates()[index].value)); + base::UTF8ToUTF16(candidate_window.candidates()[index].value)); gfx::Size text_size = candidate_label->GetPreferredSize(); candidate_column_width = std::max(candidate_column_width, text_size.width()); @@ -279,7 +279,7 @@ gfx::Size ComputeAnnotationColumnSize( const size_t index = start_from + i; annotation_label->SetText( - UTF8ToUTF16(candidate_window.candidates()[index].annotation)); + base::UTF8ToUTF16(candidate_window.candidates()[index].annotation)); gfx::Size text_size = annotation_label->GetPreferredSize(); annotation_column_width = std::max(annotation_column_width, text_size.width()); @@ -318,7 +318,7 @@ class InformationTextArea : public HidableArea { // Set the displayed text. void SetText(const std::string& utf8_text) { - label_->SetText(UTF8ToUTF16(utf8_text)); + label_->SetText(base::UTF8ToUTF16(utf8_text)); } protected: @@ -745,8 +745,8 @@ void CandidateWindowView::UpdateCandidates( if (candidate_index < new_candidate_window.candidates().size()) { const CandidateWindow::Entry& entry = new_candidate_window.candidates()[candidate_index]; - candidate_view->SetCandidateText(UTF8ToUTF16(entry.value)); - candidate_view->SetAnnotationText(UTF8ToUTF16(entry.annotation)); + candidate_view->SetCandidateText(base::UTF8ToUTF16(entry.value)); + candidate_view->SetAnnotationText(base::UTF8ToUTF16(entry.annotation)); candidate_view->SetRowEnabled(true); candidate_view->SetInfolistIcon(!entry.description_title.empty()); } else { diff --git a/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc b/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc index 7702d1f..19b5a5a 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc +++ b/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc @@ -68,9 +68,9 @@ class CandidateWindowViewTest : public views::ViewsTestBase { const std::string& candidate, const std::string& annotation, const CandidateView* row) { - EXPECT_EQ(shortcut, UTF16ToUTF8(row->shortcut_label_->text())); - EXPECT_EQ(candidate, UTF16ToUTF8(row->candidate_label_->text())); - EXPECT_EQ(annotation, UTF16ToUTF8(row->annotation_label_->text())); + EXPECT_EQ(shortcut, base::UTF16ToUTF8(row->shortcut_label_->text())); + EXPECT_EQ(candidate, base::UTF16ToUTF8(row->candidate_label_->text())); + EXPECT_EQ(annotation, base::UTF16ToUTF8(row->annotation_label_->text())); } }; diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index 8bc71ac..2e62d5d 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -337,7 +337,7 @@ base::string16 InputMethodUtil::TranslateString( if (TranslateStringInternal(english_string, &localized_string)) { return localized_string; } - return UTF8ToUTF16(english_string); + return base::UTF8ToUTF16(english_string); } bool InputMethodUtil::IsValidInputMethodId( @@ -380,7 +380,7 @@ std::string InputMethodUtil::GetInputMethodDisplayNameFromId( base::string16 display_name; if (!extension_ime_util::IsExtensionIME(input_method_id) && TranslateStringInternal(input_method_id, &display_name)) { - return UTF16ToUTF8(display_name); + return base::UTF16ToUTF8(display_name); } // Return an empty string if the display name is not found. return ""; @@ -395,7 +395,7 @@ base::string16 InputMethodUtil::GetInputMethodShortName( // Check special cases first. for (size_t i = 0; i < kMappingFromIdToIndicatorTextLen; ++i) { if (kMappingFromIdToIndicatorText[i].input_method_id == input_method.id()) { - text = UTF8ToUTF16(kMappingFromIdToIndicatorText[i].indicator_text); + text = base::UTF8ToUTF16(kMappingFromIdToIndicatorText[i].indicator_text); break; } } @@ -405,7 +405,7 @@ base::string16 InputMethodUtil::GetInputMethodShortName( IsKeyboardLayout(input_method.id())) { const size_t kMaxKeyboardLayoutNameLen = 2; const base::string16 keyboard_layout = - UTF8ToUTF16(GetKeyboardLayoutName(input_method.id())); + base::UTF8ToUTF16(GetKeyboardLayoutName(input_method.id())); text = StringToUpperASCII(keyboard_layout).substr( 0, kMaxKeyboardLayoutNameLen); } @@ -420,7 +420,7 @@ base::string16 InputMethodUtil::GetInputMethodShortName( const size_t kMaxLanguageNameLen = 2; DCHECK(!input_method.language_codes().empty()); const std::string language_code = input_method.language_codes().at(0); - text = StringToUpperASCII(UTF8ToUTF16(language_code)).substr( + text = StringToUpperASCII(base::UTF8ToUTF16(language_code)).substr( 0, kMaxLanguageNameLen); } DCHECK(!text.empty()); @@ -446,7 +446,7 @@ base::string16 InputMethodUtil::GetInputMethodLongName( const InputMethodDescriptor& input_method) const { if (!input_method.name().empty()) { // If the descriptor has a name, use it. - return UTF8ToUTF16(input_method.name()); + return base::UTF8ToUTF16(input_method.name()); } // We don't show language here. Name of keyboard layout or input method @@ -470,7 +470,7 @@ base::string16 InputMethodUtil::GetInputMethodLongName( const base::string16 language_name = delegate_->GetDisplayLanguageName( language_code); - text = language_name + UTF8ToUTF16(" - ") + text; + text = language_name + base::UTF8ToUTF16(" - ") + text; } DCHECK(!text.empty()); diff --git a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc index 9cb861b..2c1cc1d 100644 --- a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc +++ b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc @@ -16,6 +16,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" +using base::ASCIIToUTF16; + namespace chromeos { extern const char* kExtensionImePrefix; @@ -120,7 +122,7 @@ TEST_F(InputMethodUtilTest, GetInputMethodShortNameTest) { } { InputMethodDescriptor desc = GetDesc("mozc-hangul", "us", "ko"); - EXPECT_EQ(UTF8ToUTF16("\xed\x95\x9c"), + EXPECT_EQ(base::UTF8ToUTF16("\xed\x95\x9c"), util_.GetInputMethodShortName(desc)); } { @@ -157,12 +159,12 @@ TEST_F(InputMethodUtilTest, GetInputMethodShortNameTest) { } { InputMethodDescriptor desc = GetDesc(pinyin_ime_id, "us", "zh-CN"); - EXPECT_EQ(UTF8ToUTF16("\xe6\x8b\xbc"), + EXPECT_EQ(base::UTF8ToUTF16("\xe6\x8b\xbc"), util_.GetInputMethodShortName(desc)); } { InputMethodDescriptor desc = GetDesc(zhuyin_ime_id, "us", "zh-TW"); - EXPECT_EQ(UTF8ToUTF16("\xE6\xB3\xA8"), + EXPECT_EQ(base::UTF8ToUTF16("\xE6\xB3\xA8"), util_.GetInputMethodShortName(desc)); } } @@ -478,7 +480,7 @@ TEST_F(InputMethodUtilTest, TestIBusInputMethodText) { EXPECT_FALSE(display_name.empty()) << "Invalid language code " << language_code; // On error, GetDisplayNameForLocale() returns the |language_code| as-is. - EXPECT_NE(language_code, UTF16ToUTF8(display_name)) + EXPECT_NE(language_code, base::UTF16ToUTF8(display_name)) << "Invalid language code " << language_code; } } diff --git a/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc b/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc index a56dc60..d8ac3f0 100644 --- a/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc +++ b/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc @@ -34,8 +34,8 @@ IN_PROC_BROWSER_TEST_F(TextInput_SurroundingTextChangedTest, helper.WaitForTextInputStateChanged(ui::TEXT_INPUT_TYPE_TEXT_AREA); EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT_AREA, helper.GetTextInputType()); - const base::string16 sample_text1 = UTF8ToUTF16("abcde"); - const base::string16 sample_text2 = UTF8ToUTF16("fghij"); + const base::string16 sample_text1 = base::UTF8ToUTF16("abcde"); + const base::string16 sample_text2 = base::UTF8ToUTF16("fghij"); const base::string16 surrounding_text2 = sample_text1 + sample_text2; gfx::Range expected_range1(5, 5); gfx::Range expected_range2(10, 10); @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(TextInput_SurroundingTextChangedTest, helper.WaitForTextInputStateChanged(ui::TEXT_INPUT_TYPE_TEXT_AREA); EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT_AREA, helper.GetTextInputType()); - const base::string16 sample_text = UTF8ToUTF16("abcde"); + const base::string16 sample_text = base::UTF8ToUTF16("abcde"); gfx::Range expected_range(5, 5); ui::CompositionText composition_text; @@ -109,13 +109,13 @@ IN_PROC_BROWSER_TEST_F(TextInput_SurroundingTextChangedTest, helper.ClickElement("empty_textarea", tab); helper.WaitForTextInputStateChanged(ui::TEXT_INPUT_TYPE_TEXT_AREA); EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT_AREA, helper.GetTextInputType()); - helper.WaitForSurroundingTextChanged(UTF8ToUTF16(""), zero_range); + helper.WaitForSurroundingTextChanged(base::string16(), zero_range); EXPECT_TRUE(helper.GetSurroundingText().empty()); EXPECT_EQ(zero_range, helper.GetSelectionRange()); // Click textarea containing text, so expecting new surrounding text comes. helper.ClickElement("filled_textarea", tab); - const base::string16 expected_text = UTF8ToUTF16("abcde"); + const base::string16 expected_text = base::UTF8ToUTF16("abcde"); const gfx::Range expected_range(5, 5); helper.WaitForSurroundingTextChanged(expected_text, expected_range); EXPECT_EQ(expected_text, helper.GetSurroundingText()); @@ -125,7 +125,7 @@ IN_PROC_BROWSER_TEST_F(TextInput_SurroundingTextChangedTest, helper.ClickElement("empty_textarea", tab); helper.WaitForTextInputStateChanged(ui::TEXT_INPUT_TYPE_TEXT_AREA); EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT_AREA, helper.GetTextInputType()); - helper.WaitForSurroundingTextChanged(UTF8ToUTF16(""), zero_range); + helper.WaitForSurroundingTextChanged(base::string16(), zero_range); EXPECT_TRUE(helper.GetSurroundingText().empty()); EXPECT_EQ(zero_range, helper.GetSelectionRange()); } |