| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 } | 520 } |
| 521 | 521 |
| 522 // Need to iterate over all users and their OAuth2 session state. | 522 // Need to iterate over all users and their OAuth2 session state. |
| 523 const user_manager::UserList& users = user_manager->GetLoggedInUsers(); | 523 const user_manager::UserList& users = user_manager->GetLoggedInUsers(); |
| 524 for (user_manager::UserList::const_iterator it = users.begin(); | 524 for (user_manager::UserList::const_iterator it = users.begin(); |
| 525 it != users.end(); | 525 it != users.end(); |
| 526 ++it) { | 526 ++it) { |
| 527 if (!(*it)->is_profile_created()) | 527 if (!(*it)->is_profile_created()) |
| 528 continue; | 528 continue; |
| 529 | 529 |
| 530 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(*it); | 530 Profile* user_profile = ProfileHelper::Get()->GetProfileByUserUnsafe(*it); |
| 531 bool should_restore_session = | 531 bool should_restore_session = |
| 532 pending_signin_restore_sessions_.find((*it)->email()) != | 532 pending_signin_restore_sessions_.find((*it)->email()) != |
| 533 pending_signin_restore_sessions_.end(); | 533 pending_signin_restore_sessions_.end(); |
| 534 OAuth2LoginManager* login_manager = | 534 OAuth2LoginManager* login_manager = |
| 535 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); | 535 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); |
| 536 if (login_manager->state() == | 536 if (login_manager->state() == |
| 537 OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS) { | 537 OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS) { |
| 538 // If we come online for the first time after successful offline login, | 538 // If we come online for the first time after successful offline login, |
| 539 // we need to kick off OAuth token verification process again. | 539 // we need to kick off OAuth token verification process again. |
| 540 login_manager->ContinueSessionRestore(); | 540 login_manager->ContinueSessionRestore(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 | 971 |
| 972 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { | 972 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { |
| 973 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 973 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 974 user_sessions_restored_ = true; | 974 user_sessions_restored_ = true; |
| 975 FOR_EACH_OBSERVER(UserSessionStateObserver, | 975 FOR_EACH_OBSERVER(UserSessionStateObserver, |
| 976 session_state_observer_list_, | 976 session_state_observer_list_, |
| 977 PendingUserSessionsRestoreFinished()); | 977 PendingUserSessionsRestoreFinished()); |
| 978 } | 978 } |
| 979 | 979 |
| 980 } // namespace chromeos | 980 } // namespace chromeos |
| OLD | NEW |