Chromium Code Reviews| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "chromeos/ime/extension_ime_util.h" | 9 #include "chromeos/ime/extension_ime_util.h" |
| 10 | 10 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 if (extension_ime_util::IsKeyboardLayoutExtension(descriptors[i].id())) | 205 if (extension_ime_util::IsKeyboardLayoutExtension(descriptors[i].id())) |
| 206 result.push_back(descriptors[i]); | 206 result.push_back(descriptors[i]); |
| 207 } | 207 } |
| 208 return result; | 208 return result; |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool ComponentExtensionIMEManager::FindEngineEntry( | 211 bool ComponentExtensionIMEManager::FindEngineEntry( |
| 212 const std::string& input_method_id, | 212 const std::string& input_method_id, |
| 213 ComponentExtensionIME* out_extension, | 213 ComponentExtensionIME* out_extension, |
| 214 ComponentExtensionEngine* out_engine) { | 214 ComponentExtensionEngine* out_engine) { |
| 215 // LOG(ERROR) << "ComponentExtensionIMEManager::FindEngineEntry('" | |
| 216 // << input_method_id << "', out_extension=" << out_extension | |
| 217 // << ", out_engine=" << out_engine << "): Called."; | |
|
Shu Chen
2014/08/07 15:40:19
pls clean up all the logs.
Alexander Alekseev
2014/08/13 10:14:15
Done.
| |
| 215 if (!extension_ime_util::IsComponentExtensionIME(input_method_id)) | 218 if (!extension_ime_util::IsComponentExtensionIME(input_method_id)) |
| 216 return false; | 219 return false; |
| 217 for (size_t i = 0; i < component_extension_imes_.size(); ++i) { | 220 for (size_t i = 0; i < component_extension_imes_.size(); ++i) { |
| 218 const std::string extension_id = component_extension_imes_[i].id; | 221 const std::string extension_id = component_extension_imes_[i].id; |
| 219 const std::vector<ComponentExtensionEngine>& engines = | 222 const std::vector<ComponentExtensionEngine>& engines = |
| 220 component_extension_imes_[i].engines; | 223 component_extension_imes_[i].engines; |
| 221 | 224 |
| 225 // LOG(ERROR) << "ComponentExtensionIMEManager::FindEngineEntry('" | |
| 226 // << input_method_id << "', out_extension=" << out_extension | |
| 227 // << ", out_engine=" << out_engine << "): checking extension IME | |
| 228 // number " << i << " ."; | |
| 222 for (size_t j = 0; j < engines.size(); ++j) { | 229 for (size_t j = 0; j < engines.size(); ++j) { |
| 223 const std::string trial_ime_id = | 230 const std::string trial_ime_id = |
| 224 extension_ime_util::GetComponentInputMethodID( | 231 extension_ime_util::GetComponentInputMethodID( |
| 225 extension_id, engines[j].engine_id); | 232 extension_id, engines[j].engine_id); |
| 233 // LOG(ERROR) << "ComponentExtensionIMEManager::FindEngineEntry('" | |
| 234 // << input_method_id << "', out_extension=" << out_extension | |
| 235 // << ", out_engine=" << out_engine << "): checking engine name='" | |
| 236 // << engines[j].display_name << "' trial_ime_id='" << | |
| 237 // trial_ime_id << "'."; | |
| 238 | |
| 226 if (trial_ime_id != input_method_id) | 239 if (trial_ime_id != input_method_id) |
| 227 continue; | 240 continue; |
| 228 | 241 |
| 229 if (out_extension) | 242 if (out_extension) |
| 230 *out_extension = component_extension_imes_[i]; | 243 *out_extension = component_extension_imes_[i]; |
| 231 if (out_engine) | 244 if (out_engine) |
| 232 *out_engine = component_extension_imes_[i].engines[j]; | 245 *out_engine = component_extension_imes_[i].engines[j]; |
| 246 // LOG(ERROR) << "ComponentExtensionIMEManager::FindEngineEntry('" | |
| 247 // << input_method_id << "', out_extension=" << out_extension | |
| 248 // << ", out_engine=" << out_engine << "): Result is True."; | |
| 233 return true; | 249 return true; |
| 234 } | 250 } |
| 235 } | 251 } |
| 252 // LOG(ERROR) << "ComponentExtensionIMEManager::FindEngineEntry('" | |
| 253 // << input_method_id << "', out_extension=" << out_extension | |
| 254 // << ", out_engine=" << out_engine << "): Result is False."; | |
| 236 return false; | 255 return false; |
| 237 } | 256 } |
| 238 | 257 |
| 239 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( | 258 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( |
| 240 const std::vector<std::string>& layouts) { | 259 const std::vector<std::string>& layouts) { |
| 241 for (size_t i = 0; i < layouts.size(); ++i) { | 260 for (size_t i = 0; i < layouts.size(); ++i) { |
| 242 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) | 261 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) |
| 243 return true; | 262 return true; |
| 244 } | 263 } |
| 245 return false; | 264 return false; |
| 246 } | 265 } |
| 247 | 266 |
| 248 } // namespace chromeos | 267 } // namespace chromeos |
| OLD | NEW |