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

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

Issue 1972033002: Simplify some old avatar menu button code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/view_ids.h » ('j') | chrome/browser/ui/view_ids.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_attributes_entry.h" 11 #include "chrome/browser/profiles/profile_attributes_entry.h"
12 #include "chrome/browser/profiles/profile_attributes_storage.h" 12 #include "chrome/browser/profiles/profile_attributes_storage.h"
13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 13 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 16
17 // static 17 // static
18 void AvatarMenu::GetImageForMenuButton(const base::FilePath& profile_path, 18 void AvatarMenu::GetImageForMenuButton(const base::FilePath& profile_path,
19 gfx::Image* image, 19 gfx::Image* image,
20 bool* is_rectangle) { 20 bool* is_rectangle) {
21 ProfileAttributesEntry* entry; 21 ProfileAttributesEntry* entry;
22 if (!g_browser_process->profile_manager()->GetProfileAttributesStorage(). 22 if (!g_browser_process->profile_manager()->GetProfileAttributesStorage().
23 GetProfileAttributesWithPath(profile_path, &entry)) { 23 GetProfileAttributesWithPath(profile_path, &entry)) {
24 NOTREACHED();
Peter Kasting 2016/05/17 03:51:42 So can this actually be reached, maybe for disk co
Evan Stade 2016/05/17 18:13:08 I made this change because we already had a lot of
25 return; 24 return;
26 } 25 }
27 26
28 // If there is a Gaia image available, try to use that. 27 // If there is a Gaia image available, try to use that.
29 if (entry->IsUsingGAIAPicture()) { 28 if (entry->IsUsingGAIAPicture()) {
30 const gfx::Image* gaia_image = entry->GetGAIAPicture(); 29 const gfx::Image* gaia_image = entry->GetGAIAPicture();
31 if (gaia_image) { 30 if (gaia_image) {
32 *image = *gaia_image; 31 *image = *gaia_image;
33 *is_rectangle = true; 32 *is_rectangle = true;
34 return; 33 return;
35 } 34 }
36 } 35 }
37 36
38 // Otherwise, use the default resource, not the downloaded high-res one. 37 // Otherwise, use the default resource, not the downloaded high-res one.
39 const size_t icon_index = entry->GetAvatarIconIndex(); 38 const size_t icon_index = entry->GetAvatarIconIndex();
40 const int resource_id = 39 const int resource_id =
41 profiles::GetDefaultAvatarIconResourceIDAtIndex(icon_index); 40 profiles::GetDefaultAvatarIconResourceIDAtIndex(icon_index);
42 *image = ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); 41 *image = ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
43 *is_rectangle = false; 42 *is_rectangle = false;
44 } 43 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/view_ids.h » ('j') | chrome/browser/ui/view_ids.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698