diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 13:14:23 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 13:14:23 +0000 |
commit | d18893ee6559342bfc97ba0432fbdaf1b3222712 (patch) | |
tree | 9ee18073cbdf2da518d3bffc4150b04400b3df55 /chrome/browser/chromeos/input_method | |
parent | dc6cc4791a83ce08a03ff103c6932d4d6e22cae3 (diff) | |
download | chromium_src-d18893ee6559342bfc97ba0432fbdaf1b3222712.zip chromium_src-d18893ee6559342bfc97ba0432fbdaf1b3222712.tar.gz chromium_src-d18893ee6559342bfc97ba0432fbdaf1b3222712.tar.bz2 |
Add a function that returns the descriptor of the hardware keyboard.
Along the way, remove call sites of CreateFallbackInputMethodDescriptors()
and GetHardwareKeyboardLayoutName(). Those functions are no longer used
in Chrome tree.
BUG=chromium-os:11528
TEST=manually confirmed that input methods worked as before
Review URL: http://codereview.chromium.org/6312116
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/input_method')
-rw-r--r-- | chrome/browser/chromeos/input_method/input_method_util.cc | 14 | ||||
-rw-r--r-- | chrome/browser/chromeos/input_method/input_method_util.h | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index cb579fb..ffe76e7 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -575,8 +575,9 @@ void EnableInputMethods(const std::string& language_code, InputMethodType type, std::vector<std::string> input_method_ids; GetInputMethodIdsFromLanguageCode(language_code, type, &input_method_ids); - std::string keyboard = CrosLibrary::Get()->GetKeyboardLibrary()-> - GetHardwareKeyboardLayoutName(); + // Add the hardware keyboard. + const std::string keyboard = + input_method::GetHardwareInputMethodDescriptor().id; if (std::count(input_method_ids.begin(), input_method_ids.end(), keyboard) == 0) { input_method_ids.push_back(keyboard); @@ -597,6 +598,15 @@ void EnableInputMethods(const std::string& language_code, InputMethodType type, } } +InputMethodDescriptor GetHardwareInputMethodDescriptor() { + // TODO(satorux): Rework this function. crosbug.com/11528. + return GetFallbackInputMethodDescriptor(); +} + +InputMethodDescriptor GetFallbackInputMethodDescriptor() { + return InputMethodDescriptor("xkb:us::eng", "USA", "us", "eng"); +} + void OnLocaleChanged() { IdMaps::GetInstance()->ReloadMaps(); } diff --git a/chrome/browser/chromeos/input_method/input_method_util.h b/chrome/browser/chromeos/input_method/input_method_util.h index 5818c6c..7b6b6da 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.h +++ b/chrome/browser/chromeos/input_method/input_method_util.h @@ -156,6 +156,13 @@ bool GetInputMethodIdsFromLanguageCode( void EnableInputMethods(const std::string& language_code, InputMethodType type, const std::string& initial_input_method_id); +// Returns the input method descriptor of the hardware keyboard. +InputMethodDescriptor GetHardwareInputMethodDescriptor(); + +// Returns the fallback input method descriptor (the very basic US +// keyboard). This function is mostly used for testing, but may be used +// as the fallback, when there is no other choice. +InputMethodDescriptor GetFallbackInputMethodDescriptor(); // DO NOT USE Functions below. These are only exported for unit tests. void SortInputMethodIdsByNamesInternal( |