OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/ime/component_extension_ime_manager.h" | 5 #include "chromeos/ime/component_extension_ime_manager.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chromeos/chromeos_switches.h" |
9 #include "chromeos/ime/extension_ime_util.h" | 11 #include "chromeos/ime/extension_ime_util.h" |
10 | 12 |
11 namespace chromeos { | 13 namespace chromeos { |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 // The whitelist for enabling extension based xkb keyboards at login session. | 17 // The whitelist for enabling extension based xkb keyboards at login session. |
16 const char* kLoginLayoutWhitelist[] = { | 18 const char* kLoginLayoutWhitelist[] = { |
17 "be", | 19 "be", |
18 "br", | 20 "br", |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 136 } |
135 | 137 |
136 bool ComponentExtensionIMEManager::IsWhitelistedExtension( | 138 bool ComponentExtensionIMEManager::IsWhitelistedExtension( |
137 const std::string& extension_id) { | 139 const std::string& extension_id) { |
138 return component_extension_imes_.find(extension_id) != | 140 return component_extension_imes_.find(extension_id) != |
139 component_extension_imes_.end(); | 141 component_extension_imes_.end(); |
140 } | 142 } |
141 | 143 |
142 input_method::InputMethodDescriptors | 144 input_method::InputMethodDescriptors |
143 ComponentExtensionIMEManager::GetAllIMEAsInputMethodDescriptor() { | 145 ComponentExtensionIMEManager::GetAllIMEAsInputMethodDescriptor() { |
| 146 bool enable_new_korean_ime = CommandLine::ForCurrentProcess()->HasSwitch( |
| 147 switches::kEnableNewKoreanIme); |
144 input_method::InputMethodDescriptors result; | 148 input_method::InputMethodDescriptors result; |
145 for (std::map<std::string, ComponentExtensionIME>::const_iterator it = | 149 for (std::map<std::string, ComponentExtensionIME>::const_iterator it = |
146 component_extension_imes_.begin(); | 150 component_extension_imes_.begin(); |
147 it != component_extension_imes_.end(); ++it) { | 151 it != component_extension_imes_.end(); ++it) { |
148 const ComponentExtensionIME& ext = it->second; | 152 const ComponentExtensionIME& ext = it->second; |
149 for (size_t j = 0; j < ext.engines.size(); ++j) { | 153 for (size_t j = 0; j < ext.engines.size(); ++j) { |
150 const ComponentExtensionEngine& ime = ext.engines[j]; | 154 const ComponentExtensionEngine& ime = ext.engines[j]; |
| 155 // Filter out new Korean IME if the experimental flag is OFF. |
| 156 if (!enable_new_korean_ime && ime.engine_id == "ko-t-i0-und") |
| 157 continue; |
151 const std::string input_method_id = | 158 const std::string input_method_id = |
152 extension_ime_util::GetComponentInputMethodID( | 159 extension_ime_util::GetComponentInputMethodID( |
153 ext.id, ime.engine_id); | 160 ext.id, ime.engine_id); |
154 const std::vector<std::string>& layouts = ime.layouts; | 161 const std::vector<std::string>& layouts = ime.layouts; |
155 result.push_back( | 162 result.push_back( |
156 input_method::InputMethodDescriptor( | 163 input_method::InputMethodDescriptor( |
157 input_method_id, | 164 input_method_id, |
158 ime.display_name, | 165 ime.display_name, |
159 ime.indicator, | 166 ime.indicator, |
160 layouts, | 167 layouts, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( | 209 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( |
203 const std::vector<std::string>& layouts) { | 210 const std::vector<std::string>& layouts) { |
204 for (size_t i = 0; i < layouts.size(); ++i) { | 211 for (size_t i = 0; i < layouts.size(); ++i) { |
205 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) | 212 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) |
206 return true; | 213 return true; |
207 } | 214 } |
208 return false; | 215 return false; |
209 } | 216 } |
210 | 217 |
211 } // namespace chromeos | 218 } // namespace chromeos |
OLD | NEW |