| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 const bool enable_layouts = UserManager::Get()->IsLoggedInAsGuest(); | 390 const bool enable_layouts = UserManager::Get()->IsLoggedInAsGuest(); |
| 391 locale_util::SwitchLanguage(pref_locale, | 391 locale_util::SwitchLanguage(pref_locale, |
| 392 enable_layouts, | 392 enable_layouts, |
| 393 false /* login_layouts_only */, | 393 false /* login_layouts_only */, |
| 394 callback.Pass()); | 394 callback.Pass()); |
| 395 | 395 |
| 396 return true; | 396 return true; |
| 397 } | 397 } |
| 398 | 398 |
| 399 void UserSessionManager::AddSessionStateObserver( | 399 void UserSessionManager::AddSessionStateObserver( |
| 400 UserSessionStateObserver* observer) { | 400 chromeos::UserSessionStateObserver* observer) { |
| 401 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 401 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 402 session_state_observer_list_.AddObserver(observer); | 402 session_state_observer_list_.AddObserver(observer); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void UserSessionManager::RemoveSessionStateObserver( | 405 void UserSessionManager::RemoveSessionStateObserver( |
| 406 UserSessionStateObserver* observer) { | 406 chromeos::UserSessionStateObserver* observer) { |
| 407 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 407 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 408 session_state_observer_list_.RemoveObserver(observer); | 408 session_state_observer_list_.RemoveObserver(observer); |
| 409 } | 409 } |
| 410 | 410 |
| 411 void UserSessionManager::OnSessionRestoreStateChanged( | 411 void UserSessionManager::OnSessionRestoreStateChanged( |
| 412 Profile* user_profile, | 412 Profile* user_profile, |
| 413 OAuth2LoginManager::SessionRestoreState state) { | 413 OAuth2LoginManager::SessionRestoreState state) { |
| 414 User::OAuthTokenStatus user_status = User::OAUTH_TOKEN_STATUS_UNKNOWN; | 414 User::OAuthTokenStatus user_status = User::OAUTH_TOKEN_STATUS_UNKNOWN; |
| 415 OAuth2LoginManager* login_manager = | 415 OAuth2LoginManager* login_manager = |
| 416 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); | 416 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 true, // has_active_session | 888 true, // has_active_session |
| 889 this); | 889 this); |
| 890 } else { | 890 } else { |
| 891 RestorePendingUserSessions(); | 891 RestorePendingUserSessions(); |
| 892 } | 892 } |
| 893 } | 893 } |
| 894 | 894 |
| 895 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { | 895 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { |
| 896 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 896 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 897 user_sessions_restored_ = true; | 897 user_sessions_restored_ = true; |
| 898 FOR_EACH_OBSERVER(UserSessionStateObserver, | 898 FOR_EACH_OBSERVER(chromeos::UserSessionStateObserver, |
| 899 session_state_observer_list_, | 899 session_state_observer_list_, |
| 900 PendingUserSessionsRestoreFinished()); | 900 PendingUserSessionsRestoreFinished()); |
| 901 } | 901 } |
| 902 | 902 |
| 903 } // namespace chromeos | 903 } // namespace chromeos |
| OLD | NEW |