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/language_menu_button.h" | 5 #include "chrome/browser/chromeos/status/language_menu_button.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 previous_input_method_pref_.SetValue(previous_input_method.id); | 434 previous_input_method_pref_.SetValue(previous_input_method.id); |
435 current_input_method_pref_.SetValue(current_input_method.id); | 435 current_input_method_pref_.SetValue(current_input_method.id); |
436 } | 436 } |
437 } else { | 437 } else { |
438 // We're in the login screen (i.e. not in the normal browser mode nor screen | 438 // We're in the login screen (i.e. not in the normal browser mode nor screen |
439 // locker mode). If a user has already logged in, we should not update the | 439 // locker mode). If a user has already logged in, we should not update the |
440 // local state since a profile for the user might be loaded before the | 440 // local state since a profile for the user might be loaded before the |
441 // buttun for the login screen is destroyed. | 441 // buttun for the login screen is destroyed. |
442 if (!logged_in_ && g_browser_process && g_browser_process->local_state()) { | 442 if (!logged_in_ && g_browser_process && g_browser_process->local_state()) { |
443 g_browser_process->local_state()->SetString( | 443 g_browser_process->local_state()->SetString( |
444 kPreferredKeyboardLayout, current_input_method.id); | 444 language_prefs::kPreferredKeyboardLayout, current_input_method.id); |
445 g_browser_process->local_state()->SavePersistentPrefs(); | 445 g_browser_process->local_state()->SavePersistentPrefs(); |
446 } | 446 } |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 void LanguageMenuButton::ActiveInputMethodsChanged(InputMethodLibrary* obj) { | 450 void LanguageMenuButton::ActiveInputMethodsChanged(InputMethodLibrary* obj) { |
451 // Update the icon if active input methods are changed. See also | 451 // Update the icon if active input methods are changed. See also |
452 // comments in UpdateIndicator() | 452 // comments in UpdateIndicator() |
453 UpdateIndicatorFromInputMethod(obj->current_input_method()); | 453 UpdateIndicatorFromInputMethod(obj->current_input_method()); |
454 } | 454 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 std::wstring text = GetLanguageName(language_code); | 647 std::wstring text = GetLanguageName(language_code); |
648 if (add_method_name) { | 648 if (add_method_name) { |
649 text += L" - "; | 649 text += L" - "; |
650 text += input_method::GetString(input_method.display_name); | 650 text += input_method::GetString(input_method.display_name); |
651 } | 651 } |
652 DCHECK(!text.empty()); | 652 DCHECK(!text.empty()); |
653 return text; | 653 return text; |
654 } | 654 } |
655 | 655 |
656 void LanguageMenuButton::RegisterPrefs(PrefService* local_state) { | 656 void LanguageMenuButton::RegisterPrefs(PrefService* local_state) { |
657 local_state->RegisterStringPref(kPreferredKeyboardLayout, ""); | 657 local_state->RegisterStringPref(language_prefs::kPreferredKeyboardLayout, |
| 658 ""); |
658 } | 659 } |
659 | 660 |
660 void LanguageMenuButton::GetAmbiguousLanguageCodeSet( | 661 void LanguageMenuButton::GetAmbiguousLanguageCodeSet( |
661 const InputMethodDescriptors& input_method_descriptors, | 662 const InputMethodDescriptors& input_method_descriptors, |
662 std::set<std::string>* ambiguous_language_code_set) { | 663 std::set<std::string>* ambiguous_language_code_set) { |
663 DCHECK(ambiguous_language_code_set); | 664 DCHECK(ambiguous_language_code_set); |
664 ambiguous_language_code_set->clear(); | 665 ambiguous_language_code_set->clear(); |
665 | 666 |
666 std::set<std::string> languages_seen; | 667 std::set<std::string> languages_seen; |
667 for (size_t i = 0; i < input_method_descriptors.size(); ++i) { | 668 for (size_t i = 0; i < input_method_descriptors.size(); ++i) { |
(...skipping 16 matching lines...) Expand all Loading... |
684 | 685 |
685 void LanguageMenuButton::Observe(NotificationType type, | 686 void LanguageMenuButton::Observe(NotificationType type, |
686 const NotificationSource& source, | 687 const NotificationSource& source, |
687 const NotificationDetails& details) { | 688 const NotificationDetails& details) { |
688 if (type == NotificationType::LOGIN_USER_CHANGED) { | 689 if (type == NotificationType::LOGIN_USER_CHANGED) { |
689 logged_in_ = true; | 690 logged_in_ = true; |
690 } | 691 } |
691 } | 692 } |
692 | 693 |
693 } // namespace chromeos | 694 } // namespace chromeos |
OLD | NEW |