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

Unified Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm

Issue 186643005: Adds close button to cocoa permissions bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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/website_settings/permission_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
index 49f03c8ef29c297cc9ef3cf337f3b5afa4c952c6..22ea51cf208192b61b16e953b2547df717fda8c1 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
@@ -14,6 +14,7 @@
#import "chrome/browser/ui/chrome_style.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
+#import "chrome/browser/ui/cocoa/hover_close_button.h"
#import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
@@ -143,6 +144,14 @@ const base::char16 kBulletPoint = 0x2022;
bubbleFrame, NSInsetRect([view frame], -kHorizontalPadding, 0));
}
+ // 'x' button in the upper-right-hand corner.
+ base::scoped_nsobject<NSView> closeButton([[self closeButton] retain]);
groby-ooo-7-16 2014/03/04 21:04:01 I'm surprised this doesn't generate a warning - yo
leng 2014/03/04 23:35:52 There are a bunch of these.
+ [closeButton setFrameOrigin:NSMakePoint(
+ NSMaxX(bubbleFrame), yOffset - chrome_style::kCloseButtonPadding)];
+ bubbleFrame.size.width +=
+ NSWidth([closeButton frame]) + chrome_style::kCloseButtonPadding;
groby-ooo-7-16 2014/03/04 21:04:01 Wait - why is this adding twice the width? Border
leng 2014/03/04 23:35:52 I don't think I'm adding the width twice? I've pu
groby-ooo-7-16 2014/03/05 00:19:05 Never mind. kCloseButtonPadding somehow looked lik
+ [contentView addSubview:closeButton];
+
// Position the allow/ok button.
CGFloat xOrigin = NSWidth(bubbleFrame) - NSWidth([allowOrOkButton frame]) -
kHorizontalPadding;
@@ -280,6 +289,16 @@ const base::char16 kBulletPoint = 0x2022;
return button.autorelease();
}
+- (NSView*)closeButton {
groby-ooo-7-16 2014/03/04 21:04:01 Please add to private api.
leng 2014/03/04 23:35:52 Done.
+ int dimension = chrome_style::GetCloseButtonSize();
+ NSRect frame = NSMakeRect(0, 0, dimension, dimension);
+ base::scoped_nsobject<NSButton> button(
+ [[WebUIHoverCloseButton alloc] initWithFrame:frame]);
+ [button setAction:@selector(onBlock:)];
groby-ooo-7-16 2014/03/04 21:04:01 Is "close" really the same as "block"? Shouldn't i
leng 2014/03/04 23:35:52 Done.
+ [button setTarget:self];
+ return button.autorelease();
+}
+
- (void)ok:(id)sender {
DCHECK(delegate_);
delegate_->Closing();
« 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