Commit 0cb19df2 authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Updated profile icons to render as circles in the Mac people menu

Added support for circular profile icons in the People system menu
for Mac chromium builds. Updated the reference to the placeholder
icon to use the higher resolution version.

Bug: 857064
Change-Id: I93e68f13ea88827f4ac939d982d4ac55f83cf2f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1856876Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarThomas Tangl <tangltom@chromium.org>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707399}
parent 11df77f0
...@@ -44,12 +44,8 @@ AvatarMenu::ImageLoadStatus AvatarMenu::GetImageForMenuButton( ...@@ -44,12 +44,8 @@ AvatarMenu::ImageLoadStatus AvatarMenu::GetImageForMenuButton(
status = ImageLoadStatus::LOADING; status = ImageLoadStatus::LOADING;
} }
// Otherwise, use the default resource, not the downloaded high-res one. // Otherwise, use the high resolution icon from local storage.
const size_t icon_index = entry->GetAvatarIconIndex(); *image = entry->GetAvatarIcon();
const int resource_id =
profiles::GetDefaultAvatarIconResourceIDAtIndex(icon_index);
*image =
ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
return status; return status;
} }
...@@ -163,14 +163,12 @@ class Observer : public BrowserListObserver, public AvatarMenuObserver { ...@@ -163,14 +163,12 @@ class Observer : public BrowserListObserver, public AvatarMenuObserver {
// Always use the low-res, small default avatars in the menu. // Always use the low-res, small default avatars in the menu.
AvatarMenu::GetImageForMenuButton(itemData.profile_path, &itemIcon); AvatarMenu::GetImageForMenuButton(itemData.profile_path, &itemIcon);
// The image might be too large and need to be resized, e.g. if this is // Shapes the avatar icon into a circle for consistency with other avatar
// a signed-in user using the GAIA profile photo. // UI elements.
if (itemIcon.Width() > kMenuAvatarIconSize || itemIcon = profiles::GetSizedAvatarIcon(
itemIcon.Height() > kMenuAvatarIconSize) { itemIcon, /*is_rectangle=*/true, kMenuAvatarIconSize,
itemIcon = profiles::GetSizedAvatarIcon(itemIcon, /*is_rectangle=*/true, kMenuAvatarIconSize, profiles::SHAPE_CIRCLE);
kMenuAvatarIconSize,
kMenuAvatarIconSize);
}
[item setImage:itemIcon.ToNSImage()]; [item setImage:itemIcon.ToNSImage()];
[item setState:itemData.active ? NSOnState : NSOffState]; [item setState:itemData.active ? NSOnState : NSOffState];
} }
......
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