Commit e8691be5 authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[Profiles menu] Increase avatar icon size to 20dp

This CL unifies the size of avatar icons in the Profiles native menu on
Mac with the Chrome profile menu.

Bug: 857064
Change-Id: Ie0336b272506ba10972921261eda8b055372de1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2545162
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Auto-Submit: Jan Krcal <jkrcal@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828359}
parent 4b43e99d
......@@ -439,21 +439,22 @@ gfx::Image GetAvatarIconForNSMenu(const base::FilePath& profile_path) {
// Get a higher res than 16px so it looks good after cropping to a circle.
gfx::Image icon =
entry->GetAvatarIcon(kAvatarIconSize, /*download_high_res=*/false);
return profiles::GetSizedAvatarIcon(icon, /*is_rectangle=*/true,
gfx::kFaviconSize, gfx::kFaviconSize,
profiles::SHAPE_CIRCLE);
return profiles::GetSizedAvatarIcon(
icon, /*is_rectangle=*/true, kMenuAvatarIconSize, kMenuAvatarIconSize,
profiles::SHAPE_CIRCLE);
}
constexpr int kMenuAvatarIconSize = 38;
constexpr int kOldMenuAvatarIconSize = 38;
gfx::Image icon =
entry->GetAvatarIcon(kMenuAvatarIconSize, /*download_high_res=*/false);
entry->GetAvatarIcon(kOldMenuAvatarIconSize, /*download_high_res=*/false);
// The image might be too large and need to be resized, e.g. if this is a
// signed-in user using the GAIA profile photo.
if (icon.Width() > kMenuAvatarIconSize ||
icon.Height() > kMenuAvatarIconSize) {
icon = profiles::GetSizedAvatarIcon(
icon, /*is_rectangle=*/true, kMenuAvatarIconSize, kMenuAvatarIconSize);
if (icon.Width() > kOldMenuAvatarIconSize ||
icon.Height() > kOldMenuAvatarIconSize) {
icon = profiles::GetSizedAvatarIcon(icon, /*is_rectangle=*/true,
kOldMenuAvatarIconSize,
kOldMenuAvatarIconSize);
}
return icon;
}
......
......@@ -40,6 +40,9 @@ const int kShortcutIconSizeWin = 48;
const int kProfileAvatarBadgeSizeWin = kShortcutIconSizeWin / 2;
#endif // OS_WIN
// Size of the small identity images for list of profiles to switch to.
constexpr int kMenuAvatarIconSize = 20;
// Avatar access.
extern const base::FilePath::CharType kGAIAPictureFileName[];
extern const base::FilePath::CharType kHighResAvatarFolderName[];
......
......@@ -685,7 +685,7 @@ void ProfileMenuView::BuildSelectableProfiles() {
AddSelectableProfile(
ui::ImageModel::FromImage(
profile_entry->GetAvatarIcon(kSelectableProfileImageSize)),
profile_entry->GetAvatarIcon(profiles::kMenuAvatarIconSize)),
profile_entry->GetName(),
/*is_guest=*/false,
base::BindRepeating(&ProfileMenuView::OnOtherProfileSelected,
......
......@@ -833,7 +833,7 @@ void ProfileMenuViewBase::AddSelectableProfile(
DCHECK(!image_model.IsEmpty());
gfx::ImageSkia sized_image = SizeImageModel(image_model, GetNativeTheme(),
kSelectableProfileImageSize);
profiles::kMenuAvatarIconSize);
views::Button* button = selectable_profiles_container_->AddChildView(
std::make_unique<HoverButton>(
......
......@@ -90,8 +90,6 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
// Size of the large identity image in the menu.
static constexpr int kIdentityImageSize = 64;
// Size of the small identity images for other selectable profiles.
static constexpr int kSelectableProfileImageSize = 20;
// Shows the bubble if one is not already showing. This allows us to easily
// make a button toggle the bubble on and off when clicked: we unconditionally
......
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