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) { ...@@ -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. // Get a higher res than 16px so it looks good after cropping to a circle.
gfx::Image icon = gfx::Image icon =
entry->GetAvatarIcon(kAvatarIconSize, /*download_high_res=*/false); entry->GetAvatarIcon(kAvatarIconSize, /*download_high_res=*/false);
return profiles::GetSizedAvatarIcon(icon, /*is_rectangle=*/true, return profiles::GetSizedAvatarIcon(
gfx::kFaviconSize, gfx::kFaviconSize, icon, /*is_rectangle=*/true, kMenuAvatarIconSize, kMenuAvatarIconSize,
profiles::SHAPE_CIRCLE); profiles::SHAPE_CIRCLE);
} }
constexpr int kMenuAvatarIconSize = 38; constexpr int kOldMenuAvatarIconSize = 38;
gfx::Image icon = 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 // 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. // signed-in user using the GAIA profile photo.
if (icon.Width() > kMenuAvatarIconSize || if (icon.Width() > kOldMenuAvatarIconSize ||
icon.Height() > kMenuAvatarIconSize) { icon.Height() > kOldMenuAvatarIconSize) {
icon = profiles::GetSizedAvatarIcon( icon = profiles::GetSizedAvatarIcon(icon, /*is_rectangle=*/true,
icon, /*is_rectangle=*/true, kMenuAvatarIconSize, kMenuAvatarIconSize); kOldMenuAvatarIconSize,
kOldMenuAvatarIconSize);
} }
return icon; return icon;
} }
......
...@@ -40,6 +40,9 @@ const int kShortcutIconSizeWin = 48; ...@@ -40,6 +40,9 @@ const int kShortcutIconSizeWin = 48;
const int kProfileAvatarBadgeSizeWin = kShortcutIconSizeWin / 2; const int kProfileAvatarBadgeSizeWin = kShortcutIconSizeWin / 2;
#endif // OS_WIN #endif // OS_WIN
// Size of the small identity images for list of profiles to switch to.
constexpr int kMenuAvatarIconSize = 20;
// Avatar access. // Avatar access.
extern const base::FilePath::CharType kGAIAPictureFileName[]; extern const base::FilePath::CharType kGAIAPictureFileName[];
extern const base::FilePath::CharType kHighResAvatarFolderName[]; extern const base::FilePath::CharType kHighResAvatarFolderName[];
......
...@@ -685,7 +685,7 @@ void ProfileMenuView::BuildSelectableProfiles() { ...@@ -685,7 +685,7 @@ void ProfileMenuView::BuildSelectableProfiles() {
AddSelectableProfile( AddSelectableProfile(
ui::ImageModel::FromImage( ui::ImageModel::FromImage(
profile_entry->GetAvatarIcon(kSelectableProfileImageSize)), profile_entry->GetAvatarIcon(profiles::kMenuAvatarIconSize)),
profile_entry->GetName(), profile_entry->GetName(),
/*is_guest=*/false, /*is_guest=*/false,
base::BindRepeating(&ProfileMenuView::OnOtherProfileSelected, base::BindRepeating(&ProfileMenuView::OnOtherProfileSelected,
......
...@@ -833,7 +833,7 @@ void ProfileMenuViewBase::AddSelectableProfile( ...@@ -833,7 +833,7 @@ void ProfileMenuViewBase::AddSelectableProfile(
DCHECK(!image_model.IsEmpty()); DCHECK(!image_model.IsEmpty());
gfx::ImageSkia sized_image = SizeImageModel(image_model, GetNativeTheme(), gfx::ImageSkia sized_image = SizeImageModel(image_model, GetNativeTheme(),
kSelectableProfileImageSize); profiles::kMenuAvatarIconSize);
views::Button* button = selectable_profiles_container_->AddChildView( views::Button* button = selectable_profiles_container_->AddChildView(
std::make_unique<HoverButton>( std::make_unique<HoverButton>(
......
...@@ -90,8 +90,6 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -90,8 +90,6 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
// Size of the large identity image in the menu. // Size of the large identity image in the menu.
static constexpr int kIdentityImageSize = 64; 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 // 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 // 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