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

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: review 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 5da3be78b62c47c12387878f12773cef53f5a861..cbdf8361a3cb3bb80174677d535f34144c8332f7 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -678,6 +678,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;
@@ -709,6 +711,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() {
@@ -836,6 +839,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();
@@ -847,7 +853,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) {
@@ -912,7 +917,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