Index: chrome/browser/profiles/profile_manager.cc |
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
index d889d15a741312c9c4c14f78a76c82304995924a..0a6d3bbd9e0d77e8b3fb73fb87847e7828138078 100644 |
--- a/chrome/browser/profiles/profile_manager.cc |
+++ b/chrome/browser/profiles/profile_manager.cc |
@@ -723,8 +723,8 @@ void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( |
#endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { |
- DoFinalInitForServices(profile, go_off_the_record); |
InitProfileUserPrefs(profile); |
+ DoFinalInitForServices(profile, go_off_the_record); |
AddProfileToCache(profile); |
DoFinalInitLogging(profile); |
@@ -751,6 +751,12 @@ void ProfileManager::DoFinalInitForServices(Profile* profile, |
} |
} |
#endif |
+#if defined(ENABLE_MANAGED_USERS) |
+ // Initialization needs to happen after extension system initialization (for |
+ // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the |
+ // initializing the managed flag if necessary). |
+ ManagedUserServiceFactory::GetForProfile(profile)->Init(); |
+#endif |
} |
void ProfileManager::DoFinalInitLogging(Profile* profile) { |
@@ -959,14 +965,8 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) { |
if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileName)) |
profile->GetPrefs()->SetString(prefs::kProfileName, profile_name); |
- if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileIsManaged)) { |
+ if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileIsManaged)) |
profile->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, is_managed); |
-#if defined(ENABLE_MANAGED_USERS) |
- ManagedUserServiceFactory::GetForProfile(profile)->Init(); |
-#else |
- DCHECK(!is_managed); |
-#endif |
- } |
} |
bool ProfileManager::ShouldGoOffTheRecord() { |