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

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, 9 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/webui/options2/browser_options_handler2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index b88fbc4b83e9477a95ea1e8b7f9bf0182cf5bbdd..7307ee033b1deff1d571964234ad09fbb67874ab 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -685,6 +685,8 @@ FilePath ProfileManager::GenerateNextProfileDirectoryPath() {
PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
+ DCHECK(IsMultipleProfilesEnabled());
+
// Create the next profile in the next available directory slot.
int next_directory = local_state->GetInteger(prefs::kProfilesNumCreated);
std::string profile_name = chrome::kMultiProfileDirPrefix;
@@ -844,6 +846,8 @@ bool ProfileManager::ShouldGoOffTheRecord() {
}
void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
+ DCHECK(IsMultipleProfilesEnabled());
+
// If we're deleting the last profile, then create a new profile in its
// place.
ProfileInfoCache& cache = GetProfileInfoCache();
@@ -892,10 +896,13 @@ void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
// static
bool ProfileManager::IsMultipleProfilesEnabled() {
#if defined(OS_CHROMEOS)
- return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles);
-#else
- return true;
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles))
+ return false;
#endif
+ // |g_browser_process| can be NULL during startup.
+ if (!g_browser_process)
+ return true;
+ return !g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode);
}
void ProfileManager::AutoloadProfiles() {
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/browser_options_handler2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698