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

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 718673002: New user type introduced. Combines regular and supervised features. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Logical expression fixed. Created 6 years, 1 month 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
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/users/chrome_user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/users/chrome_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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 device_local_account_policy_service_->AddObserver(this); 348 device_local_account_policy_service_->AddObserver(this);
349 } 349 }
350 RetrieveTrustedDevicePolicies(); 350 RetrieveTrustedDevicePolicies();
351 UpdateOwnership(); 351 UpdateOwnership();
352 break; 352 break;
353 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { 353 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: {
354 Profile* profile = content::Details<Profile>(details).ptr(); 354 Profile* profile = content::Details<Profile>(details).ptr();
355 if (IsUserLoggedIn() && !IsLoggedInAsGuest() && !IsLoggedInAsKioskApp()) { 355 if (IsUserLoggedIn() && !IsLoggedInAsGuest() && !IsLoggedInAsKioskApp()) {
356 if (IsLoggedInAsSupervisedUser()) 356 if (IsLoggedInAsSupervisedUser())
357 SupervisedUserPasswordServiceFactory::GetForProfile(profile); 357 SupervisedUserPasswordServiceFactory::GetForProfile(profile);
358 if (IsLoggedInAsRegularUser()) 358 if (IsLoggedInAsUserWithGaiaAccount())
359 ManagerPasswordServiceFactory::GetForProfile(profile); 359 ManagerPasswordServiceFactory::GetForProfile(profile);
360 360
361 if (!profile->IsOffTheRecord()) { 361 if (!profile->IsOffTheRecord()) {
362 AuthSyncObserver* sync_observer = 362 AuthSyncObserver* sync_observer =
363 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); 363 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile);
364 sync_observer->StartObserving(); 364 sync_observer->StartObserving();
365 multi_profile_user_controller_->StartObserving(profile); 365 multi_profile_user_controller_->StartObserving(profile);
366 } 366 }
367 } 367 }
368 break; 368 break;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 std::string owner_email; 569 std::string owner_email;
570 cros_settings_->GetString(kDeviceOwner, &owner_email); 570 cros_settings_->GetString(kDeviceOwner, &owner_email);
571 SetOwnerEmail(owner_email); 571 SetOwnerEmail(owner_email);
572 572
573 EnsureUsersLoaded(); 573 EnsureUsersLoaded();
574 574
575 bool changed = UpdateAndCleanUpPublicAccounts( 575 bool changed = UpdateAndCleanUpPublicAccounts(
576 policy::GetDeviceLocalAccounts(cros_settings_)); 576 policy::GetDeviceLocalAccounts(cros_settings_));
577 577
578 // If ephemeral users are enabled and we are on the login screen, take this 578 // If ephemeral users are enabled and we are on the login screen, take this
579 // opportunity to clean up by removing all regular users except the owner. 579 // opportunity to clean up by removing all regular users except the owner.
bartfab (slow) 2014/11/27 12:51:50 Nit: s/regular/gaia/
580 if (GetEphemeralUsersEnabled() && !IsUserLoggedIn()) { 580 if (GetEphemeralUsersEnabled() && !IsUserLoggedIn()) {
581 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); 581 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers);
582 prefs_users_update->Clear(); 582 prefs_users_update->Clear();
583 for (user_manager::UserList::iterator it = users_.begin(); 583 for (user_manager::UserList::iterator it = users_.begin();
584 it != users_.end();) { 584 it != users_.end();) {
585 const std::string user_email = (*it)->email(); 585 const std::string user_email = (*it)->email();
586 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR && 586 if ((*it)->HasGaiaAccount() && user_email != GetOwnerEmail()) {
587 user_email != GetOwnerEmail()) {
588 RemoveNonCryptohomeData(user_email); 587 RemoveNonCryptohomeData(user_email);
589 DeleteUser(*it); 588 DeleteUser(*it);
590 it = users_.erase(it); 589 it = users_.erase(it);
591 changed = true; 590 changed = true;
592 } else { 591 } else {
593 if ((*it)->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) 592 if ((*it)->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
594 prefs_users_update->Append(new base::StringValue(user_email)); 593 prefs_users_update->Append(new base::StringValue(user_email));
595 ++it; 594 ++it;
596 } 595 }
597 } 596 }
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 ash::MultiProfileUMA::RecordUserCount(users); 1069 ash::MultiProfileUMA::RecordUserCount(users);
1071 } 1070 }
1072 #endif 1071 #endif
1073 1072
1074 base::debug::SetCrashKeyValue( 1073 base::debug::SetCrashKeyValue(
1075 crash_keys::kNumberOfUsers, 1074 crash_keys::kNumberOfUsers,
1076 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); 1075 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size()));
1077 } 1076 }
1078 1077
1079 } // namespace chromeos 1078 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698