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 "chrome/browser/chromeos/input_method/component_extension_ime_manager_i
mpl.h" | 5 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i
mpl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 return false; | 313 return false; |
314 if (!dict.GetString(extensions::manifest_keys::kId, &out->engine_id)) | 314 if (!dict.GetString(extensions::manifest_keys::kId, &out->engine_id)) |
315 return false; | 315 return false; |
316 if (!dict.GetString(extensions::manifest_keys::kName, &out->display_name)) | 316 if (!dict.GetString(extensions::manifest_keys::kName, &out->display_name)) |
317 return false; | 317 return false; |
318 | 318 |
319 // Localizes the input method name. | 319 // Localizes the input method name. |
320 if (out->display_name.find("__MSG_") == 0) { | 320 if (out->display_name.find("__MSG_") == 0) { |
321 const InputMethodNameMap* map = kInputMethodNameMap; | 321 const InputMethodNameMap* map = kInputMethodNameMap; |
322 size_t map_size = arraysize(kInputMethodNameMap); | 322 size_t map_size = arraysize(kInputMethodNameMap); |
323 std::string name = base::StringToUpperASCII(out->display_name); | 323 std::string name = StringToUpperASCII(out->display_name); |
324 const InputMethodNameMap map_key = {name.c_str(), 0}; | 324 const InputMethodNameMap map_key = {name.c_str(), 0}; |
325 const InputMethodNameMap* p = | 325 const InputMethodNameMap* p = |
326 std::lower_bound(map, map + map_size, map_key); | 326 std::lower_bound(map, map + map_size, map_key); |
327 if (p != map + map_size && name == p->message_name) | 327 if (p != map + map_size && name == p->message_name) |
328 out->display_name = l10n_util::GetStringUTF8(p->resource_id); | 328 out->display_name = l10n_util::GetStringUTF8(p->resource_id); |
329 } | 329 } |
330 DCHECK(out->display_name.find("__MSG_") == std::string::npos); | 330 DCHECK(out->display_name.find("__MSG_") == std::string::npos); |
331 | 331 |
332 std::set<std::string> languages; | 332 std::set<std::string> languages; |
333 const base::Value* language_value = NULL; | 333 const base::Value* language_value = NULL; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 457 |
458 ComponentExtensionEngine engine; | 458 ComponentExtensionEngine engine; |
459 ReadEngineComponent(component_ime, *dictionary, &engine); | 459 ReadEngineComponent(component_ime, *dictionary, &engine); |
460 component_ime.engines.push_back(engine); | 460 component_ime.engines.push_back(engine); |
461 } | 461 } |
462 out_imes->push_back(component_ime); | 462 out_imes->push_back(component_ime); |
463 } | 463 } |
464 } | 464 } |
465 | 465 |
466 } // namespace chromeos | 466 } // namespace chromeos |
OLD | NEW |