Index: chrome/browser/profiles/profile_impl.cc |
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
index 4f434b906a4bfe1d348283f808c7ef81dfb21374..264839ed21810e6ff0cf92e13f0b5a8a0edc125a 100644 |
--- a/chrome/browser/profiles/profile_impl.cc |
+++ b/chrome/browser/profiles/profile_impl.cc |
@@ -502,6 +502,10 @@ void ProfileImpl::DoFinalInit() { |
base::Bind(&ProfileImpl::UpdateProfileUserNameCache, |
base::Unretained(this))); |
pref_change_registrar_.Add( |
+ prefs::kManagedUserId, |
+ base::Bind(&ProfileImpl::UpdateProfileManagedUserIdCache, |
+ base::Unretained(this))); |
+ pref_change_registrar_.Add( |
prefs::kDefaultZoomLevel, |
base::Bind(&ProfileImpl::OnDefaultZoomLevelChanged, |
base::Unretained(this))); |
@@ -532,6 +536,7 @@ void ProfileImpl::DoFinalInit() { |
// kGoogleServicesUsername, initialize components that depend on it to reflect |
// the current value. |
UpdateProfileUserNameCache(); |
+ UpdateProfileManagedUserIdCache(); |
UpdateProfileIsEphemeralCache(); |
GAIAInfoUpdateServiceFactory::GetForProfile(this); |
@@ -1251,6 +1256,17 @@ void ProfileImpl::UpdateProfileUserNameCache() { |
} |
} |
+void ProfileImpl::UpdateProfileManagedUserIdCache() { |
+ ProfileManager* profile_manager = g_browser_process->profile_manager(); |
+ ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
+ size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
+ if (index != std::string::npos) { |
+ std::string managed_user_id = GetPrefs()->GetString(prefs::kManagedUserId); |
+ cache.SetManagedUserIdOfProfileAtIndex(index, managed_user_id); |
+ ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager); |
+ } |
+} |
+ |
void ProfileImpl::UpdateProfileNameCache() { |
ProfileManager* profile_manager = g_browser_process->profile_manager(); |
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |