| 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/input_method_whitelist.h" | 5 #include "chromeos/ime/input_method_whitelist.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chromeos/ime/extension_ime_util.h" |
| 10 #include "chromeos/ime/input_method_descriptor.h" | 11 #include "chromeos/ime/input_method_descriptor.h" |
| 11 #include "chromeos/ime/input_methods.h" | 12 #include "chromeos/ime/input_methods.h" |
| 12 | 13 |
| 13 namespace chromeos { | 14 namespace chromeos { |
| 14 namespace input_method { | 15 namespace input_method { |
| 15 | 16 |
| 16 const char kLanguageDelimiter[] = ","; | 17 const char kLanguageDelimiter[] = ","; |
| 17 | 18 |
| 18 InputMethodWhitelist::InputMethodWhitelist() { | 19 InputMethodWhitelist::InputMethodWhitelist() { |
| 19 for (size_t i = 0; i < arraysize(kInputMethods); ++i) { | 20 for (size_t i = 0; i < arraysize(kInputMethods); ++i) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 input_methods->reserve(arraysize(kInputMethods)); | 36 input_methods->reserve(arraysize(kInputMethods)); |
| 36 for (size_t i = 0; i < arraysize(kInputMethods); ++i) { | 37 for (size_t i = 0; i < arraysize(kInputMethods); ++i) { |
| 37 std::vector<std::string> layouts; | 38 std::vector<std::string> layouts; |
| 38 layouts.push_back(kInputMethods[i].xkb_layout_id); | 39 layouts.push_back(kInputMethods[i].xkb_layout_id); |
| 39 | 40 |
| 40 std::vector<std::string> languages; | 41 std::vector<std::string> languages; |
| 41 Tokenize(kInputMethods[i].language_code, kLanguageDelimiter, &languages); | 42 Tokenize(kInputMethods[i].language_code, kLanguageDelimiter, &languages); |
| 42 DCHECK(!languages.empty()); | 43 DCHECK(!languages.empty()); |
| 43 | 44 |
| 44 input_methods->push_back(InputMethodDescriptor( | 45 input_methods->push_back(InputMethodDescriptor( |
| 45 kInputMethods[i].input_method_id, | 46 extension_ime_util::GetInputMethodIDByKeyboardLayout( |
| 47 kInputMethods[i].input_method_id), |
| 46 "", | 48 "", |
| 47 kInputMethods[i].indicator, | 49 kInputMethods[i].indicator, |
| 48 layouts, | 50 layouts, |
| 49 languages, | 51 languages, |
| 50 kInputMethods[i].is_login_keyboard, | 52 kInputMethods[i].is_login_keyboard, |
| 51 GURL(), // options page url. | 53 GURL(), // options page url. |
| 52 GURL() // input view page url. | 54 GURL() // input view page url. |
| 53 )); | 55 )); |
| 54 } | 56 } |
| 55 return input_methods.Pass(); | 57 return input_methods.Pass(); |
| 56 } | 58 } |
| 57 | 59 |
| 58 } // namespace input_method | 60 } // namespace input_method |
| 59 } // namespace chromeos | 61 } // namespace chromeos |
| OLD | NEW |