Commit 862611f3 authored by noms@chromium.org's avatar noms@chromium.org

[Mac] Misc fixes for the new avatar bubble

In this CL:
- crbug.com/343688: when editing the profile name but not changing it, the text field would
freeze. this is because it would remain enabled, but hidden, and steal the button click
(because it used to be a first responder)
- add a separator between the "not you" and "lock" bottom option buttons, to
match the mocks. I added this as a vertical separator to the BaseBubbleController itself, 
so that other classes can use it in the future.
- center the profile name correctly. Because of the pencil icon, the name would be shifted
slightly to the left
- the "change photo" overlay should be more opaque
- the bubble bottom corners were overlapped by the option buttons, and didn't appear rounded.

BUG=343688

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278840 0039d316-1c4b-4281-b951-d872f2087c98
parent ba8d1412
......@@ -83,9 +83,14 @@ class TabStripModelObserverBridge;
parentWindow:(NSWindow*)parentWindow
anchoredAt:(NSPoint)anchoredAt;
// Creates an autoreleased separator view with a given frame. The height of the
// frame is ignored.
- (NSBox*)separatorWithFrame:(NSRect)frame;
// Creates an autoreleased horizontal separator view with a given frame. The
// height of the frame is ignored.
- (NSBox*)horizontalSeparatorWithFrame:(NSRect)frame;
// Creates an autoreleased vertical separator view with a given frame. The
// width of frame is ignored.
- (NSBox*)verticalSeparatorWithFrame:(NSRect)frame;
@end
......
......@@ -148,7 +148,7 @@
anchorOffset_.y -= anchor_.y;
}
- (NSBox*)separatorWithFrame:(NSRect)frame {
- (NSBox*)horizontalSeparatorWithFrame:(NSRect)frame {
frame.size.height = 1.0;
base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:frame]);
[spacer setBoxType:NSBoxSeparator];
......@@ -157,6 +157,15 @@
return [spacer.release() autorelease];
}
- (NSBox*)verticalSeparatorWithFrame:(NSRect)frame {
frame.size.width = 1.0;
base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:frame]);
[spacer setBoxType:NSBoxSeparator];
[spacer setBorderType:NSLineBorder];
[spacer setAlphaValue:0.2];
return [spacer.release() autorelease];
}
- (void)parentWindowDidResize:(NSNotification*)notification {
if (!parentWindow_)
return;
......
......@@ -224,7 +224,7 @@ const CGFloat kSupervisedUserSpacing = 26.0;
[contentView addSubview:newButton];
yOffset += NSHeight([newButton frame]) + kVerticalSpacing;
NSBox* separator = [self separatorWithFrame:
NSBox* separator = [self horizontalSeparatorWithFrame:
NSMakeRect(10, yOffset, NSWidth([contentView frame]) - 20, 0)];
[separator setAutoresizingMask:NSViewWidthSizable];
[contentView addSubview:separator];
......@@ -262,7 +262,7 @@ const CGFloat kSupervisedUserSpacing = 26.0;
[contentView addSubview:newButton];
yOffset += NSHeight([newButton frame]) + kVerticalSpacing;
NSBox* separator = [self separatorWithFrame:
NSBox* separator = [self horizontalSeparatorWithFrame:
NSMakeRect(10, yOffset, NSWidth([contentView frame]) - 20, 0)];
[separator setAutoresizingMask:NSViewWidthSizable];
[contentView addSubview:separator];
......@@ -288,7 +288,7 @@ const CGFloat kSupervisedUserSpacing = 26.0;
[contentView addSubview:info];
yOffset += NSHeight([info frame]) + kVerticalSpacing;
separator = [self separatorWithFrame:
separator = [self horizontalSeparatorWithFrame:
NSMakeRect(10, yOffset, NSWidth([contentView frame]) - 20, 0)];
[separator setAutoresizingMask:NSViewWidthSizable];
[contentView addSubview:separator];
......
......@@ -392,16 +392,21 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
// and one option buttons view.
EXPECT_EQ(5U, [subviews count]);
// There should be two buttons in the option buttons view.
// There should be two buttons and a separator in the option buttons view.
NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
const SEL buttonSelectors[] = { @selector(showUserManager:),
@selector(lockProfile:) };
EXPECT_EQ(2U, [buttonSubviews count]);
for (NSUInteger i = 0; i < [buttonSubviews count]; ++i) {
NSButton* button = static_cast<NSButton*>([buttonSubviews objectAtIndex:i]);
EXPECT_EQ(buttonSelectors[i], [button action]);
EXPECT_EQ(controller(), [button target]);
}
EXPECT_EQ(3U, [buttonSubviews count]);
NSButton* notYouButton =
static_cast<NSButton*>([buttonSubviews objectAtIndex:0]);
EXPECT_EQ(@selector(showUserManager:), [notYouButton action]);
EXPECT_EQ(controller(), [notYouButton target]);
EXPECT_TRUE([[buttonSubviews objectAtIndex:1] isKindOfClass:[NSBox class]]);
NSButton* lockButton =
static_cast<NSButton*>([buttonSubviews objectAtIndex:2]);
EXPECT_EQ(@selector(lockProfile:), [lockButton action]);
EXPECT_EQ(controller(), [lockButton target]);
// There should be a separator.
EXPECT_TRUE([[subviews objectAtIndex:1] isKindOfClass:[NSBox class]]);
......
......@@ -808,8 +808,8 @@ NSColor* IdentityVerifiedTextColor() {
CGFloat width = NSWidth([view frame]) - 2 * kFramePadding;
// Use an arbitrary position; it will be adjusted in performLayout.
NSBox* spacer =
[self separatorWithFrame:NSMakeRect(kFramePadding, 0, width, 0)];
NSBox* spacer = [self horizontalSeparatorWithFrame:NSMakeRect(
kFramePadding, 0, width, 0)];
[view addSubview:spacer];
return spacer;
}
......
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