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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 }; | 247 }; |
248 const size_t kEnglishToResourceIdArraySize = | 248 const size_t kEnglishToResourceIdArraySize = |
249 arraysize(kEnglishToResourceIdArray); | 249 arraysize(kEnglishToResourceIdArray); |
250 | 250 |
251 } // namespace | 251 } // namespace |
252 | 252 |
253 namespace chromeos { | 253 namespace chromeos { |
254 | 254 |
255 namespace input_method { | 255 namespace input_method { |
256 | 256 |
257 InputMethodUtil::InputMethodUtil( | 257 InputMethodUtil::InputMethodUtil(InputMethodDelegate* delegate) |
258 InputMethodDelegate* delegate, | |
259 scoped_ptr<InputMethodDescriptors> supported_input_methods) | |
260 : delegate_(delegate) { | 258 : delegate_(delegate) { |
261 // Makes sure the supported input methods at least have the fallback ime. | 259 InputMethodDescriptors default_input_methods; |
262 // So that it won't cause massive test failures. | 260 default_input_methods.push_back(GetFallbackInputMethodDescriptor()); |
263 if (supported_input_methods->empty()) | 261 ResetInputMethods(default_input_methods); |
264 supported_input_methods->push_back(GetFallbackInputMethodDescriptor()); | |
265 | |
266 ResetInputMethods(*supported_input_methods); | |
267 | 262 |
268 // Initialize a map from English string to Chrome string resource ID as well. | 263 // Initialize a map from English string to Chrome string resource ID as well. |
269 for (size_t i = 0; i < kEnglishToResourceIdArraySize; ++i) { | 264 for (size_t i = 0; i < kEnglishToResourceIdArraySize; ++i) { |
270 const EnglishToResouceId& map_entry = kEnglishToResourceIdArray[i]; | 265 const EnglishToResouceId& map_entry = kEnglishToResourceIdArray[i]; |
271 const bool result = english_to_resource_id_.insert(std::make_pair( | 266 const bool result = english_to_resource_id_.insert(std::make_pair( |
272 map_entry.english_string_from_ibus, map_entry.resource_id)).second; | 267 map_entry.english_string_from_ibus, map_entry.resource_id)).second; |
273 DCHECK(result) << "Duplicated string is found: " | 268 DCHECK(result) << "Duplicated string is found: " |
274 << map_entry.english_string_from_ibus; | 269 << map_entry.english_string_from_ibus; |
275 } | 270 } |
276 | 271 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 "US", | 720 "US", |
726 layouts, | 721 layouts, |
727 languages, | 722 languages, |
728 true, // login keyboard. | 723 true, // login keyboard. |
729 GURL(), // options page, not available. | 724 GURL(), // options page, not available. |
730 GURL()); // input view page, not available. | 725 GURL()); // input view page, not available. |
731 } | 726 } |
732 | 727 |
733 } // namespace input_method | 728 } // namespace input_method |
734 } // namespace chromeos | 729 } // namespace chromeos |
OLD | NEW |