Commit 6ebd60ce authored by treib@chromium.org's avatar treib@chromium.org

Add ProfileImpl::UpdateProfileManagedUserIdCache.

BUG=

Review URL: https://codereview.chromium.org/253723004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266692 0039d316-1c4b-4281-b951-d872f2087c98
parent 18d399c2
...@@ -501,6 +501,10 @@ void ProfileImpl::DoFinalInit() { ...@@ -501,6 +501,10 @@ void ProfileImpl::DoFinalInit() {
prefs::kGoogleServicesUsername, prefs::kGoogleServicesUsername,
base::Bind(&ProfileImpl::UpdateProfileUserNameCache, base::Bind(&ProfileImpl::UpdateProfileUserNameCache,
base::Unretained(this))); base::Unretained(this)));
pref_change_registrar_.Add(
prefs::kManagedUserId,
base::Bind(&ProfileImpl::UpdateProfileManagedUserIdCache,
base::Unretained(this)));
pref_change_registrar_.Add( pref_change_registrar_.Add(
prefs::kDefaultZoomLevel, prefs::kDefaultZoomLevel,
base::Bind(&ProfileImpl::OnDefaultZoomLevelChanged, base::Bind(&ProfileImpl::OnDefaultZoomLevelChanged,
...@@ -532,6 +536,7 @@ void ProfileImpl::DoFinalInit() { ...@@ -532,6 +536,7 @@ void ProfileImpl::DoFinalInit() {
// kGoogleServicesUsername, initialize components that depend on it to reflect // kGoogleServicesUsername, initialize components that depend on it to reflect
// the current value. // the current value.
UpdateProfileUserNameCache(); UpdateProfileUserNameCache();
UpdateProfileManagedUserIdCache();
UpdateProfileIsEphemeralCache(); UpdateProfileIsEphemeralCache();
GAIAInfoUpdateServiceFactory::GetForProfile(this); GAIAInfoUpdateServiceFactory::GetForProfile(this);
...@@ -1251,6 +1256,17 @@ void ProfileImpl::UpdateProfileUserNameCache() { ...@@ -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() { void ProfileImpl::UpdateProfileNameCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager(); ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
......
...@@ -195,9 +195,9 @@ class ProfileImpl : public Profile { ...@@ -195,9 +195,9 @@ class ProfileImpl : public Profile {
GetRequestContext(); GetRequestContext();
} }
void UpdateProfileUserNameCache();
// Updates the ProfileInfoCache with data from this profile. // Updates the ProfileInfoCache with data from this profile.
void UpdateProfileUserNameCache();
void UpdateProfileManagedUserIdCache();
void UpdateProfileNameCache(); void UpdateProfileNameCache();
void UpdateProfileAvatarCache(); void UpdateProfileAvatarCache();
void UpdateProfileIsEphemeralCache(); void UpdateProfileIsEphemeralCache();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment