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

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

Issue 9432003: Disable multi-profile UI in managed mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add notreached() Created 8 years, 10 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
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 8e2d7b9d8bf17459b615d41c02c44c80915c58fd..dac3d3c5e68c0d48a2453e22c77cdf6c2bfb6a0d 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -654,6 +654,8 @@ FilePath ProfileManager::GenerateNextProfileDirectoryPath() {
PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
+ DCHECK(!local_state->GetBoolean(prefs::kInManagedMode));
+
// Create the next profile in the next available directory slot.
int next_directory = local_state->GetInteger(prefs::kProfilesNumCreated);
std::string profile_name = chrome::kMultiProfileDirPrefix;
@@ -685,6 +687,7 @@ void ProfileManager::RegisterPrefs(PrefService* prefs) {
prefs->RegisterStringPref(prefs::kProfileLastUsed, "");
prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1);
prefs->RegisterListPref(prefs::kProfilesLastActive);
+ prefs->RegisterBooleanPref(prefs::kInManagedMode, false);
}
size_t ProfileManager::GetNumberOfProfiles() {
@@ -812,6 +815,9 @@ bool ProfileManager::ShouldGoOffTheRecord() {
}
void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
+ PrefService* local_state = g_browser_process->local_state();
+ DCHECK(!local_state->GetBoolean(prefs::kInManagedMode));
+
// If we're deleting the last profile, then create a new profile in its
// place.
ProfileInfoCache& cache = GetProfileInfoCache();
@@ -823,7 +829,6 @@ void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
// Update the last used profile pref before closing browser windows. This way
// the correct last used profile is set for any notification observers.
- PrefService* local_state = g_browser_process->local_state();
std::string last_profile = local_state->GetString(prefs::kProfileLastUsed);
if (profile_dir.BaseName().MaybeAsASCII() == last_profile) {
for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
@@ -888,7 +893,7 @@ ProfileManagerWithoutInit::ProfileManagerWithoutInit(
void ProfileManager::RegisterTestingProfile(Profile* profile,
bool add_to_cache) {
RegisterProfile(profile, true);
- if (add_to_cache){
+ if (add_to_cache) {
InitProfileUserPrefs(profile);
AddProfileToCache(profile);
}

Powered by Google App Engine
This is Rietveld 408576698