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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 1242793005: Refactor most c/b/profiles calls to ProfileInfoCache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows unit test and ChromeOS build Created 5 years, 5 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_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 4db6a3fccc4998fda4171b624e75b31c37548455..ea10eb343cf5a60a3d16d8aed7048f11d59f03d1 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -57,8 +57,9 @@
#include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
#include "chrome/browser/profiles/chrome_version_service.h"
#include "chrome/browser/profiles/gaia_info_update_service_factory.h"
+#include "chrome/browser/profiles/profile_attributes_entry.h"
+#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_destroyer.h"
-#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/push_messaging/push_messaging_service_factory.h"
@@ -1226,54 +1227,58 @@ GURL ProfileImpl::GetHomePage() {
void ProfileImpl::UpdateProfileSupervisedUserIdCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
- ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(GetPath());
- if (index != std::string::npos) {
+ ProfileAttributesStorage& storage =
+ profile_manager->GetProfileAttributesStorage();
+ ProfileAttributesEntry* entry;
+ if (storage.GetProfileAttributesWithPath(GetPath(), &entry)) {
std::string supervised_user_id =
GetPrefs()->GetString(prefs::kSupervisedUserId);
- cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id);
+ entry->SetSupervisedUserId(supervised_user_id);
ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager);
}
}
void ProfileImpl::UpdateProfileNameCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
- ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(GetPath());
- if (index != std::string::npos) {
+ ProfileAttributesStorage& storage =
+ profile_manager->GetProfileAttributesStorage();
+ ProfileAttributesEntry* entry;
+ if (storage.GetProfileAttributesWithPath(GetPath(), &entry)) {
std::string profile_name =
GetPrefs()->GetString(prefs::kProfileName);
- cache.SetNameOfProfileAtIndex(index, base::UTF8ToUTF16(profile_name));
+ entry->SetName(base::UTF8ToUTF16(profile_name));
bool default_name =
GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultName);
- cache.SetProfileIsUsingDefaultNameAtIndex(index, default_name);
+ entry->SetIsUsingDefaultName(default_name);
}
}
void ProfileImpl::UpdateProfileAvatarCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
- ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(GetPath());
- if (index != std::string::npos) {
+ ProfileAttributesStorage& storage =
+ profile_manager->GetProfileAttributesStorage();
+ ProfileAttributesEntry* entry;
+ if (storage.GetProfileAttributesWithPath(GetPath(), &entry)) {
size_t avatar_index =
GetPrefs()->GetInteger(prefs::kProfileAvatarIndex);
- cache.SetAvatarIconOfProfileAtIndex(index, avatar_index);
+ entry->SetAvatarIconIndex(avatar_index);
bool default_avatar =
GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultAvatar);
- cache.SetProfileIsUsingDefaultAvatarAtIndex(index, default_avatar);
+ entry->SetIsUsingDefaultAvatar(default_avatar);
bool gaia_avatar =
GetPrefs()->GetBoolean(prefs::kProfileUsingGAIAAvatar);
- cache.SetIsUsingGAIAPictureOfProfileAtIndex(index, gaia_avatar);
+ entry->SetIsUsingGAIAPicture(gaia_avatar);
}
}
void ProfileImpl::UpdateProfileIsEphemeralCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
- ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(GetPath());
- if (index != std::string::npos) {
+ ProfileAttributesStorage& storage =
+ profile_manager->GetProfileAttributesStorage();
+ ProfileAttributesEntry* entry;
+ if (storage.GetProfileAttributesWithPath(GetPath(), &entry)) {
bool is_ephemeral = GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles);
- cache.SetProfileIsEphemeralAtIndex(index, is_ephemeral);
+ entry->SetIsEphemeral(is_ephemeral);
}
}

Powered by Google App Engine
This is Rietveld 408576698