Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: chromeos/ime/component_extension_ime_manager.cc

Issue 178343005: [IME] migrate the xkb ID to extension based xkb ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/ime/component_extension_ime_manager.h ('k') | chromeos/ime/extension_ime_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/ime/component_extension_ime_manager.cc
diff --git a/chromeos/ime/component_extension_ime_manager.cc b/chromeos/ime/component_extension_ime_manager.cc
index b31470b52089e1fb9d39477b89327f2b5ff435d2..3037326346bc5fd82b4e6b8e86efcae556505206 100644
--- a/chromeos/ime/component_extension_ime_manager.cc
+++ b/chromeos/ime/component_extension_ime_manager.cc
@@ -10,6 +10,53 @@
namespace chromeos {
+namespace {
+
+// The whitelist for enabling extension based xkb keyboards at login session.
+const char* kLoginLayoutWhitelist[] = {
+ "be",
+ "br",
+ "ca",
+ "ca(eng)",
+ "ca(multix)",
+ "ch",
+ "ch(fr)",
+ "cz",
+ "cz(qwerty)",
+ "de",
+ "de(neo)",
+ "dk",
+ "ee",
+ "es",
+ "es(cat)",
+ "fi",
+ "fr",
+ "gb(dvorak)",
+ "gb(extd)",
+ "hr",
+ "hu",
+ "is",
+ "it",
+ "jp",
+ "latam",
+ "lt",
+ "lv(apostrophe)",
+ "no",
+ "pl",
+ "pt",
+ "ro",
+ "se",
+ "si",
+ "tr",
+ "us",
+ "us(altgr-intl)",
+ "us(colemak)",
+ "us(dvorak)",
+ "us(intl)"
+};
+
+} // namespace
+
ComponentExtensionEngine::ComponentExtensionEngine() {
}
@@ -30,6 +77,9 @@ ComponentExtensionIMEManagerDelegate::~ComponentExtensionIMEManagerDelegate() {
ComponentExtensionIMEManager::ComponentExtensionIMEManager()
: is_initialized_(false) {
+ for (size_t i = 0; i < arraysize(kLoginLayoutWhitelist); ++i) {
+ login_layout_set_.insert(kLoginLayoutWhitelist[i]);
+ }
}
ComponentExtensionIMEManager::~ComponentExtensionIMEManager() {
@@ -134,15 +184,18 @@ input_method::InputMethodDescriptors
extension_ime_util::GetComponentInputMethodID(
component_extension_imes_[i].id,
component_extension_imes_[i].engines[j].engine_id);
+ const std::vector<std::string>& layouts =
+ component_extension_imes_[i].engines[j].layouts;
result.push_back(
input_method::InputMethodDescriptor(
input_method_id,
component_extension_imes_[i].engines[j].display_name,
std::string(), // TODO(uekawa): Set short name.
- component_extension_imes_[i].engines[j].layouts,
+ layouts,
component_extension_imes_[i].engines[j].language_codes,
// Enables extension based xkb keyboards on login screen.
- extension_ime_util::IsKeyboardLayoutExtension(input_method_id),
+ extension_ime_util::IsKeyboardLayoutExtension(
+ input_method_id) && IsInLoginLayoutWhitelist(layouts),
component_extension_imes_[i].options_page_url,
component_extension_imes_[i].input_view_url));
}
@@ -186,4 +239,13 @@ bool ComponentExtensionIMEManager::FindEngineEntry(
return false;
}
+bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist(
+ const std::vector<std::string>& layouts) {
+ for (size_t i = 0; i < layouts.size(); ++i) {
+ if (login_layout_set_.find(layouts[i]) != login_layout_set_.end())
+ return true;
+ }
+ return false;
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/ime/component_extension_ime_manager.h ('k') | chromeos/ime/extension_ime_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698