| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/login/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 DCHECK(!pref_locale.empty()); | 791 DCHECK(!pref_locale.empty()); |
| 792 LOG(WARNING) << "RespectLocalePreference: " | 792 LOG(WARNING) << "RespectLocalePreference: " |
| 793 << "app_locale='" << pref_app_locale << "', " | 793 << "app_locale='" << pref_app_locale << "', " |
| 794 << "bkup_locale='" << pref_bkup_locale << "', " | 794 << "bkup_locale='" << pref_bkup_locale << "', " |
| 795 << (account_locale != NULL | 795 << (account_locale != NULL |
| 796 ? (std::string("account_locale='") + (*account_locale) + | 796 ? (std::string("account_locale='") + (*account_locale) + |
| 797 "'. ") | 797 "'. ") |
| 798 : (std::string("account_locale - unused. "))) | 798 : (std::string("account_locale - unused. "))) |
| 799 << " Selected '" << pref_locale << "'"; | 799 << " Selected '" << pref_locale << "'"; |
| 800 profile->ChangeAppLocale(pref_locale, Profile::APP_LOCALE_CHANGED_VIA_LOGIN); | 800 profile->ChangeAppLocale(pref_locale, Profile::APP_LOCALE_CHANGED_VIA_LOGIN); |
| 801 // Here we don't enable keyboard layouts. Input methods are set up when | 801 |
| 802 // the user first logs in. Then the user may customize the input methods. | 802 // Here we don't enable keyboard layouts for normal users. Input methods |
| 803 // Hence changing input methods here, just because the user's UI language | 803 // are set up when the user first logs in. Then the user may customize the |
| 804 // is different from the login screen UI language, is not desirable. Note | 804 // input methods. Hence changing input methods here, just because the user's |
| 805 // that input method preferences are synced, so users can use their | 805 // UI language is different from the login screen UI language, is not |
| 806 // farovite input methods as soon as the preferences are synced. | 806 // desirable. Note that input method preferences are synced, so users can use |
| 807 locale_util::SwitchLanguage(pref_locale, false, callback.Pass()); | 807 // their farovite input methods as soon as the preferences are synced. |
| 808 // |
| 809 // For Guest mode, user locale preferences will never get initialized. |
| 810 // So input methods should be enabled somewhere. |
| 811 const bool enable_layouts = UserManager::Get()->IsLoggedInAsGuest(); |
| 812 locale_util::SwitchLanguage(pref_locale, |
| 813 enable_layouts, |
| 814 false /* login_layouts_only */, |
| 815 callback.Pass()); |
| 808 | 816 |
| 809 return true; | 817 return true; |
| 810 } | 818 } |
| 811 | 819 |
| 812 void UserManagerImpl::StopPolicyObserverForTesting() { | 820 void UserManagerImpl::StopPolicyObserverForTesting() { |
| 813 policy_observer_.reset(); | 821 policy_observer_.reset(); |
| 814 } | 822 } |
| 815 | 823 |
| 816 void UserManagerImpl::Observe(int type, | 824 void UserManagerImpl::Observe(int type, |
| 817 const content::NotificationSource& source, | 825 const content::NotificationSource& source, |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1873 if (User* user = FindUserAndModify(user_id)) | 1881 if (User* user = FindUserAndModify(user_id)) |
| 1874 user->SetAccountLocale(resolved_locale); | 1882 user->SetAccountLocale(resolved_locale); |
| 1875 } | 1883 } |
| 1876 | 1884 |
| 1877 void UserManagerImpl::UpdateNumberOfUsers() { | 1885 void UserManagerImpl::UpdateNumberOfUsers() { |
| 1878 base::debug::SetCrashKeyValue(crash_keys::kNumberOfUsers, | 1886 base::debug::SetCrashKeyValue(crash_keys::kNumberOfUsers, |
| 1879 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 1887 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
| 1880 } | 1888 } |
| 1881 | 1889 |
| 1882 } // namespace chromeos | 1890 } // namespace chromeos |
| OLD | NEW |