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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 { "zh-t-i0-wubi-1986", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED }, | 45 { "zh-t-i0-wubi-1986", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED }, |
46 { "zh-hant-t-i0-und", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, | 46 { "zh-hant-t-i0-und", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
47 { "zh-hant-t-i0-cangjie-1987", | 47 { "zh-hant-t-i0-cangjie-1987", |
48 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, | 48 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
49 { "zh-hant-t-i0-cangjie-1987-x-m0-simplified", | 49 { "zh-hant-t-i0-cangjie-1987-x-m0-simplified", |
50 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, | 50 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
51 { extension_misc::kBrailleImeEngineId, | 51 { extension_misc::kBrailleImeEngineId, |
52 IDS_LANGUAGES_MEDIUM_LEN_NAME_BRAILLE }, | 52 IDS_LANGUAGES_MEDIUM_LEN_NAME_BRAILLE }, |
53 }; | 53 }; |
54 const size_t kMappingImeIdToMediumLenNameResourceIdLen = | 54 const size_t kMappingImeIdToMediumLenNameResourceIdLen = |
55 ARRAYSIZE_UNSAFE(kMappingImeIdToMediumLenNameResourceId); | 55 arraysize(kMappingImeIdToMediumLenNameResourceId); |
56 | 56 |
57 // Due to asynchronous initialization of component extension manager, | 57 // Due to asynchronous initialization of component extension manager, |
58 // GetFirstLogingInputMethodIds may miss component extension IMEs. To enable | 58 // GetFirstLogingInputMethodIds may miss component extension IMEs. To enable |
59 // component extension IME as the first loging input method, we have to prepare | 59 // component extension IME as the first loging input method, we have to prepare |
60 // component extension IME IDs. | 60 // component extension IME IDs. |
61 const struct { | 61 const struct { |
62 const char* locale; | 62 const char* locale; |
63 const char* layout; | 63 const char* layout; |
64 const char* engine_id; | 64 const char* engine_id; |
65 } kDefaultInputMethodRecommendation[] = { | 65 } kDefaultInputMethodRecommendation[] = { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 const std::string& language_code, | 378 const std::string& language_code, |
379 const InputMethodDescriptor& current_input_method, | 379 const InputMethodDescriptor& current_input_method, |
380 std::vector<std::string>* out_input_method_ids) const { | 380 std::vector<std::string>* out_input_method_ids) const { |
381 out_input_method_ids->clear(); | 381 out_input_method_ids->clear(); |
382 | 382 |
383 // First, add the current keyboard layout (one used on the login screen). | 383 // First, add the current keyboard layout (one used on the login screen). |
384 out_input_method_ids->push_back(current_input_method.id()); | 384 out_input_method_ids->push_back(current_input_method.id()); |
385 | 385 |
386 const std::string current_layout | 386 const std::string current_layout |
387 = current_input_method.GetPreferredKeyboardLayout(); | 387 = current_input_method.GetPreferredKeyboardLayout(); |
388 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultInputMethodRecommendation); | 388 for (size_t i = 0; i < arraysize(kDefaultInputMethodRecommendation); |
389 ++i) { | 389 ++i) { |
390 if (kDefaultInputMethodRecommendation[i].locale == language_code && | 390 if (kDefaultInputMethodRecommendation[i].locale == language_code && |
391 kDefaultInputMethodRecommendation[i].layout == current_layout) { | 391 kDefaultInputMethodRecommendation[i].layout == current_layout) { |
392 out_input_method_ids->push_back( | 392 out_input_method_ids->push_back( |
393 extension_ime_util::GetInputMethodIDByEngineID( | 393 extension_ime_util::GetInputMethodIDByEngineID( |
394 kDefaultInputMethodRecommendation[i].engine_id)); | 394 kDefaultInputMethodRecommendation[i].engine_id)); |
395 return; | 395 return; |
396 } | 396 } |
397 } | 397 } |
398 | 398 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 "US", | 616 "US", |
617 layouts, | 617 layouts, |
618 languages, | 618 languages, |
619 true, // login keyboard. | 619 true, // login keyboard. |
620 GURL(), // options page, not available. | 620 GURL(), // options page, not available. |
621 GURL()); // input view page, not available. | 621 GURL()); // input view page, not available. |
622 } | 622 } |
623 | 623 |
624 } // namespace input_method | 624 } // namespace input_method |
625 } // namespace chromeos | 625 } // namespace chromeos |
OLD | NEW |