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

Unified Diff: chrome/browser/profiles/avatar_menu_desktop.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/avatar_menu_desktop.cc
diff --git a/chrome/browser/profiles/avatar_menu_desktop.cc b/chrome/browser/profiles/avatar_menu_desktop.cc
index 2f5fcba1f294f9afb4057b5c34e557c8a5e683f1..0abc8870ff86b863210658211e0ed9650c03767c 100644
--- a/chrome/browser/profiles/avatar_menu_desktop.cc
+++ b/chrome/browser/profiles/avatar_menu_desktop.cc
@@ -6,8 +6,9 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_attributes_entry.h"
+#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
-#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "ui/base/resource/resource_bundle.h"
@@ -15,17 +16,17 @@
void AvatarMenu::GetImageForMenuButton(const base::FilePath& profile_path,
gfx::Image* image,
bool* is_rectangle) {
- ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(profile_path);
- if (index == std::string::npos) {
+ ProfileAttributesStorage& storage =
+ g_browser_process->profile_manager()->GetProfileAttributesStorage();
+ ProfileAttributesEntry* entry;
+ if (!storage.GetProfileAttributesWithPath(profile_path, &entry)) {
NOTREACHED();
return;
}
// If there is a Gaia image available, try to use that.
- if (cache.IsUsingGAIAPictureOfProfileAtIndex(index)) {
- const gfx::Image* gaia_image = cache.GetGAIAPictureOfProfileAtIndex(index);
+ if (entry->IsUsingGAIAPicture()) {
+ const gfx::Image* gaia_image = entry->GetGAIAPicture();
if (gaia_image) {
*image = *gaia_image;
*is_rectangle = true;
@@ -34,7 +35,7 @@ void AvatarMenu::GetImageForMenuButton(const base::FilePath& profile_path,
}
// Otherwise, use the default resource, not the downloaded high-res one.
- const size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(index);
+ const size_t icon_index = entry->GetAvatarIconIndex();
const int resource_id =
profiles::GetDefaultAvatarIconResourceIDAtIndex(icon_index);
*image = ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);

Powered by Google App Engine
This is Rietveld 408576698