OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 std::string NormalizeLanguageCode( | 366 std::string NormalizeLanguageCode( |
367 const std::string& language_code) { | 367 const std::string& language_code) { |
368 // Some ibus engines return locale codes like "zh_CN" as language codes. | 368 // Some ibus engines return locale codes like "zh_CN" as language codes. |
369 // Normalize these to like "zh-CN". | 369 // Normalize these to like "zh-CN". |
370 if (language_code.size() >= 5 && language_code[2] == '_') { | 370 if (language_code.size() >= 5 && language_code[2] == '_') { |
371 std::string copied_language_code = language_code; | 371 std::string copied_language_code = language_code; |
372 copied_language_code[2] = '-'; | 372 copied_language_code[2] = '-'; |
373 // Downcase the language code part. | 373 // Downcase the language code part. |
374 for (size_t i = 0; i < 2; ++i) { | 374 for (size_t i = 0; i < 2; ++i) { |
375 copied_language_code[i] = ToLowerASCII(copied_language_code[i]); | 375 copied_language_code[i] = base::ToLowerASCII(copied_language_code[i]); |
376 } | 376 } |
377 // Upcase the country code part. | 377 // Upcase the country code part. |
378 for (size_t i = 3; i < copied_language_code.size(); ++i) { | 378 for (size_t i = 3; i < copied_language_code.size(); ++i) { |
379 copied_language_code[i] = ToUpperASCII(copied_language_code[i]); | 379 copied_language_code[i] = ToUpperASCII(copied_language_code[i]); |
380 } | 380 } |
381 return copied_language_code; | 381 return copied_language_code; |
382 } | 382 } |
383 // We only handle three-letter codes from here. | 383 // We only handle three-letter codes from here. |
384 if (language_code.size() != 3) { | 384 if (language_code.size() != 3) { |
385 return language_code; | 385 return language_code; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 library->ChangeInputMethod(initial_input_method_id); | 591 library->ChangeInputMethod(initial_input_method_id); |
592 } | 592 } |
593 } | 593 } |
594 | 594 |
595 void OnLocaleChanged() { | 595 void OnLocaleChanged() { |
596 Singleton<IdMaps>::get()->ReloadMaps(); | 596 Singleton<IdMaps>::get()->ReloadMaps(); |
597 } | 597 } |
598 | 598 |
599 } // namespace input_method | 599 } // namespace input_method |
600 } // namespace chromeos | 600 } // namespace chromeos |
OLD | NEW |