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

Unified Diff: chrome/browser/cocoa/content_blocked_bubble_controller.mm

Issue 1527012: Mac: Make content bubbles wider in languages that have long translations of "Manage" and "Done. (Closed)
Patch Set: wide Created 10 years, 9 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 | « chrome/browser/cocoa/content_blocked_bubble_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/content_blocked_bubble_controller.mm
diff --git a/chrome/browser/cocoa/content_blocked_bubble_controller.mm b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
index 684a70b492333cdec6282a3f9c41b92b114b5088..64212749e9800aae0d01f3d65a80319f72d008fa 100644
--- a/chrome/browser/cocoa/content_blocked_bubble_controller.mm
+++ b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
@@ -53,6 +53,8 @@ const int kGeoPadding = 8;
// Padding between host names in the geolocation bubble.
const int kGeoHostPadding = 4;
+// Minimal padding between "Manage" and "Done" buttons.
+const int kManageDonePadding = 8;
TVL 2010/04/06 12:02:09 rather then having padding constants, I usually tr
// Like |ReplaceStringPlaceholders(const string16&, const string16&, size_t*)|,
// but for a NSString formatString.
@@ -97,6 +99,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
- (void)initializeRadioGroup;
- (void)initializePopupList;
- (void)initializeGeoLists;
+- (void)makeWideEnoughForManageDoneButtons;
- (void)popupLinkClicked:(id)sender;
- (void)clearGeolocationForCurrentHost:(id)sender;
@end
@@ -348,6 +351,22 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[contentsContainer_ setFrame:containerFrame];
}
+- (void)makeWideEnoughForManageDoneButtons {
+ CGFloat actualWidth = NSWidth([[[self window] contentView] frame]);
+ CGFloat requiredWidth = NSMaxX([manageButton_ frame]) + kManageDonePadding +
+ NSWidth([[doneButton_ superview] frame]) - NSMinX([doneButton_ frame]);
+ if (requiredWidth <= actualWidth || !doneButton_ || !manageButton_)
+ return;
+
+ // Resize window, autoresizing takes care of the rest.
+ NSSize size = NSMakeSize(requiredWidth - actualWidth, 0);
+ size = [[[self window] contentView] convertSize:size toView:nil];
+ NSRect frame = [[self window] frame];
+ frame.origin.x -= size.width;
+ frame.size.width += size.width;
+ [[self window] setFrame:frame display:NO];
+}
+
- (void)awakeFromNib {
DCHECK([self window]);
DCHECK_EQ(self, [[self window] delegate]);
@@ -355,6 +374,9 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[bubble_ setBubbleType:kWhiteInfoBubble];
[bubble_ setArrowLocation:kTopRight];
+ // Adapt window size to bottom buttons. Do this before all other layouting.
+ [self makeWideEnoughForManageDoneButtons];
+
[self initializeTitle];
if (allowBlockRadioGroup_) // not bound in cookie bubble xib
[self initializeRadioGroup];
« no previous file with comments | « chrome/browser/cocoa/content_blocked_bubble_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698