Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 398753004: [cros] Move User class to user_manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 #include "chrome/browser/chromeos/base/locale_util.h" 24 #include "chrome/browser/chromeos/base/locale_util.h"
25 #include "chrome/browser/chromeos/boot_times_loader.h" 25 #include "chrome/browser/chromeos/boot_times_loader.h"
26 #include "chrome/browser/chromeos/input_method/input_method_util.h" 26 #include "chrome/browser/chromeos/input_method/input_method_util.h"
27 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" 27 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
28 #include "chrome/browser/chromeos/login/profile_auth_data.h" 28 #include "chrome/browser/chromeos/login/profile_auth_data.h"
29 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" 29 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
30 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory .h" 30 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory .h"
31 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" 31 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
32 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" 32 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h"
33 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 33 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
34 #include "chrome/browser/chromeos/login/users/user.h"
35 #include "chrome/browser/chromeos/login/users/user_manager.h" 34 #include "chrome/browser/chromeos/login/users/user_manager.h"
36 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h" 35 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h"
37 #include "chrome/browser/chromeos/profiles/profile_helper.h" 36 #include "chrome/browser/chromeos/profiles/profile_helper.h"
38 #include "chrome/browser/first_run/first_run.h" 37 #include "chrome/browser/first_run/first_run.h"
39 #include "chrome/browser/google/google_brand_chromeos.h" 38 #include "chrome/browser/google/google_brand_chromeos.h"
40 #include "chrome/browser/lifetime/application_lifetime.h" 39 #include "chrome/browser/lifetime/application_lifetime.h"
41 #include "chrome/browser/net/nss_context.h" 40 #include "chrome/browser/net/nss_context.h"
42 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
43 #include "chrome/browser/profiles/profile_manager.h" 42 #include "chrome/browser/profiles/profile_manager.h"
44 #include "chrome/browser/rlz/rlz.h" 43 #include "chrome/browser/rlz/rlz.h"
45 #include "chrome/browser/signin/signin_manager_factory.h" 44 #include "chrome/browser/signin/signin_manager_factory.h"
46 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
47 #include "chrome/common/logging_chrome.h" 46 #include "chrome/common/logging_chrome.h"
48 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
49 #include "chromeos/cert_loader.h" 48 #include "chromeos/cert_loader.h"
50 #include "chromeos/chromeos_switches.h" 49 #include "chromeos/chromeos_switches.h"
51 #include "chromeos/cryptohome/cryptohome_util.h" 50 #include "chromeos/cryptohome/cryptohome_util.h"
52 #include "chromeos/dbus/cryptohome_client.h" 51 #include "chromeos/dbus/cryptohome_client.h"
53 #include "chromeos/dbus/dbus_thread_manager.h" 52 #include "chromeos/dbus/dbus_thread_manager.h"
54 #include "chromeos/dbus/session_manager_client.h" 53 #include "chromeos/dbus/session_manager_client.h"
55 #include "chromeos/ime/input_method_manager.h" 54 #include "chromeos/ime/input_method_manager.h"
56 #include "chromeos/network/portal_detector/network_portal_detector.h" 55 #include "chromeos/network/portal_detector/network_portal_detector.h"
57 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" 56 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h"
58 #include "components/session_manager/core/session_manager.h" 57 #include "components/session_manager/core/session_manager.h"
59 #include "components/signin/core/browser/signin_manager_base.h" 58 #include "components/signin/core/browser/signin_manager_base.h"
59 #include "components/user_manager/user.h"
60 #include "content/public/browser/browser_thread.h" 60 #include "content/public/browser/browser_thread.h"
61 #include "content/public/browser/notification_service.h" 61 #include "content/public/browser/notification_service.h"
62 62
63 namespace chromeos { 63 namespace chromeos {
64 64
65 namespace { 65 namespace {
66 66
67 void InitLocaleAndInputMethodsForNewUser(PrefService* prefs) { 67 void InitLocaleAndInputMethodsForNewUser(PrefService* prefs) {
68 // First, we'll set kLanguagePreloadEngines. 68 // First, we'll set kLanguagePreloadEngines.
69 std::string locale = g_browser_process->GetApplicationLocale(); 69 std::string locale = g_browser_process->GetApplicationLocale();
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // linux_chromeos build on dev workstations w/o user_id parameters. 235 // linux_chromeos build on dev workstations w/o user_id parameters.
236 // Stub user is considered to be a regular GAIA user but it has special 236 // Stub user is considered to be a regular GAIA user but it has special
237 // user_id (kStubUser) and certain services like restoring OAuth session are 237 // user_id (kStubUser) and certain services like restoring OAuth session are
238 // explicitly disabled for it. 238 // explicitly disabled for it.
239 if (!user_manager->IsUserLoggedIn() || 239 if (!user_manager->IsUserLoggedIn() ||
240 !user_manager->IsLoggedInAsRegularUser() || 240 !user_manager->IsLoggedInAsRegularUser() ||
241 user_manager->IsLoggedInAsStub()) { 241 user_manager->IsLoggedInAsStub()) {
242 return; 242 return;
243 } 243 }
244 244
245 User* user = ProfileHelper::Get()->GetUserByProfile(user_profile); 245 user_manager::User* user =
246 ProfileHelper::Get()->GetUserByProfile(user_profile);
246 DCHECK(user); 247 DCHECK(user);
247 if (!net::NetworkChangeNotifier::IsOffline()) { 248 if (!net::NetworkChangeNotifier::IsOffline()) {
248 pending_signin_restore_sessions_.erase(user->email()); 249 pending_signin_restore_sessions_.erase(user->email());
249 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */); 250 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */);
250 } else { 251 } else {
251 // Even if we're online we should wait till initial 252 // Even if we're online we should wait till initial
252 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may 253 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may
253 // end up canceling all request when initial network connection type is 254 // end up canceling all request when initial network connection type is
254 // processed. See http://crbug.com/121643. 255 // processed. See http://crbug.com/121643.
255 pending_signin_restore_sessions_.insert(user->email()); 256 pending_signin_restore_sessions_.insert(user->email());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 const std::string& chrome_client_secret) { 319 const std::string& chrome_client_secret) {
319 if (!chrome::IsRunningInForcedAppMode()) 320 if (!chrome::IsRunningInForcedAppMode())
320 return; 321 return;
321 322
322 chrome_client_id_ = chrome_client_id; 323 chrome_client_id_ = chrome_client_id;
323 chrome_client_secret_ = chrome_client_secret; 324 chrome_client_secret_ = chrome_client_secret;
324 } 325 }
325 326
326 bool UserSessionManager::RespectLocalePreference( 327 bool UserSessionManager::RespectLocalePreference(
327 Profile* profile, 328 Profile* profile,
328 const User* user, 329 const user_manager::User* user,
329 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { 330 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const {
330 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in 331 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in
331 // the Google user profile. 332 // the Google user profile.
332 if (g_browser_process == NULL) 333 if (g_browser_process == NULL)
333 return false; 334 return false;
334 335
335 UserManager* user_manager = UserManager::Get(); 336 UserManager* user_manager = UserManager::Get();
336 if ((user == NULL) || (user != user_manager->GetPrimaryUser()) || 337 if ((user == NULL) || (user != user_manager->GetPrimaryUser()) ||
337 (!user->is_profile_created())) 338 (!user->is_profile_created()))
338 return false; 339 return false;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 405
405 void UserSessionManager::RemoveSessionStateObserver( 406 void UserSessionManager::RemoveSessionStateObserver(
406 UserSessionStateObserver* observer) { 407 UserSessionStateObserver* observer) {
407 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 408 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
408 session_state_observer_list_.RemoveObserver(observer); 409 session_state_observer_list_.RemoveObserver(observer);
409 } 410 }
410 411
411 void UserSessionManager::OnSessionRestoreStateChanged( 412 void UserSessionManager::OnSessionRestoreStateChanged(
412 Profile* user_profile, 413 Profile* user_profile,
413 OAuth2LoginManager::SessionRestoreState state) { 414 OAuth2LoginManager::SessionRestoreState state) {
414 User::OAuthTokenStatus user_status = User::OAUTH_TOKEN_STATUS_UNKNOWN; 415 user_manager::User::OAuthTokenStatus user_status =
416 user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN;
415 OAuth2LoginManager* login_manager = 417 OAuth2LoginManager* login_manager =
416 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); 418 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile);
417 419
418 bool connection_error = false; 420 bool connection_error = false;
419 switch (state) { 421 switch (state) {
420 case OAuth2LoginManager::SESSION_RESTORE_DONE: 422 case OAuth2LoginManager::SESSION_RESTORE_DONE:
421 user_status = User::OAUTH2_TOKEN_STATUS_VALID; 423 user_status = user_manager::User::OAUTH2_TOKEN_STATUS_VALID;
422 break; 424 break;
423 case OAuth2LoginManager::SESSION_RESTORE_FAILED: 425 case OAuth2LoginManager::SESSION_RESTORE_FAILED:
424 user_status = User::OAUTH2_TOKEN_STATUS_INVALID; 426 user_status = user_manager::User::OAUTH2_TOKEN_STATUS_INVALID;
425 break; 427 break;
426 case OAuth2LoginManager::SESSION_RESTORE_CONNECTION_FAILED: 428 case OAuth2LoginManager::SESSION_RESTORE_CONNECTION_FAILED:
427 connection_error = true; 429 connection_error = true;
428 break; 430 break;
429 case OAuth2LoginManager::SESSION_RESTORE_NOT_STARTED: 431 case OAuth2LoginManager::SESSION_RESTORE_NOT_STARTED:
430 case OAuth2LoginManager::SESSION_RESTORE_PREPARING: 432 case OAuth2LoginManager::SESSION_RESTORE_PREPARING:
431 case OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS: 433 case OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS:
432 return; 434 return;
433 } 435 }
434 436
(...skipping 14 matching lines...) Expand all
449 if (!exit_after_session_restore_) 451 if (!exit_after_session_restore_)
450 return; 452 return;
451 453
452 OAuth2LoginManager* login_manager = 454 OAuth2LoginManager* login_manager =
453 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); 455 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile);
454 login_manager->RemoveObserver(this); 456 login_manager->RemoveObserver(this);
455 457
456 // Mark user auth token status as valid. 458 // Mark user auth token status as valid.
457 UserManager::Get()->SaveUserOAuthStatus( 459 UserManager::Get()->SaveUserOAuthStatus(
458 UserManager::Get()->GetLoggedInUser()->email(), 460 UserManager::Get()->GetLoggedInUser()->email(),
459 User::OAUTH2_TOKEN_STATUS_VALID); 461 user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
460 462
461 VLOG(1) << "Exiting after new refresh token fetched"; 463 VLOG(1) << "Exiting after new refresh token fetched";
462 464
463 // We need to restart cleanly in this case to make sure OAuth2 RT is actually 465 // We need to restart cleanly in this case to make sure OAuth2 RT is actually
464 // saved. 466 // saved.
465 chrome::AttemptRestart(); 467 chrome::AttemptRestart();
466 } 468 }
467 469
468 void UserSessionManager::OnConnectionTypeChanged( 470 void UserSessionManager::OnConnectionTypeChanged(
469 net::NetworkChangeNotifier::ConnectionType type) { 471 net::NetworkChangeNotifier::ConnectionType type) {
470 bool is_running_test = 472 bool is_running_test =
471 base::CommandLine::ForCurrentProcess()->HasSwitch( 473 base::CommandLine::ForCurrentProcess()->HasSwitch(
472 ::switches::kTestName) || 474 ::switches::kTestName) ||
473 base::CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType); 475 base::CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType);
474 UserManager* user_manager = UserManager::Get(); 476 UserManager* user_manager = UserManager::Get();
475 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || 477 if (type == net::NetworkChangeNotifier::CONNECTION_NONE ||
476 !user_manager->IsUserLoggedIn() || 478 !user_manager->IsUserLoggedIn() ||
477 !user_manager->IsLoggedInAsRegularUser() || 479 !user_manager->IsLoggedInAsRegularUser() ||
478 user_manager->IsLoggedInAsStub() || is_running_test) { 480 user_manager->IsLoggedInAsStub() || is_running_test) {
479 return; 481 return;
480 } 482 }
481 483
482 // Need to iterate over all users and their OAuth2 session state. 484 // Need to iterate over all users and their OAuth2 session state.
483 const UserList& users = user_manager->GetLoggedInUsers(); 485 const user_manager::UserList& users = user_manager->GetLoggedInUsers();
484 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { 486 for (user_manager::UserList::const_iterator it = users.begin();
487 it != users.end();
488 ++it) {
485 if (!(*it)->is_profile_created()) 489 if (!(*it)->is_profile_created())
486 continue; 490 continue;
487 491
488 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(*it); 492 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(*it);
489 bool should_restore_session = 493 bool should_restore_session =
490 pending_signin_restore_sessions_.find((*it)->email()) != 494 pending_signin_restore_sessions_.find((*it)->email()) !=
491 pending_signin_restore_sessions_.end(); 495 pending_signin_restore_sessions_.end();
492 OAuth2LoginManager* login_manager = 496 OAuth2LoginManager* login_manager =
493 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); 497 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile);
494 if (login_manager->state() == 498 if (login_manager->state() ==
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 break; 596 break;
593 } 597 }
594 } 598 }
595 599
596 void UserSessionManager::InitProfilePreferences(Profile* profile, 600 void UserSessionManager::InitProfilePreferences(Profile* profile,
597 const std::string& user_id) { 601 const std::string& user_id) {
598 if (UserManager::Get()->IsCurrentUserNew()) 602 if (UserManager::Get()->IsCurrentUserNew())
599 SetFirstLoginPrefs(profile->GetPrefs()); 603 SetFirstLoginPrefs(profile->GetPrefs());
600 604
601 if (UserManager::Get()->IsLoggedInAsSupervisedUser()) { 605 if (UserManager::Get()->IsLoggedInAsSupervisedUser()) {
602 User* active_user = UserManager::Get()->GetActiveUser(); 606 user_manager::User* active_user = UserManager::Get()->GetActiveUser();
603 std::string supervised_user_sync_id = 607 std::string supervised_user_sync_id =
604 UserManager::Get()->GetSupervisedUserManager()-> 608 UserManager::Get()->GetSupervisedUserManager()->
605 GetUserSyncId(active_user->email()); 609 GetUserSyncId(active_user->email());
606 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, 610 profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
607 supervised_user_sync_id); 611 supervised_user_sync_id);
608 } else if (UserManager::Get()->IsLoggedInAsRegularUser()) { 612 } else if (UserManager::Get()->IsLoggedInAsRegularUser()) {
609 // Make sure that the google service username is properly set (we do this 613 // Make sure that the google service username is properly set (we do this
610 // on every sign in, not just the first login, to deal with existing 614 // on every sign in, not just the first login, to deal with existing
611 // profiles that might not have it set yet). 615 // profiles that might not have it set yet).
612 SigninManagerBase* signin_manager = 616 SigninManagerBase* signin_manager =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 // Send the notification before creating the browser so additional objects 697 // Send the notification before creating the browser so additional objects
694 // that need the profile (e.g. the launcher) can be created first. 698 // that need the profile (e.g. the launcher) can be created first.
695 content::NotificationService::current()->Notify( 699 content::NotificationService::current()->Notify(
696 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 700 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
697 content::NotificationService::AllSources(), 701 content::NotificationService::AllSources(),
698 content::Details<Profile>(profile)); 702 content::Details<Profile>(profile));
699 703
700 InitializeCertsForPrimaryUser(profile); 704 InitializeCertsForPrimaryUser(profile);
701 705
702 // Initialize RLZ only for primary user. 706 // Initialize RLZ only for primary user.
703 const User* user = ProfileHelper::Get()->GetUserByProfile(profile); 707 const user_manager::User* user =
708 ProfileHelper::Get()->GetUserByProfile(profile);
704 if (user_manager->GetPrimaryUser() == user) 709 if (user_manager->GetPrimaryUser() == user)
705 InitRlz(profile); 710 InitRlz(profile);
706 711
707 // TODO(altimofeev): This pointer should probably never be NULL, but it looks 712 // TODO(altimofeev): This pointer should probably never be NULL, but it looks
708 // like LoginUtilsImpl::OnProfileCreated() may be getting called before 713 // like LoginUtilsImpl::OnProfileCreated() may be getting called before
709 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is 714 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is
710 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace 715 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace
711 // this 'if' statement with a CHECK(delegate_) once the underlying issue is 716 // this 'if' statement with a CHECK(delegate_) once the underlying issue is
712 // resolved. 717 // resolved.
713 if (delegate_) 718 if (delegate_)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 ping_delay < 0, base::TimeDelta::FromMilliseconds(abs(ping_delay))); 808 ping_delay < 0, base::TimeDelta::FromMilliseconds(abs(ping_delay)));
804 if (delegate_) 809 if (delegate_)
805 delegate_->OnRlzInitialized(); 810 delegate_->OnRlzInitialized();
806 #endif 811 #endif
807 } 812 }
808 813
809 void UserSessionManager::InitializeCertsForPrimaryUser(Profile* profile) { 814 void UserSessionManager::InitializeCertsForPrimaryUser(Profile* profile) {
810 // Now that the user profile has been initialized 815 // Now that the user profile has been initialized
811 // |GetNSSCertDatabaseForProfile| is safe to be used. 816 // |GetNSSCertDatabaseForProfile| is safe to be used.
812 UserManager* user_manager = UserManager::Get(); 817 UserManager* user_manager = UserManager::Get();
813 const User* primary_user = user_manager->GetPrimaryUser(); 818 const user_manager::User* primary_user = user_manager->GetPrimaryUser();
814 if (user_manager->IsUserLoggedIn() && 819 if (user_manager->IsUserLoggedIn() &&
815 primary_user && 820 primary_user &&
816 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) && 821 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) &&
817 CertLoader::IsInitialized() && 822 CertLoader::IsInitialized() &&
818 base::SysInfo::IsRunningOnChromeOS()) { 823 base::SysInfo::IsRunningOnChromeOS()) {
819 GetNSSCertDatabaseForProfile(profile, 824 GetNSSCertDatabaseForProfile(profile,
820 base::Bind(&OnGetNSSCertDatabaseForUser)); 825 base::Bind(&OnGetNSSCertDatabaseForUser));
821 } 826 }
822 } 827 }
823 828
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 // Get next user to restore sessions and delete it from list. 861 // Get next user to restore sessions and delete it from list.
857 SessionManagerClient::ActiveSessionsMap::const_iterator it = 862 SessionManagerClient::ActiveSessionsMap::const_iterator it =
858 pending_user_sessions_.begin(); 863 pending_user_sessions_.begin();
859 std::string user_id = it->first; 864 std::string user_id = it->first;
860 std::string user_id_hash = it->second; 865 std::string user_id_hash = it->second;
861 DCHECK(!user_id.empty()); 866 DCHECK(!user_id.empty());
862 DCHECK(!user_id_hash.empty()); 867 DCHECK(!user_id_hash.empty());
863 pending_user_sessions_.erase(user_id); 868 pending_user_sessions_.erase(user_id);
864 869
865 // Check that this user is not logged in yet. 870 // Check that this user is not logged in yet.
866 UserList logged_in_users = UserManager::Get()->GetLoggedInUsers(); 871 user_manager::UserList logged_in_users =
872 UserManager::Get()->GetLoggedInUsers();
867 bool user_already_logged_in = false; 873 bool user_already_logged_in = false;
868 for (UserList::const_iterator it = logged_in_users.begin(); 874 for (user_manager::UserList::const_iterator it = logged_in_users.begin();
869 it != logged_in_users.end(); 875 it != logged_in_users.end();
870 ++it) { 876 ++it) {
871 const User* user = (*it); 877 const user_manager::User* user = (*it);
872 if (user->email() == user_id) { 878 if (user->email() == user_id) {
873 user_already_logged_in = true; 879 user_already_logged_in = true;
874 break; 880 break;
875 } 881 }
876 } 882 }
877 DCHECK(!user_already_logged_in); 883 DCHECK(!user_already_logged_in);
878 884
879 if (!user_already_logged_in) { 885 if (!user_already_logged_in) {
880 UserContext user_context(user_id); 886 UserContext user_context(user_id);
881 user_context.SetUserIDHash(user_id_hash); 887 user_context.SetUserIDHash(user_id_hash);
(...skipping 12 matching lines...) Expand all
894 900
895 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { 901 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() {
896 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 902 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
897 user_sessions_restored_ = true; 903 user_sessions_restored_ = true;
898 FOR_EACH_OBSERVER(UserSessionStateObserver, 904 FOR_EACH_OBSERVER(UserSessionStateObserver,
899 session_state_observer_list_, 905 session_state_observer_list_,
900 PendingUserSessionsRestoreFinished()); 906 PendingUserSessionsRestoreFinished());
901 } 907 }
902 908
903 } // namespace chromeos 909 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698