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

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

Issue 242443005: Changes cocoa implementation of permission bubble to better match mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
Index: chrome/browser/ui/cocoa/website_settings/permission_selector_button.mm
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_selector_button.mm b/chrome/browser/ui/cocoa/website_settings/permission_selector_button.mm
index 49520a43d3e209795a3da01696c3e62ca8e5d095..bfa304dd51fb19688b8ad92f58b713d84f6a7541 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_selector_button.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_selector_button.mm
@@ -44,18 +44,18 @@ const CGFloat kPermissionButtonTitleRightPadding = 4;
[self sizeToFit];
// Size the button to just fit the visible title - not all of its items.
- [self setFrameSize:[self sizeForTitle:[self title]]];
+ [self setFrameSize:[PermissionSelectorButton sizeForTitle:[self title]
+ forButton:self]];
}
return self;
}
-// Determine the size of a popup button with the given title.
-- (NSSize)sizeForTitle:(NSString*)title {
- NSDictionary* textAttributes = @{NSFontAttributeName : [self font]};
++ (NSSize)sizeForTitle:(NSString*)title forButton:(NSButton*)button {
groby-ooo-7-16 2014/04/18 18:18:18 If you can at all, I think I'd move that onto the
leng 2014/04/18 22:48:46 I'll move this to a shared location in a subsequen
+ NSDictionary* textAttributes = @{NSFontAttributeName : [button font]};
NSSize titleSize = [title sizeWithAttributes:textAttributes];
- NSRect frame = [self frame];
- NSRect titleRect = [[self cell] titleRectForBounds:frame];
+ NSRect frame = [button frame];
+ NSRect titleRect = [[button cell] titleRectForBounds:frame];
CGFloat width = titleSize.width + NSWidth(frame) - NSWidth(titleRect);
return NSMakeSize(width + kPermissionButtonTitleRightPadding,
@@ -70,7 +70,9 @@ const CGFloat kPermissionButtonTitleRightPadding = 4;
static_cast<ContentSetting>([item tag]),
defaultSetting,
content_settings::SETTING_SOURCE_USER);
- NSSize size = [self sizeForTitle:base::SysUTF16ToNSString(title)];
+ NSSize size =
+ [PermissionSelectorButton sizeForTitle:base::SysUTF16ToNSString(title)
+ forButton:self];
maxTitleWidth = std::max(maxTitleWidth, size.width);
}
return maxTitleWidth;

Powered by Google App Engine
This is Rietveld 408576698