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

Side by Side Diff: chrome/browser/profiles/avatar_menu_desktop.cc

Issue 33753002: Sooper experimental refactoring of the profile info cache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/avatar_menu.h" 5 #include "chrome/browser/profiles/avatar_menu.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/profiles/profile_info_cache.h" 9 #include "chrome/browser/profiles/profile_info_cache.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
11 11
12 // static 12 // static
13 void AvatarMenu::GetImageForMenuButton(Profile* profile, 13 void AvatarMenu::GetImageForMenuButton(Profile* profile,
14 gfx::Image* image, 14 gfx::Image* image,
15 bool* is_rectangle) { 15 bool* is_rectangle) {
16 ProfileInfoCache& cache = 16 ProfileInfoCache& cache =
17 g_browser_process->profile_manager()->GetProfileInfoCache(); 17 g_browser_process->profile_manager()->GetProfileInfoCache();
18 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 18
19 if (index == std::string::npos) { 19 ProfileInfoEntry entry;
20 if (!cache.GetInfoForProfile(profile->GetPath(), &entry)) {
20 NOTREACHED(); 21 NOTREACHED();
21 return; 22 return;
22 } 23 }
23 24
24 *image = cache.GetAvatarIconOfProfileAtIndex(index); 25 *image = cache.GetAvatarIconOfProfile(entry.path());
25 *is_rectangle = 26 *is_rectangle =
26 cache.IsUsingGAIAPictureOfProfileAtIndex(index) && 27 entry.is_using_GAIA_picture() &&
27 cache.GetGAIAPictureOfProfileAtIndex(index); 28 cache.GetGAIAPictureOfProfile(entry.path());
28 } 29 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/avatar_menu_actions_desktop.cc ('k') | chrome/browser/profiles/gaia_info_update_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698