Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm

Issue 82933002: [rAc OSX] Simplify the overlay controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm b/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm
index 432a4a9c48c34f59f550d594414fdc09383353c7..14e4965e9f50936e2ccabe1c643505f82cab470f 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm
@@ -136,14 +136,14 @@ SkColor kSubtleBorderColor = 0xffdfdfdf;
[view setContentViewMargins:NSZeroSize];
[view setTitlePosition:NSNoTitle];
- childView_.reset([[NSView alloc] initWithFrame:NSZeroRect]);
messageView_.reset([[AutofillMessageView alloc] initWithFrame:NSZeroRect]);
imageView_.reset([[NSImageView alloc] initWithFrame:NSZeroRect]);
[imageView_ setImageAlignment:NSImageAlignCenter];
- [childView_ setSubviews:@[messageView_, imageView_]];
- [view addSubview:childView_];
+ [view setSubviews:@[messageView_, imageView_]];
[self setView:view];
+
+ [view setFillColor:[[view window] backgroundColor]];
groby-ooo-7-16 2013/11/22 14:24:03 This could also go if we just change contentView..
}
return self;
}
@@ -156,26 +156,16 @@ SkColor kSubtleBorderColor = 0xffdfdfdf;
return;
}
- NSBox* view = base::mac::ObjCCastStrict<NSBox>([self view]);
- [view setFillColor:[[view window] backgroundColor]];
- [view setAlphaValue:1];
- [childView_ setAlphaValue:1];
+ [[self view] setHidden:NO];
[imageView_ setImage:state.image.ToNSImage()];
[messageView_ setMessage:state.string];
- [childView_ setHidden:NO];
- [view setHidden:NO];
NSWindowController* delegate = [[[self view] window] windowController];
if ([delegate respondsToSelector:@selector(requestRelayout)])
[delegate performSelector:@selector(requestRelayout)];
}
-- (CGFloat)heightForWidth:(int) width {
- // 0 means "no preference". Image-only overlays fit the container.
- if ([messageView_ isHidden])
- return 0;
-
- // Overlays with text messages express a size preference.
+- (CGFloat)heightForWidth:(int)width {
return 2 * kOverlayImageVerticalPadding +
[messageView_ heightForWidth:width] +
[[imageView_ image] size].height;
@@ -188,11 +178,6 @@ SkColor kSubtleBorderColor = 0xffdfdfdf;
- (void)performLayout {
NSRect bounds = [[self view] bounds];
- [childView_ setFrame:bounds];
- if ([messageView_ isHidden]) {
- [imageView_ setFrame:bounds];
- return;
- }
int messageHeight = [messageView_ heightForWidth:NSWidth(bounds)];
[messageView_ setFrame:NSMakeRect(0, 0, NSWidth(bounds), messageHeight)];

Powered by Google App Engine
This is Rietveld 408576698