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

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: Fix profile chooser controller lock unit tests 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 | 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 ea5bb928b2cb09a639d1394052aac1bb7b18a5d4..51d2072aa2965bde03e06ffd65107f7a4ccef196 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -310,11 +310,23 @@ 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") {
Alexei Svitkine (slow) 2014/10/31 17:13:11 This should probably have a comment about why we'r
+ return false;
+ }
+
+ ProfileInfoCache* cache =
+ &g_browser_process->profile_manager()->GetProfileInfoCache();
Alexei Svitkine (slow) 2014/10/31 17:13:11 Can you use "const ProfileInfoCache&" instead?
+ 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