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

Unified Diff: chrome/browser/profiles/profile_window.cc

Issue 633233002: Lock only permitted where a supervised user is or was. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alexei's comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_window.cc
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc
index a9353464149a2e558707e49a4177decdaadd8222..4cb2940c1a588a1bf8d2ce0543f3b742260adcda 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -318,11 +318,25 @@ void LockProfile(Profile* profile) {
bool IsLockAvailable(Profile* profile) {
DCHECK(profile);
+ if (!switches::IsNewProfileManagement())
+ return false;
+
const std::string& hosted_domain = profile->GetPrefs()->
GetString(prefs::kGoogleServicesHostedDomain);
- return switches::IsNewProfileManagement() &&
- (hosted_domain == Profile::kNoHostedDomainFound ||
- hosted_domain == "google.com");
+ // TODO(mlerman): Prohibit only users who authenticate using SAML. Until then,
+ // prohibited users who use hosted domains (aside from google.com).
+ if (hosted_domain != Profile::kNoHostedDomainFound &&
+ hosted_domain != "google.com") {
+ return false;
+ }
+
+ const ProfileInfoCache& cache =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
+ for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
+ if (cache.ProfileIsSupervisedAtIndex(i))
+ return true;
+ }
+ return false;
}
void CreateGuestProfileForUserManager(
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698