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

Unified Diff: chrome/browser/ui/cocoa/web_intent_sheet_controller.mm

Issue 10283008: [WebIntents, OSX] Add close button to inline disposition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review nit. Created 8 years, 8 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/web_intent_sheet_controller.mm
diff --git a/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm b/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm
index bb3720c109984bc20050d8e53cc679d3cc3b8d14..b3f35ed4be295d99305d00d55101571e3ee5325f 100644
--- a/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm
+++ b/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm
@@ -540,6 +540,19 @@ const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing +
return NSHeight([button frame]);
}
+- (void)addCloseButtonToSubviews:(NSMutableArray*)subviews {
+ if (!closeButton_.get()) {
+ NSRect buttonFrame = NSMakeRect(
+ kFramePadding + kImageSize + kTextWidth, kFramePadding,
+ kCloseButtonSize, kCloseButtonSize);
+ closeButton_.reset(
+ [[HoverCloseButton alloc] initWithFrame:buttonFrame]);
+ [closeButton_ setTarget:self];
+ [closeButton_ setAction:@selector(cancelOperation:)];
+ }
+ [subviews addObject:closeButton_];
+}
+
// Adds a header (icon and explanatory text) to picker bubble.
// Returns the y position delta for the next offset.
- (CGFloat)addHeaderToSubviews:(NSMutableArray*)subviews
@@ -566,17 +579,8 @@ const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing +
NSRect textFrame = [actionTextField_ frame];
textFrame.origin.y = offset;
- NSRect buttonFrame = NSMakeRect(
- kFramePadding + kImageSize + kTextWidth, offset,
- kCloseButtonSize, kCloseButtonSize);
- closeButton_.reset(
- [[HoverCloseButton alloc] initWithFrame:buttonFrame]);
- [closeButton_ setTarget:self];
- [closeButton_ setAction:@selector(cancelOperation:)];
-
// Adjust view height to fit elements, center-align elements.
- CGFloat maxHeight = std::max(NSHeight(buttonFrame),
- std::max(NSHeight(imageFrame), NSHeight(textFrame)));
+ CGFloat maxHeight = std::max(NSHeight(imageFrame), NSHeight(textFrame));
textFrame.origin.y += (maxHeight - NSHeight(textFrame)) / 2;
imageFrame.origin.y += (maxHeight - NSHeight(imageFrame)) / 2;
@@ -585,7 +589,6 @@ const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing +
[subviews addObject:actionTextField_];
[subviews addObject:imageView];
- [subviews addObject:closeButton_];
return NSHeight([imageView frame]);
}
@@ -652,8 +655,11 @@ const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing +
if (contents_) {
offset += [self addInlineHtmlToSubviews:subviews atOffset:offset];
+ [self addCloseButtonToSubviews:subviews];
} else {
offset += [self addHeaderToSubviews:subviews atOffset:offset];
+ [self addCloseButtonToSubviews:subviews];
+
if (model) {
[intentButtons_ removeAllObjects];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698