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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // TODO(yusukes): Some languages have two or more input methods. For example, | 373 // TODO(yusukes): Some languages have two or more input methods. For example, |
374 // Thai has 3, Vietnamese has 4. If these input methods could be activated at | 374 // Thai has 3, Vietnamese has 4. If these input methods could be activated at |
375 // the same time, we should do either of the following: | 375 // the same time, we should do either of the following: |
376 // (1) Add mappings to |kMappingFromIdToIndicatorText| | 376 // (1) Add mappings to |kMappingFromIdToIndicatorText| |
377 // (2) Add suffix (1, 2, ...) to |text| when ambiguous. | 377 // (2) Add suffix (1, 2, ...) to |text| when ambiguous. |
378 | 378 |
379 if (text.empty()) { | 379 if (text.empty()) { |
380 const size_t kMaxLanguageNameLen = 2; | 380 const size_t kMaxLanguageNameLen = 2; |
381 DCHECK(!input_method.language_codes().empty()); | 381 DCHECK(!input_method.language_codes().empty()); |
382 const std::string language_code = input_method.language_codes().at(0); | 382 const std::string language_code = input_method.language_codes().at(0); |
383 text = StringToUpperASCII(base::UTF8ToUTF16(language_code)).substr( | 383 text = base::StringToUpperASCII(base::UTF8ToUTF16(language_code)).substr( |
384 0, kMaxLanguageNameLen); | 384 0, kMaxLanguageNameLen); |
385 } | 385 } |
386 DCHECK(!text.empty()) << input_method.id(); | 386 DCHECK(!text.empty()) << input_method.id(); |
387 return text; | 387 return text; |
388 } | 388 } |
389 | 389 |
390 base::string16 InputMethodUtil::GetInputMethodMediumName( | 390 base::string16 InputMethodUtil::GetInputMethodMediumName( |
391 const InputMethodDescriptor& input_method) const { | 391 const InputMethodDescriptor& input_method) const { |
392 // For the "Your input method has changed to..." bubble. In most cases | 392 // For the "Your input method has changed to..." bubble. In most cases |
393 // it uses the same name as the short name, unless found in a table | 393 // it uses the same name as the short name, unless found in a table |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 "US", | 720 "US", |
721 layouts, | 721 layouts, |
722 languages, | 722 languages, |
723 true, // login keyboard. | 723 true, // login keyboard. |
724 GURL(), // options page, not available. | 724 GURL(), // options page, not available. |
725 GURL()); // input view page, not available. | 725 GURL()); // input view page, not available. |
726 } | 726 } |
727 | 727 |
728 } // namespace input_method | 728 } // namespace input_method |
729 } // namespace chromeos | 729 } // namespace chromeos |
OLD | NEW |