| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/input_method_util.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 | 872 |
| 873 // Clear the existing maps. | 873 // Clear the existing maps. |
| 874 language_code_to_ids_.clear(); | 874 language_code_to_ids_.clear(); |
| 875 id_to_language_code_.clear(); | 875 id_to_language_code_.clear(); |
| 876 id_to_descriptor_.clear(); | 876 id_to_descriptor_.clear(); |
| 877 xkb_id_to_descriptor_.clear(); | 877 xkb_id_to_descriptor_.clear(); |
| 878 | 878 |
| 879 for (size_t i = 0; i < supported_input_methods_->size(); ++i) { | 879 for (size_t i = 0; i < supported_input_methods_->size(); ++i) { |
| 880 const InputMethodDescriptor& input_method = | 880 const InputMethodDescriptor& input_method = |
| 881 supported_input_methods_->at(i); | 881 supported_input_methods_->at(i); |
| 882 const std::string input_method_id = |
| 883 extension_ime_util::GetInputMethodIDByKeyboardLayout(input_method.id()); |
| 882 const std::vector<std::string>& language_codes = | 884 const std::vector<std::string>& language_codes = |
| 883 input_method.language_codes(); | 885 input_method.language_codes(); |
| 884 for (size_t i = 0; i < language_codes.size(); ++i) { | 886 for (size_t i = 0; i < language_codes.size(); ++i) { |
| 885 language_code_to_ids_.insert( | 887 language_code_to_ids_.insert( |
| 886 std::make_pair(language_codes[i], input_method.id())); | 888 std::make_pair(language_codes[i], input_method_id)); |
| 887 // Remember the pairs. | 889 // Remember the pairs. |
| 888 id_to_language_code_.insert( | 890 id_to_language_code_.insert( |
| 889 std::make_pair(input_method.id(), language_codes[i])); | 891 std::make_pair(input_method_id, language_codes[i])); |
| 890 } | 892 } |
| 891 id_to_descriptor_.insert( | 893 id_to_descriptor_.insert( |
| 892 std::make_pair(input_method.id(), input_method)); | 894 std::make_pair(input_method_id, input_method)); |
| 893 if (IsKeyboardLayout(input_method.id())) { | 895 if (IsKeyboardLayout(input_method_id)) { |
| 894 xkb_id_to_descriptor_.insert( | 896 xkb_id_to_descriptor_.insert( |
| 895 std::make_pair(input_method.GetPreferredKeyboardLayout(), | 897 std::make_pair(input_method.GetPreferredKeyboardLayout(), |
| 896 input_method)); | 898 input_method)); |
| 897 } | 899 } |
| 898 } | 900 } |
| 899 } | 901 } |
| 900 | 902 |
| 901 } // namespace input_method | 903 } // namespace input_method |
| 902 } // namespace chromeos | 904 } // namespace chromeos |
| OLD | NEW |