| 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/status/input_method_menu.h" | 5 #include "chrome/browser/chromeos/status/input_method_menu.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include <gtk/gtk.h> // for gtk_menu_shell_set_take_focus. | 9 #include <gtk/gtk.h> // for gtk_menu_shell_set_take_focus. |
| 10 | 10 |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 | 563 |
| 564 if (text.empty()) { | 564 if (text.empty()) { |
| 565 const size_t kMaxLanguageNameLen = 2; | 565 const size_t kMaxLanguageNameLen = 2; |
| 566 std::string language_code = | 566 std::string language_code = |
| 567 input_method::GetLanguageCodeFromDescriptor(input_method); | 567 input_method::GetLanguageCodeFromDescriptor(input_method); |
| 568 | 568 |
| 569 // Use "CN" for simplified Chinese and "TW" for traditonal Chinese, | 569 // Use "CN" for simplified Chinese and "TW" for traditonal Chinese, |
| 570 // rather than "ZH". | 570 // rather than "ZH". |
| 571 if (StartsWithASCII(language_code, "zh-", false)) { | 571 if (StartsWithASCII(language_code, "zh-", false)) { |
| 572 std::vector<std::string> portions; | 572 std::vector<std::string> portions; |
| 573 SplitString(language_code, '-', &portions); | 573 base::SplitString(language_code, '-', &portions); |
| 574 if (portions.size() >= 2 && !portions[1].empty()) { | 574 if (portions.size() >= 2 && !portions[1].empty()) { |
| 575 language_code = portions[1]; | 575 language_code = portions[1]; |
| 576 } | 576 } |
| 577 } | 577 } |
| 578 | 578 |
| 579 text = StringToUpperASCII(UTF8ToWide(language_code)).substr( | 579 text = StringToUpperASCII(UTF8ToWide(language_code)).substr( |
| 580 0, kMaxLanguageNameLen); | 580 0, kMaxLanguageNameLen); |
| 581 } | 581 } |
| 582 DCHECK(!text.empty()); | 582 DCHECK(!text.empty()); |
| 583 return text; | 583 return text; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 logged_in_ = true; | 619 logged_in_ = true; |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 | 622 |
| 623 void InputMethodMenu::SetMinimumWidth(int width) { | 623 void InputMethodMenu::SetMinimumWidth(int width) { |
| 624 // On the OOBE network selection screen, fixed width menu would be preferable. | 624 // On the OOBE network selection screen, fixed width menu would be preferable. |
| 625 minimum_language_menu_width_ = width; | 625 minimum_language_menu_width_ = width; |
| 626 } | 626 } |
| 627 | 627 |
| 628 } // namespace chromeos | 628 } // namespace chromeos |
| OLD | NEW |