Chromium Code Reviews| Index: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| index 2b8dbf2e385f24fcc263f5e6a2abb4d259376a46..ab50cfdbbc7e6e75a2e18c7e20b495eef58f4e98 100644 |
| --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| @@ -571,14 +571,12 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| [[CustomCircleImageCell alloc] init]); |
| [self setCell:cell.get()]; |
| - const int imageSide = |
| - switches::IsMaterialDesignUserMenu() ? kMdImageSide : kLargeImageSide; |
| - [self setDefaultImage:CreateProfileImage(profileIcon, imageSide, |
| - profiles::SHAPE_CIRCLE)]; |
| + [self setDefaultImage:CreateProfileImage(profileIcon, kLargeImageSide, |
| + profiles::SHAPE_SQUARE)]; |
|
groby-ooo-7-16
2016/08/03 17:23:09
I'm confused - the "after" images still show a rou
Jane
2016/08/08 19:22:24
Yes it's still a round avatar, and no we are keepi
|
| [self setImagePosition:NSImageOnly]; |
| if (editingAllowed) { |
| - NSRect bounds = NSMakeRect(0, 0, imageSide, imageSide); |
| + NSRect bounds = NSMakeRect(0, 0, kLargeImageSide, kLargeImageSide); |
| [self setTarget:self]; |
| [self setAction:@selector(editPhoto:)]; |
| changePhotoImage_.reset([[TransparentBackgroundImageView alloc] |
| @@ -1912,20 +1910,38 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // Profile card button that contains the profile icon, name, and username. |
| NSRect rect = NSMakeRect(0, yOffset, GetFixedMenuWidth(), |
| kMdImageSide + kVerticalSpacing); |
| - NSButton* profileCard = [self hoverButtonWithRect:rect |
| - text:[[NSString alloc] init] |
| - action:@selector(editProfile:)]; |
| + NSButton* profileCard = |
| + [self hoverButtonWithRect:rect |
| + text:[[NSString alloc] init] |
| + image:CreateProfileImage(item.icon, kMdImageSide, |
| + profiles::SHAPE_CIRCLE) |
| + action:@selector(editProfile:)]; |
| + [[profileCard cell] setImageDimsWhenDisabled:NO]; |
|
groby-ooo-7-16
2016/08/03 17:23:09
How will the user tell it's disabled?
Jane
2016/08/08 19:22:24
Double checked with UI folks about this design:
"T
groby-ooo-7-16
2016/08/10 20:01:51
Mumblegrumble UI should always indicate if there i
Jane
2016/08/10 22:42:57
I will bring this up for UI review (coming soon)!
|
| [container addSubview:profileCard]; |
| if (isGuestSession_) |
| [profileCard setEnabled:NO]; |
| - // Profile icon, left-aligned. |
| - base::scoped_nsobject<NSImageView> iconView([[NSImageView alloc] |
| - initWithFrame:NSMakeRect(xOffset, cardYOffset, kMdImageSide, |
| - kMdImageSide)]); |
| - [iconView setImage:CreateProfileImage(item.icon, kMdImageSide, |
| - profiles::SHAPE_CIRCLE)]; |
| - [profileCard addSubview:iconView]; |
| + // Profile badge for supervised account. |
| + if (browser_->profile()->IsSupervised()) { |
| + base::scoped_nsobject<NSImageView> supervisedIcon( |
| + [[NSImageView alloc] initWithFrame:NSZeroRect]); |
| + // TODO(janeliulwq): Replace the following two profile badge icons with |
| + // smaller versions of them (24 x 24) to adapt to smaller profile icons. |
|
groby-ooo-7-16
2016/08/03 17:23:09
Note (not this CL): You probably want SVG images h
Jane
2016/08/08 19:22:24
Yes, I will be using SVG images! :) I'm just still
|
| + int imageId = browser_->profile()->IsChild() |
| + ? IDR_ICON_PROFILES_MENU_CHILD |
| + : IDR_ICON_PROFILES_MENU_LEGACY_SUPERVISED; |
| + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| + [supervisedIcon setImage:rb.GetNativeImageNamed(imageId).ToNSImage()]; |
| + |
| + NSSize size = [[supervisedIcon image] size]; |
| + [supervisedIcon setFrameSize:size]; |
| + const int badgeSpacing = 4; |
| + [supervisedIcon setFrameOrigin:NSMakePoint(xOffset + kMdImageSide - |
| + size.width + badgeSpacing, |
| + cardYOffset + kMdImageSide - |
| + size.height + badgeSpacing)]; |
| + [profileCard addSubview:supervisedIcon]; |
| + } |
| // Profile name, left-aligned to the right of profile icon. |
| xOffset += kMdImageSide + kHorizontalSpacing; |
| @@ -1936,12 +1952,14 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| NSZeroPoint, nil); |
| [[profileName cell] setLineBreakMode:NSLineBreakByTruncatingTail]; |
| [profileName setFont:[NSFont labelFontOfSize:fontSize]]; |
| + [profileName sizeToFit]; |
| + // Adding 1px in height to avoid cutting off certain letters on the bottom. |
|
groby-ooo-7-16
2016/08/03 17:23:09
That's weird - any chance the letters are cut off
Jane
2016/08/08 19:22:24
Woah, yes that's exactly why! Changed it to std::f
groby-ooo-7-16
2016/08/10 20:01:51
My pleasure. You have now passed the std::ceil rit
|
| [profileName |
| setFrame:NSMakeRect( |
| xOffset, |
| cardYOffset + |
| - (kMdImageSide - [profileName frame].size.height) / 2, |
| - availableTextWidth, [profileName frame].size.height)]; |
| + (kMdImageSide - [profileName frame].size.height - 1) / 2, |
| + availableTextWidth, [profileName frame].size.height + 1)]; |
| [profileCard addSubview:profileName]; |
| // Username, left-aligned to the right of profile icon and below the profile |
| @@ -1958,29 +1976,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| [profileCard addSubview:username]; |
| } |
| - // Profile badge for supervised account. |
| - if (browser_->profile()->IsSupervised()) { |
| - base::scoped_nsobject<NSImageView> supervisedIcon( |
| - [[NSImageView alloc] initWithFrame:NSZeroRect]); |
| - // TODO(janeliulwq): Replace the following two profile badge icons with |
| - // smaller versions of them (24 x 24) to adapt to smaller profile icons. |
| - int imageId = browser_->profile()->IsChild() |
| - ? IDR_ICON_PROFILES_MENU_CHILD |
| - : IDR_ICON_PROFILES_MENU_LEGACY_SUPERVISED; |
| - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| - [supervisedIcon setImage:rb.GetNativeImageNamed(imageId).ToNSImage()]; |
| - |
| - NSSize size = [[supervisedIcon image] size]; |
| - [supervisedIcon setFrameSize:size]; |
| - NSRect profileIconFrame = [iconView frame]; |
| - const int badgeSpacing = 4; |
| - [supervisedIcon setFrameOrigin:NSMakePoint(NSMaxX(profileIconFrame) - |
| - size.width + badgeSpacing, |
| - NSMaxY(profileIconFrame) - |
| - size.height + badgeSpacing)]; |
| - [profileCard addSubview:supervisedIcon]; |
| - } |
| - |
| yOffset = NSMaxY([profileCard frame]); |
| [container setFrameSize:NSMakeSize(GetFixedMenuWidth(), yOffset)]; |
| return container.autorelease(); |