diff options
| author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 06:45:53 +0000 |
|---|---|---|
| committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 06:45:53 +0000 |
| commit | dc7b094a338c6c521f918f478e993f0f74bbea0d (patch) | |
| tree | 14b873b4d90182e0a01dec280ae76b0d54e96235 /chrome/browser/ui/webui | |
| parent | c033c4d76336017a17a77ae6100941761ae64693 (diff) | |
| download | chromium_src-dc7b094a338c6c521f918f478e993f0f74bbea0d.zip chromium_src-dc7b094a338c6c521f918f478e993f0f74bbea0d.tar.gz chromium_src-dc7b094a338c6c521f918f478e993f0f74bbea0d.tar.bz2 | |
Remove use of libcros from InputMethodLibrary.
BUG=chromium-os:16238
TEST==confirm that input methods work as before on the netbook. Also confirm that the chrome builds and works on the desktop as before.
Review URL: http://codereview.chromium.org/7003086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui')
4 files changed, 32 insertions, 30 deletions
diff --git a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc index 878cb18..88c857a 100644 --- a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc +++ b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc @@ -319,7 +319,7 @@ void KeyboardOverlayHandler::RegisterMessages() { void KeyboardOverlayHandler::GetKeyboardOverlayId(const ListValue* args) { chromeos::InputMethodLibrary* library = chromeos::CrosLibrary::Get()->GetInputMethodLibrary(); - const chromeos::InputMethodDescriptor& descriptor = + const chromeos::input_method::InputMethodDescriptor& descriptor = library->current_input_method(); const std::string keyboard_overlay_id = library->GetKeyboardOverlayId(descriptor.id); diff --git a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc index 4b04d74a..8e24098 100644 --- a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc @@ -61,7 +61,7 @@ void CrosLanguageOptionsHandler::GetLocalizedValues( // GetSupportedInputMethods() never return NULL. InputMethodLibrary *im_library = CrosLibrary::Get()->GetInputMethodLibrary(); - scoped_ptr<chromeos::InputMethodDescriptors> descriptors( + scoped_ptr<input_method::InputMethodDescriptors> descriptors( im_library->GetSupportedInputMethods()); localized_strings->Set("languageList", GetLanguageList(*descriptors)); localized_strings->Set("inputMethodList", GetInputMethodList(*descriptors)); @@ -84,15 +84,16 @@ void CrosLanguageOptionsHandler::RegisterMessages() { } ListValue* CrosLanguageOptionsHandler::GetInputMethodList( - const chromeos::InputMethodDescriptors& descriptors) { + const input_method::InputMethodDescriptors& descriptors) { ListValue* input_method_list = new ListValue(); for (size_t i = 0; i < descriptors.size(); ++i) { - const chromeos::InputMethodDescriptor& descriptor = descriptors[i]; + const input_method::InputMethodDescriptor& descriptor = + descriptors[i]; const std::string language_code = - chromeos::input_method::GetLanguageCodeFromDescriptor(descriptor); + input_method::GetLanguageCodeFromDescriptor(descriptor); const std::string display_name = - chromeos::input_method::GetInputMethodDisplayNameFromId(descriptor.id); + input_method::GetInputMethodDisplayNameFromId(descriptor.id); DictionaryValue* dictionary = new DictionaryValue(); dictionary->SetString("id", descriptor.id); @@ -104,12 +105,12 @@ ListValue* CrosLanguageOptionsHandler::GetInputMethodList( language_codes->SetBoolean(language_code, true); // Check kExtraLanguages to see if there are languages associated with // this input method. If these are present, add these. - for (size_t j = 0; j < arraysize(chromeos::input_method::kExtraLanguages); + for (size_t j = 0; j < arraysize(input_method::kExtraLanguages); ++j) { const std::string extra_input_method_id = - chromeos::input_method::kExtraLanguages[j].input_method_id; + input_method::kExtraLanguages[j].input_method_id; const std::string extra_language_code = - chromeos::input_method::kExtraLanguages[j].language_code; + input_method::kExtraLanguages[j].language_code; if (extra_input_method_id == descriptor.id) { language_codes->SetBoolean(extra_language_code, true); } @@ -123,20 +124,20 @@ ListValue* CrosLanguageOptionsHandler::GetInputMethodList( } ListValue* CrosLanguageOptionsHandler::GetLanguageList( - const chromeos::InputMethodDescriptors& descriptors) { + const input_method::InputMethodDescriptors& descriptors) { std::set<std::string> language_codes; // Collect the language codes from the supported input methods. for (size_t i = 0; i < descriptors.size(); ++i) { - const chromeos::InputMethodDescriptor& descriptor = descriptors[i]; + const input_method::InputMethodDescriptor& descriptor = descriptors[i]; const std::string language_code = - chromeos::input_method::GetLanguageCodeFromDescriptor(descriptor); + input_method::GetLanguageCodeFromDescriptor(descriptor); language_codes.insert(language_code); } // Collect the language codes from kExtraLanguages. - for (size_t i = 0; i < arraysize(chromeos::input_method::kExtraLanguages); + for (size_t i = 0; i < arraysize(input_method::kExtraLanguages); ++i) { const char* language_code = - chromeos::input_method::kExtraLanguages[i].language_code; + input_method::kExtraLanguages[i].language_code; language_codes.insert(language_code); } @@ -154,9 +155,9 @@ ListValue* CrosLanguageOptionsHandler::GetLanguageList( for (std::set<std::string>::const_iterator iter = language_codes.begin(); iter != language_codes.end(); ++iter) { const string16 display_name = - chromeos::input_method::GetLanguageDisplayNameFromCode(*iter); + input_method::GetLanguageDisplayNameFromCode(*iter); const string16 native_display_name = - chromeos::input_method::GetLanguageNativeDisplayNameFromCode(*iter); + input_method::GetLanguageNativeDisplayNameFromCode(*iter); display_names.push_back(display_name); language_map[display_name] = std::make_pair(*iter, native_display_name); diff --git a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.h b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.h index c8635f6..0501514 100644 --- a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.h @@ -34,14 +34,14 @@ class CrosLanguageOptionsHandler : public LanguageOptionsHandlerCommon { // Note that true in languageCodeSet does not mean anything. We just use // the dictionary as a set. static ListValue* GetInputMethodList( - const chromeos::InputMethodDescriptors& descriptors); + const input_method::InputMethodDescriptors& descriptors); // Gets the list of languages from the given input descriptors. // The return value will look like: // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, // ...] static ListValue* GetLanguageList( - const chromeos::InputMethodDescriptors& descriptors); + const input_method::InputMethodDescriptors& descriptors); private: // LanguageOptionsHandlerCommon implementation. diff --git a/chrome/browser/ui/webui/options/language_options_handler_unittest.cc b/chrome/browser/ui/webui/options/language_options_handler_unittest.cc index d7a9d7c..c426911 100644 --- a/chrome/browser/ui/webui/options/language_options_handler_unittest.cc +++ b/chrome/browser/ui/webui/options/language_options_handler_unittest.cc @@ -17,20 +17,21 @@ #endif // defined(OS_CHROMEOS) #if defined(OS_CHROMEOS) -static chromeos::InputMethodDescriptors CreateInputMethodDescriptors() { - chromeos::InputMethodDescriptors descriptors; + +using chromeos::input_method::InputMethodDescriptor; +using chromeos::input_method::InputMethodDescriptors; + +static InputMethodDescriptors CreateInputMethodDescriptors() { + InputMethodDescriptors descriptors; descriptors.push_back( - chromeos::InputMethodDescriptor("xkb:us::eng", "USA", - "us", "us", "eng")); + InputMethodDescriptor("xkb:us::eng", "USA", "us", "us", "eng")); descriptors.push_back( - chromeos::InputMethodDescriptor("xkb:fr::fra", "France", - "fr", "fr", "fra")); + InputMethodDescriptor("xkb:fr::fra", "France", "fr", "fr", "fra")); descriptors.push_back( - chromeos::InputMethodDescriptor("xkb:be::fra", "Belgium", - "be", "be", "fr")); + InputMethodDescriptor("xkb:be::fra", "Belgium", "be", "be", "fr")); descriptors.push_back( - chromeos::InputMethodDescriptor("mozc", "Mozc (US keyboard layout)", - "us", "us", "ja")); + InputMethodDescriptor("mozc", "Mozc (US keyboard layout)", + "us", "us", "ja")); return descriptors; } @@ -44,7 +45,7 @@ TEST(LanguageOptionsHandlerTest, GetInputMethodList) { chromeos::CrosLibrary::Get()->GetTestApi()->SetInputMethodLibrary(NULL, false); - chromeos::InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); + InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); scoped_ptr<ListValue> list( chromeos::CrosLanguageOptionsHandler::GetInputMethodList(descriptors)); ASSERT_EQ(4U, list->GetSize()); @@ -98,7 +99,7 @@ TEST(LanguageOptionsHandlerTest, GetInputMethodList) { } TEST(LanguageOptionsHandlerTest, GetLanguageList) { - chromeos::InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); + InputMethodDescriptors descriptors = CreateInputMethodDescriptors(); scoped_ptr<ListValue> list( chromeos::CrosLanguageOptionsHandler::GetLanguageList(descriptors)); ASSERT_EQ(7U, list->GetSize()); |
