summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 02:49:18 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 02:49:18 +0000
commit0ea7c9ae1a462fb2a01df11400ca1afe7592b0dc (patch)
tree79637435ab6b2222f6bd236646c38d5fa8e1e42e /chrome/browser
parent9ffc3de1ba01507a66a48125c9c46916e7becad5 (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/chromeos/options/language_config_view.cc6
-rw-r--r--chrome/browser/chromeos/options/language_config_view.h3
-rw-r--r--chrome/browser/chromeos/options/language_config_view_test.cc5
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