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

Unified Diff: chrome/browser/ui/cocoa/profile_menu_controller.mm

Issue 149513007: [Mac] The GAIA profile photo should be resized in the Users controller menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: alexei review Created 6 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profile_menu_controller.mm
diff --git a/chrome/browser/ui/cocoa/profile_menu_controller.mm b/chrome/browser/ui/cocoa/profile_menu_controller.mm
index 50a40db8f6f2816d2dcfb692572741579dd26f79..c30e163764203205cce121160b61641d4a6a6d91 100644
--- a/chrome/browser/ui/cocoa/profile_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/profile_menu_controller.mm
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_info_interface.h"
+#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
@@ -129,7 +130,14 @@ class Observer : public chrome::BrowserListObserver,
if (dock) {
[item setIndentationLevel:1];
} else {
- [item setImage:itemData.icon.ToNSImage()];
+ gfx::Image itemIcon = itemData.icon;
+ // The image might be too large and need to be resized (i.e. if this is
+ // a signed-in user using the GAIA profile photo).
+ if (itemIcon.Width() > profiles::kAvatarIconWidth ||
+ itemIcon.Height() > profiles::kAvatarIconHeight)
Alexei Svitkine (slow) 2014/01/29 21:08:25 Nit: add {}
noms (inactive) 2014/01/29 22:14:19 Done.
+ itemIcon = profiles::GetAvatarIconForWebUI(itemIcon, true);
Alexei Svitkine (slow) 2014/01/29 21:08:25 Maybe add DCHECKs that the new size meets the crit
noms (inactive) 2014/01/29 22:14:19 Done.
+
+ [item setImage:itemIcon.ToNSImage()];
[item setState:itemData.active ? NSOnState : NSOffState];
}
[menu insertItem:item atIndex:i + offset];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698