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

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: Remove pref Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 f2d44d4358c6eed2c4c1fb5a2d8560185e98537d..ef5a6109c3680c7c89e5da9564d8bd2161eb23df 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -311,11 +311,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");
+ if (hosted_domain != Profile::kNoHostedDomainFound &&
+ hosted_domain != "google.com") {
+ return false;
+ }
+
+ size_t num_supervised_profiles = 0;
+ ProfileInfoCache* cache =
+ &g_browser_process->profile_manager()->GetProfileInfoCache();
+
+ for (size_t i = 0; i < cache->GetNumberOfProfiles(); ++i) {
+ if (cache->ProfileIsSupervisedAtIndex(i))
+ num_supervised_profiles++;
noms (inactive) 2014/10/14 14:22:01 nit: you can just return true here, and return fal
Mike Lerman 2014/10/29 15:28:48 Done.
+ }
+ return num_supervised_profiles > 0;
}
void CreateGuestProfileForUserManager(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698