Index: chrome/browser/chromeos/login/session/user_session_manager.cc |
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc |
index 7310bd3482d9e2406b63a1b94923d19d051eaa7a..8f5911d3c90199340b6e0fc507d5ff6aaee6a857 100644 |
--- a/chrome/browser/chromeos/login/session/user_session_manager.cc |
+++ b/chrome/browser/chromeos/login/session/user_session_manager.cc |
@@ -73,9 +73,10 @@ namespace chromeos { |
namespace { |
void InitLocaleAndInputMethodsForNewUser( |
- PrefService* prefs, |
+ Profile* profile, |
const std::string& public_session_locale, |
const std::string& public_session_input_method) { |
+ PrefService* prefs = profile->GetPrefs(); |
std::string locale; |
if (!public_session_locale.empty()) { |
// If this is a public session and the user chose a |public_session_locale|, |
@@ -104,7 +105,9 @@ void InitLocaleAndInputMethodsForNewUser( |
// Otherwise, set kLanguagePreloadEngines to a list of input methods derived |
// from the |locale| and the currently active input method. |
manager->GetInputMethodUtil()->GetFirstLoginInputMethodIds( |
- locale, manager->GetCurrentInputMethod(), &input_method_ids); |
+ locale, |
+ manager->GetDefaultState(profile)->GetCurrentInputMethod(), |
+ &input_method_ids); |
} |
// Save the input methods in the user's preferences. |
@@ -218,9 +221,12 @@ UserSessionManager::UserSessionManager() |
session_restore_strategy_( |
OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN) { |
net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
+ UserManager::Get()->AddSessionStateObserver(this); |
} |
UserSessionManager::~UserSessionManager() { |
+ if (UserManager::IsInitialized()) |
Nikita (slow)
2014/08/13 10:56:41
nit: Please add TODO(nkostylev) comment why this i
Alexander Alekseev
2014/08/13 23:29:32
Done.
|
+ UserManager::Get()->RemoveSessionStateObserver(this); |
net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
} |
@@ -325,13 +331,12 @@ UserSessionManager::GetSigninSessionRestoreStrategy() { |
// static |
void UserSessionManager::SetFirstLoginPrefs( |
- PrefService* prefs, |
+ Profile* profile, |
const std::string& public_session_locale, |
const std::string& public_session_input_method) { |
VLOG(1) << "Setting first login prefs"; |
- InitLocaleAndInputMethodsForNewUser(prefs, |
- public_session_locale, |
- public_session_input_method); |
+ InitLocaleAndInputMethodsForNewUser( |
+ profile, public_session_locale, public_session_input_method); |
} |
bool UserSessionManager::GetAppModeChromeClientOAuthInfo( |
@@ -436,13 +441,13 @@ bool UserSessionManager::RespectLocalePreference( |
} |
void UserSessionManager::AddSessionStateObserver( |
- UserSessionStateObserver* observer) { |
+ chromeos::UserSessionStateObserver* observer) { |
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
session_state_observer_list_.AddObserver(observer); |
} |
void UserSessionManager::RemoveSessionStateObserver( |
- UserSessionStateObserver* observer) { |
+ chromeos::UserSessionStateObserver* observer) { |
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
session_state_observer_list_.RemoveObserver(observer); |
} |
@@ -641,7 +646,7 @@ void UserSessionManager::InitProfilePreferences( |
Profile* profile, |
const UserContext& user_context) { |
if (UserManager::Get()->IsCurrentUserNew()) { |
- SetFirstLoginPrefs(profile->GetPrefs(), |
+ SetFirstLoginPrefs(profile, |
user_context.GetPublicSessionLocale(), |
user_context.GetPublicSessionInputMethod()); |
} |
@@ -972,9 +977,17 @@ void UserSessionManager::RestorePendingUserSessions() { |
void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { |
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
user_sessions_restored_ = true; |
- FOR_EACH_OBSERVER(UserSessionStateObserver, |
+ FOR_EACH_OBSERVER(chromeos::UserSessionStateObserver, |
session_state_observer_list_, |
PendingUserSessionsRestoreFinished()); |
} |
+void UserSessionManager::ActiveUserChanged( |
+ const user_manager::User* active_user) { |
+ input_method::InputMethodManager* manager = |
+ input_method::InputMethodManager::Get(); |
+ manager->SetState(manager->GetDefaultState( |
+ ProfileHelper::Get()->GetProfileByUser(active_user))); |
+} |
+ |
} // namespace chromeos |