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