diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 02:49:18 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 02:49:18 +0000 |
commit | 0ea7c9ae1a462fb2a01df11400ca1afe7592b0dc (patch) | |
tree | 79637435ab6b2222f6bd236646c38d5fa8e1e42e /chrome/browser | |
parent | 9ffc3de1ba01507a66a48125c9c46916e7becad5 (diff) | |
download | chromium_src-0ea7c9ae1a462fb2a01df11400ca1afe7592b0dc.zip chromium_src-0ea7c9ae1a462fb2a01df11400ca1afe7592b0dc.tar.gz chromium_src-0ea7c9ae1a462fb2a01df11400ca1afe7592b0dc.tar.bz2 |
Add LanguageconfigView::IsKeyboardLayout()
TEST=wrote unit tests
BUG=none
Review URL: http://codereview.chromium.org/1519024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
3 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/options/language_config_view.cc b/chrome/browser/chromeos/options/language_config_view.cc index 6f72f8a..66fd7c7 100644 --- a/chrome/browser/chromeos/options/language_config_view.cc +++ b/chrome/browser/chromeos/options/language_config_view.cc @@ -683,4 +683,10 @@ std::string LanguageConfigView::NormalizeLanguageCode( return language_code; } +bool LanguageConfigView::IsKeyboardLayout( + const std::string& input_method_id) { + const bool case_insensitive = false; + return StartsWithASCII(input_method_id, "xkb:", case_insensitive); +} + } // namespace chromeos diff --git a/chrome/browser/chromeos/options/language_config_view.h b/chrome/browser/chromeos/options/language_config_view.h index 0dd64d2..1ef971c 100644 --- a/chrome/browser/chromeos/options/language_config_view.h +++ b/chrome/browser/chromeos/options/language_config_view.h @@ -90,6 +90,9 @@ class LanguageConfigView : public TableModel, static std::string NormalizeLanguageCode( const std::string& language_code); + // Returns true if the given input method id is for a keyboard layout. + static bool IsKeyboardLayout(const std::string& input_method_id); + private: // Initializes the input method config view. void InitInputMethodConfigViewMap(); diff --git a/chrome/browser/chromeos/options/language_config_view_test.cc b/chrome/browser/chromeos/options/language_config_view_test.cc index 7ee0946..2d254cb 100644 --- a/chrome/browser/chromeos/options/language_config_view_test.cc +++ b/chrome/browser/chromeos/options/language_config_view_test.cc @@ -27,4 +27,9 @@ TEST(LanguageConfigViewTest, NormalizeLanguageCode) { LanguageConfigView::NormalizeLanguageCode("zh_CN")); } +TEST(LanguageConfigViewTest, IsKeyboardLayout) { + EXPECT_TRUE(LanguageConfigView::IsKeyboardLayout("xkb:us::eng")); + EXPECT_FALSE(LanguageConfigView::IsKeyboardLayout("anthy")); +} + } // namespace chromeos |