Commit 3bf84960 authored by noms@chromium.org's avatar noms@chromium.org

[Mac] The GAIA profile photo should be resized in the Users controller menu

BUG=327087
TEST=Start chrome with the --google-profile-info flag, and a signed in
user. If you choose 'Users' for the top menu bar, the signed in user's
profile photo should be the same size as the other items.

Review URL: https://codereview.chromium.org/149513007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247952 0039d316-1c4b-4281-b951-d872f2087c98
parent 2e3d1f6b
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_info_interface.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_manager.h"
#include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
...@@ -129,7 +130,16 @@ class Observer : public chrome::BrowserListObserver, ...@@ -129,7 +130,16 @@ class Observer : public chrome::BrowserListObserver,
if (dock) { if (dock) {
[item setIndentationLevel:1]; [item setIndentationLevel:1];
} else { } 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) {
itemIcon = profiles::GetAvatarIconForWebUI(itemIcon, true);
}
DCHECK(itemIcon.Width() <= profiles::kAvatarIconWidth);
DCHECK(itemIcon.Height() <= profiles::kAvatarIconHeight);
[item setImage:itemIcon.ToNSImage()];
[item setState:itemData.active ? NSOnState : NSOffState]; [item setState:itemData.active ? NSOnState : NSOffState];
} }
[menu insertItem:item atIndex:i + offset]; [menu insertItem:item atIndex:i + offset];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment