From 65ce7b7c05b1ce8bb1ca0c6c460c5a79d726356a Mon Sep 17 00:00:00 2001 From: "bauerb@chromium.org" Date: Fri, 30 Apr 2010 08:45:58 +0000 Subject: Revert 46049 - [Mac] Make exceptions dialog a sheet. XIB changes (applying to ContentExceptionsWindow.xib and GeolocationExceptionsWindow.xib): The window is now drawn in Aqua style, with window margins, Aqua buttons and text labels for them. At the bottom right of the window there is an additional button for closing the sheet, hooked up to the |doneButton_| outlet in the file's owner and with action |closeSheet:|. The lefthand side buttons are inside a |GTMWidthBasedTweaker|, as is the done button. The actual tweaking is done by a newly added |GTMUILocalizerAndLayoutTweaker|. BUG=38021 TEST=Preferences > Under the Hood > Content Settings > Exceptions should be a sheet. Review URL: http://codereview.chromium.org/1760001 TBR=bauerb@chromium.org Review URL: http://codereview.chromium.org/1790009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46050 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/nibs/ContentExceptionsWindow.xib | 490 +++++++-------------- chrome/app/nibs/GeolocationExceptionsWindow.xib | 303 +++---------- .../cocoa/content_exceptions_window_controller.h | 15 +- .../cocoa/content_exceptions_window_controller.mm | 49 +-- .../cocoa/content_settings_dialog_controller.h | 3 - .../cocoa/content_settings_dialog_controller.mm | 16 +- .../geolocation_exceptions_window_controller.h | 9 +- .../geolocation_exceptions_window_controller.mm | 48 +- 8 files changed, 258 insertions(+), 675 deletions(-) diff --git a/chrome/app/nibs/ContentExceptionsWindow.xib b/chrome/app/nibs/ContentExceptionsWindow.xib index 9e2b30f..1ccb4c4 100644 --- a/chrome/app/nibs/ContentExceptionsWindow.xib +++ b/chrome/app/nibs/ContentExceptionsWindow.xib @@ -37,13 +37,13 @@ 15 2 - {{477, 138}, {533, 448}} + {{477, 301}, {480, 285}} 536870912 Title set by controller NSWindow {3.40282e+38, 3.40282e+38} - {425, 131} + {200, 100} 256 @@ -62,13 +62,13 @@ 256 - {491, 351} + {480, 233} YES 256 - {491, 17} + {480, 17} @@ -82,7 +82,7 @@ YES pattern - 3.120000e+02 + 3.020000e+02 4.000000e+01 1.000000e+03 @@ -141,7 +141,7 @@ action - 1.730000e+02 + 1.720000e+02 4.000000e+01 1.000000e+03 @@ -223,7 +223,7 @@ YES - {{1, 17}, {491, 351}} + {{1, 17}, {480, 233}} @@ -233,21 +233,22 @@ -2147483392 - {{368, 17}, {15, 327}} + {{466, 17}, {15, 218}} _doScroller: - 9.941860e-01 + 1.000000e+00 + 9.356223e-01 -2147483392 - {{1, 344}, {367, 15}} + {{1, 235}, {465, 15}} 1 _doScroller: - 9.973890e-01 + 9.979210e-01 @@ -256,7 +257,7 @@ YES - {{1, 0}, {491, 17}} + {{1, 0}, {480, 17}} @@ -265,7 +266,7 @@ - {{20, 59}, {493, 369}} + {{-1, 35}, {482, 251}} 562 @@ -276,124 +277,85 @@ QSAAAEEgAABBmAAAQZgAAA - + 292 - - YES - - - 292 - {{14, 12}, {79, 32}} - - YES - - 67239424 - 134217728 - ^IDS_EXCEPTIONS_ADD_BUTTON - - - -2038021889 - 129 - - - - 400 - 75 - - - - - 292 - {{93, 12}, {90, 32}} - - YES - - -2080244224 - 134217728 - ^IDS_EXCEPTIONS_REMOVE_BUTTON - - - -2038021889 - 129 - - - - 400 - 75 - - - - - 292 - {{183, 12}, {124, 32}} - - YES - - -2080244224 - 134217728 - ^IDS_EXCEPTIONS_REMOVEALL_BUTTON - - - -2038021889 - 129 - - - - 400 - 75 - + {{7, 5}, {25, 25}} + + YES + + -2080244224 + 134217728 + + + + -2033958657 + 163 + + NSImage + NSAddTemplate + + + 400 + 75 - {307, 51} - - GTMWidthBasedTweaker - + - 289 - - YES - - - 289 - {{0, 12}, {73, 32}} - - YES - - -2080244224 - 134217728 - ^IDS_DONE - - - -2038021889 - 129 - - - - 400 - 75 - + 292 + {{40, 5}, {25, 25}} + + YES + + -2080244224 + 134217728 + + + + -2033958657 + 163 + + NSImage + NSRemoveTemplate + + + 400 + 75 - {{446, 0}, {87, 51}} + + + + 292 + {{73, 5}, {96, 25}} - GTMWidthBasedTweaker + YES + + -2080244224 + 134217728 + ^IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_ALL_BUTTON + + + -2038152961 + 163 + + + 400 + 75 + - {533, 448} + {480, 285} {{0, 0}, {1440, 878}} - {425, 153} + {200, 122} {3.40282e+38, 3.40282e+38} ChromeUILocalizer - - GTMUILocalizerAndLayoutTweaker - @@ -424,6 +386,30 @@ + addButton_ + + + + 22 + + + + removeButton_ + + + + 23 + + + + removeAllButton_ + + + + 24 + + + tableView_ @@ -448,91 +434,27 @@ - closeSheet: - - - - 55 - - - - removeAllExceptions: - - - - 56 - - - addException: - + - 57 + 28 removeException: - - - 58 - - - - addButton_ - - - - 59 - - - - removeButton_ - - - - 61 - - - - removeAllButton_ - - + - 62 + 29 - - initialFirstResponder - - - - 63 - - - - localizer_ - - - - 65 - - - - uiObject_ - - - - 66 - - - - doneButton_ + + removeAllExceptions: - + - 67 + 30 @@ -579,8 +501,9 @@ YES - - + + + @@ -645,113 +568,74 @@ - 20 - - - - - 31 - - - YES - - - - - - 32 - + 14 + YES - + - + - 33 - - + 15 + + - 39 - + 16 + YES - - - + - 44 - - - YES - - - - - - 45 - - - YES - - - + 17 + + - 46 - + 18 + YES - + - - - - 47 - - + - 48 - - + 19 + + - 49 - - + 20 + + - 50 - + 31 + YES - + - + - 53 - + 32 + YES - + - - - - 54 - - + - 64 - - + 33 + + @@ -764,7 +648,6 @@ -3.IBPluginDependency 1.IBEditorWindowLastContentRect 1.IBPluginDependency - 1.IBViewEditorWindowController.showingLayoutRectangles 1.IBWindowTemplateEditedContentRect 1.NSWindowTemplate.visibleAtLaunch 1.WindowOrigin @@ -774,23 +657,20 @@ 10.IBPluginDependency 11.IBPluginDependency 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 19.IBPluginDependency 2.IBPluginDependency 20.IBPluginDependency 31.IBPluginDependency 32.IBEditorWindowLastContentRect 32.IBPluginDependency 33.IBPluginDependency - 44.IBPluginDependency - 45.IBPluginDependency - 46.IBPluginDependency - 47.IBPluginDependency - 48.IBPluginDependency - 49.IBPluginDependency 5.IBPluginDependency - 53.IBPluginDependency - 54.IBPluginDependency 6.IBPluginDependency - 64.IBPluginDependency 7.IBPluginDependency 8.IBPluginDependency 9.IBPluginDependency @@ -800,24 +680,19 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{507, 468}, {533, 448}} + {{128, 406}, {480, 285}} com.apple.InterfaceBuilder.CocoaPlugin - - {{507, 468}, {533, 448}} - + {{128, 406}, {480, 285}} + {196, 240} {{357, 418}, {480, 270}} - - {425, 131} - com.apple.InterfaceBuilder.CocoaPlugin + + {200, 100} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{13, 491}, {480, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -825,6 +700,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{13, 491}, {480, 20}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -854,7 +730,7 @@ - 67 + 33 @@ -876,7 +752,6 @@ YES addException: cancel: - closeSheet: removeAllExceptions: removeException: @@ -886,7 +761,6 @@ id id id - id @@ -894,7 +768,6 @@ YES addButton_ - doneButton_ removeAllButton_ removeButton_ tableView_ @@ -904,7 +777,6 @@ NSButton NSButton NSButton - NSButton NSTableView @@ -937,49 +809,6 @@ - GTMUILocalizerAndLayoutTweaker - NSObject - - YES - - YES - localizerOwner_ - localizer_ - uiObject_ - - - YES - id - GTMUILocalizer - id - - - - IBProjectSource - ../third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h - - - - GTMWidthBasedTweaker - NSView - - YES - - YES - viewToResize_ - viewToSlideAndResize_ - viewToSlide_ - - - YES - id - NSView - NSView - - - - - NSMenuItem IBProjectSource @@ -990,13 +819,6 @@ NSObject IBProjectSource - ../third_party/GTM/Foundation/GTMNSObject+KeyValueObserving.h - - - - NSObject - - IBProjectSource browser/cocoa/status_bubble_mac.h diff --git a/chrome/app/nibs/GeolocationExceptionsWindow.xib b/chrome/app/nibs/GeolocationExceptionsWindow.xib index f3c57aa..ed6cea4 100644 --- a/chrome/app/nibs/GeolocationExceptionsWindow.xib +++ b/chrome/app/nibs/GeolocationExceptionsWindow.xib @@ -3,12 +3,12 @@ 1050 9L31a - 680 + 677 949.54 353.00 YES - + YES @@ -37,7 +37,7 @@ 15 2 - {{477, 202}, {474, 384}} + {{477, 301}, {480, 285}} 536870912 ^IDS_GEOLOCATION_EXCEPTION_TITLE NSWindow @@ -62,13 +62,13 @@ 256 - {432, 287} + {480, 233} YES 256 - {432, 17} + {480, 17} @@ -82,7 +82,7 @@ YES hostname - 2.750000e+02 + 3.020000e+02 4.000000e+01 1.000000e+03 @@ -141,7 +141,7 @@ action - 1.510000e+02 + 1.720000e+02 4.000000e+01 1.000000e+03 @@ -195,7 +195,7 @@ YES - {{1, 17}, {432, 287}} + {{1, 17}, {480, 233}} @@ -205,21 +205,22 @@ -2147483392 - {{509, 17}, {15, 270}} + {{466, 17}, {15, 218}} _doScroller: + 1.000000e+00 9.356223e-01 -2147483392 - {{1, 287}, {508, 15}} + {{1, 235}, {465, 15}} 1 _doScroller: - 9.980916e-01 + 9.979210e-01 @@ -228,7 +229,7 @@ YES - {{1, 0}, {432, 17}} + {{1, 0}, {480, 17}} @@ -237,7 +238,7 @@ - {{20, 59}, {434, 305}} + {{-1, 35}, {482, 251}} 562 @@ -248,91 +249,52 @@ QSAAAEEgAABBmAAAQZgAAA - + 292 - - YES - - - 292 - {{106, 12}, {96, 32}} - - YES - - -2080244224 - 134217728 - ^IDS_EXCEPTIONS_REMOVEALL_BUTTON - - - -2038021889 - 129 - - - - 400 - 75 - - - - - 292 - {{14, 12}, {92, 32}} - - YES - - -2080244224 - 134217728 - ^IDS_EXCEPTIONS_REMOVE_BUTTON - - - -2038021889 - 129 - - - - 400 - 75 - + {{7, 5}, {25, 25}} + + YES + + -2080244224 + 134217728 + + + + -2033958657 + 163 + + NSImage + NSRemoveTemplate + + + 400 + 75 - {202, 60} - - GTMWidthBasedTweaker - + - 289 - - YES - - - 289 - {{0, 12}, {96, 32}} - - YES - - -2080244224 - 134217728 - ^IDS_DONE - - - -2038021889 - 129 - - - - 400 - 75 - - - - {{364, 0}, {110, 60}} + 292 + {{40, 5}, {96, 25}} - GTMWidthBasedTweaker + YES + + -2080244224 + 134217728 + ^IDS_EXCEPTIONS_REMOVEALL_BUTTON + + + -2038152961 + 163 + + + 400 + 75 + - {474, 384} + {480, 285} {{0, 0}, {1440, 878}} @@ -342,9 +304,6 @@ ChromeUILocalizer - - GTMUILocalizerAndLayoutTweaker - @@ -429,38 +388,6 @@ 37 - - - closeSheet: - - - - 41 - - - - localizer_ - - - - 45 - - - - uiObject_ - - - - 46 - - - - doneButton_ - - - - 47 - @@ -505,9 +432,9 @@ YES - - + + @@ -572,33 +499,13 @@ - 20 - - - - - 38 - - - - - 42 - - - YES - - - - - - 16 YES - + 17 @@ -606,36 +513,13 @@ - 43 - - - YES - - - - - - 39 - - - YES - - - - - - 40 - - - - 18 YES - + 19 @@ -643,10 +527,15 @@ - 44 - + 20 + + + 38 + + + @@ -674,9 +563,6 @@ 2.IBPluginDependency 20.IBPluginDependency 38.IBPluginDependency - 39.IBPluginDependency - 40.IBPluginDependency - 44.IBPluginDependency 5.IBPluginDependency 6.IBPluginDependency 7.IBPluginDependency @@ -688,10 +574,10 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{125, 434}, {474, 384}} + {{128, 406}, {480, 285}} com.apple.InterfaceBuilder.CocoaPlugin - {{125, 434}, {474, 384}} - + {{128, 406}, {480, 285}} + {196, 240} {{357, 418}, {480, 270}} @@ -711,9 +597,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin @@ -736,7 +619,7 @@ - 47 + 38 @@ -773,56 +656,12 @@ - GTMUILocalizerAndLayoutTweaker - NSObject - - YES - - YES - localizerOwner_ - localizer_ - uiObject_ - - - YES - id - GTMUILocalizer - id - - - - IBProjectSource - ../third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h - - - - GTMWidthBasedTweaker - NSView - - YES - - YES - viewToResize_ - viewToSlideAndResize_ - viewToSlide_ - - - YES - id - NSView - NSView - - - - - GeolocationExceptionsWindowController NSWindowController YES YES - closeSheet: removeAllExceptions: removeException: @@ -830,14 +669,12 @@ YES id id - id YES YES - doneButton_ removeAllButton_ removeButton_ tableView_ @@ -846,7 +683,6 @@ YES NSButton NSButton - NSButton NSTableView @@ -859,13 +695,6 @@ NSObject IBProjectSource - ../third_party/GTM/Foundation/GTMNSObject+KeyValueObserving.h - - - - NSObject - - IBProjectSource browser/cocoa/status_bubble_mac.h diff --git a/chrome/browser/cocoa/content_exceptions_window_controller.h b/chrome/browser/cocoa/content_exceptions_window_controller.h index 1d1bc2a..91a5b33 100644 --- a/chrome/browser/cocoa/content_exceptions_window_controller.h +++ b/chrome/browser/cocoa/content_exceptions_window_controller.h @@ -24,7 +24,6 @@ class UpdatingContentSettingsObserver; IBOutlet NSButton* addButton_; IBOutlet NSButton* removeButton_; IBOutlet NSButton* removeAllButton_; - IBOutlet NSButton* doneButton_; ContentSettingsType settingsType_; HostContentSettingsMap* settingsMap_; // weak @@ -46,22 +45,14 @@ class UpdatingContentSettingsObserver; scoped_ptr newException_; } -// Returns the content exceptions window controller for |settingsType|. +// Shows or makes frontmost the content exceptions window for |settingsType|. // Changes made by the user in the window are persisted in |settingsMap|. -+ (id)controllerForType:(ContentSettingsType)settingsType - settingsMap:(HostContentSettingsMap*)settingsMap; - -// Shows the exceptions dialog as a modal sheet attached to |window|. -- (void)attachSheetTo:(NSWindow*)window; - -// Sets the minimum width of the sheet and resizes it if necessary. -- (void)setMinWidth:(CGFloat)minWidth; ++ (id)showForType:(ContentSettingsType)settingsType + settingsMap:(HostContentSettingsMap*)settingsMap; - (IBAction)addException:(id)sender; - (IBAction)removeException:(id)sender; - (IBAction)removeAllExceptions:(id)sender; -// Closes the sheet and ends the modal loop. -- (IBAction)closeSheet:(id)sender; @end diff --git a/chrome/browser/cocoa/content_exceptions_window_controller.mm b/chrome/browser/cocoa/content_exceptions_window_controller.mm index 0ebcb8e..de51985 100644 --- a/chrome/browser/cocoa/content_exceptions_window_controller.mm +++ b/chrome/browser/cocoa/content_exceptions_window_controller.mm @@ -140,13 +140,14 @@ static ContentExceptionsWindowController* @implementation ContentExceptionsWindowController -+ (id)controllerForType:(ContentSettingsType)settingsType - settingsMap:(HostContentSettingsMap*)settingsMap { ++ (id)showForType:(ContentSettingsType)settingsType + settingsMap:(HostContentSettingsMap*)settingsMap { if (!g_exceptionWindows[settingsType]) { g_exceptionWindows[settingsType] = [[ContentExceptionsWindowController alloc] initWithType:settingsType settingsMap:settingsMap]; } + [g_exceptionWindows[settingsType] showWindow:nil]; return g_exceptionWindows[settingsType]; } @@ -178,9 +179,12 @@ static ContentExceptionsWindowController* [[self window] setTitle:GetWindowTitle(settingsType_)]; - CGFloat minWidth = [[addButton_ superview] bounds].size.width + - [[doneButton_ superview] bounds].size.width; - [self setMinWidth:minWidth]; + // Make sure the button fits its label, but keep it the same height as the + // other two buttons. + [GTMUILocalizerAndLayoutTweaker sizeToFitView:removeAllButton_]; + NSSize size = [removeAllButton_ frame].size; + size.height = NSHeight([addButton_ frame]); + [removeAllButton_ setFrameSize:size]; [self adjustEditingButtons]; @@ -199,16 +203,12 @@ static ContentExceptionsWindowController* NSCell* patternCell = [[tableView_ tableColumnWithIdentifier:@"pattern"] dataCell]; [patternCell setFormatter:[[[PatternFormatter alloc] init] autorelease]]; -} -- (void)setMinWidth:(CGFloat)minWidth { - NSWindow* window = [self window]; - [window setMinSize:NSMakeSize(minWidth, [window minSize].height)]; - if ([window frame].size.width < minWidth) { - NSRect frame = [window frame]; - frame.size.width = minWidth; - [window setFrame:frame display:NO]; - } + // Give the button bar on the bottom of the window the "iTunes/iChat" look. + [[self window] setAutorecalculatesContentBorderThickness:NO + forEdge:NSMinYEdge]; + [[self window] setContentBorderThickness:kButtonBarHeight + forEdge:NSMinYEdge]; } - (void)windowWillClose:(NSNotification*)notification { @@ -235,7 +235,7 @@ static ContentExceptionsWindowController* [self removeException:self]; } } else { - [self closeSheet:self]; + [self close]; } } @@ -264,21 +264,6 @@ static ContentExceptionsWindowController* [super keyDown:event]; } -- (void)attachSheetTo:(NSWindow*)window { - [NSApp beginSheet:[self window] - modalForWindow:window - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:nil]; -} - -- (void)sheetDidEnd:(NSWindow*)sheet - returnCode:(NSInteger)returnCode - contextInfo:(void*)context { - [sheet close]; - [sheet orderOut:self]; -} - - (IBAction)addException:(id)sender { if (newException_.get()) { // The invariant is that |newException_| is non-NULL exactly if the pattern @@ -325,10 +310,6 @@ static ContentExceptionsWindowController* [self modelDidChange]; } -- (IBAction)closeSheet:(id)sender { - [NSApp endSheet:[self window]]; -} - // Table View Data Source ----------------------------------------------------- - (NSInteger)numberOfRowsInTableView:(NSTableView*)table { diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.h b/chrome/browser/cocoa/content_settings_dialog_controller.h index 187f7f8..5f6127a 100644 --- a/chrome/browser/cocoa/content_settings_dialog_controller.h +++ b/chrome/browser/cocoa/content_settings_dialog_controller.h @@ -35,9 +35,6 @@ class Profile; +(id)showContentSettingsForType:(ContentSettingsType)settingsType profile:(Profile*)profile; -// Closes an exceptions sheet, if one is attached. -- (void)closeExceptionsSheet; - - (IBAction)showCookies:(id)sender; - (IBAction)openFlashPlayerSettings:(id)sender; - (IBAction)openPluginsPage:(id)sender; diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm index fcca282..88034ff 100644 --- a/chrome/browser/cocoa/content_settings_dialog_controller.mm +++ b/chrome/browser/cocoa/content_settings_dialog_controller.mm @@ -135,7 +135,6 @@ class PrefObserverBridge : public NotificationObserver { [g_instance selectTab:settingsType]; [g_instance showWindow:nil]; - [g_instance closeExceptionsSheet]; return g_instance; } @@ -159,13 +158,6 @@ class PrefObserverBridge : public NotificationObserver { return self; } -- (void)closeExceptionsSheet { - NSWindow* attachedSheet = [[self window] attachedSheet]; - if (attachedSheet) { - [NSApp endSheet:attachedSheet]; - } -} - - (void)awakeFromNib { DCHECK([self window]); DCHECK_EQ(self, [[self window] delegate]); @@ -312,15 +304,13 @@ class PrefObserverBridge : public NotificationObserver { - (IBAction)showGeolocationExceptions:(id)sender { GeolocationContentSettingsMap* settingsMap = profile_->GetGeolocationContentSettingsMap(); - [[GeolocationExceptionsWindowController controllerWithSettingsMap:settingsMap] - attachSheetTo:[self window]]; + [GeolocationExceptionsWindowController showWindowWithSettingsMap:settingsMap]; } - (void)showExceptionsForType:(ContentSettingsType)settingsType { HostContentSettingsMap* settingsMap = profile_->GetHostContentSettingsMap(); - [[ContentExceptionsWindowController controllerForType:settingsType - settingsMap:settingsMap] - attachSheetTo:[self window]]; + [ContentExceptionsWindowController showForType:settingsType + settingsMap:settingsMap]; } - (void)setImagesEnabledIndex:(NSInteger)value { diff --git a/chrome/browser/cocoa/geolocation_exceptions_window_controller.h b/chrome/browser/cocoa/geolocation_exceptions_window_controller.h index f93b9af..9de67a1 100644 --- a/chrome/browser/cocoa/geolocation_exceptions_window_controller.h +++ b/chrome/browser/cocoa/geolocation_exceptions_window_controller.h @@ -20,7 +20,6 @@ class GeolocationObserverBridge; IBOutlet NSTableView* tableView_; IBOutlet NSButton* removeButton_; IBOutlet NSButton* removeAllButton_; - IBOutlet NSButton* doneButton_; GeolocationContentSettingsMap* settingsMap_; // weak scoped_ptr model_; @@ -29,13 +28,7 @@ class GeolocationObserverBridge; // Shows or makes frontmost the geolocation exceptions window. // Changes made by the user in the window are persisted in |settingsMap|. -+ (id)controllerWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap; - -// Sets the minimum width of the sheet and resizes it if necessary. -- (void)setMinWidth:(CGFloat)minWidth; - -- (void)attachSheetTo:(NSWindow*)window; -- (IBAction)closeSheet:(id)sender; ++ (id)showWindowWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap; - (IBAction)removeException:(id)sender; - (IBAction)removeAllExceptions:(id)sender; diff --git a/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm b/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm index 7c7bee4..02715bb 100644 --- a/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm +++ b/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm @@ -57,11 +57,12 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; @implementation GeolocationExceptionsWindowController -+ (id)controllerWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap { ++ (id)showWindowWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap { if (!g_exceptionWindow) { g_exceptionWindow = [[GeolocationExceptionsWindowController alloc] initWithSettingsMap:settingsMap]; } + [g_exceptionWindow showWindow:nil]; return g_exceptionWindow; } @@ -88,22 +89,20 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; DCHECK_EQ(self, [tableView_ dataSource]); DCHECK_EQ(self, [tableView_ delegate]); - CGFloat minWidth = [[removeButton_ superview] bounds].size.width + - [[doneButton_ superview] bounds].size.width; - [[self window] setMinSize:NSMakeSize(minWidth, - [[self window] minSize].height)]; + // Make sure the button fits its label, but keep it the same height as the + // other two buttons. + [GTMUILocalizerAndLayoutTweaker sizeToFitView:removeAllButton_]; + NSSize size = [removeAllButton_ frame].size; + size.height = NSHeight([removeButton_ frame]); + [removeAllButton_ setFrameSize:size]; [self adjustEditingButtons]; -} -- (void)setMinWidth:(CGFloat)minWidth { - NSWindow* window = [self window]; - [window setMinSize:NSMakeSize(minWidth, [window minSize].height)]; - if ([window frame].size.width < minWidth) { - NSRect frame = [window frame]; - frame.size.width = minWidth; - [window setFrame:frame display:NO]; - } + // Give the button bar on the bottom of the window the "iTunes/iChat" look. + [[self window] setAutorecalculatesContentBorderThickness:NO + forEdge:NSMinYEdge]; + [[self window] setContentBorderThickness:kButtonBarHeight + forEdge:NSMinYEdge]; } - (void)windowWillClose:(NSNotification*)notification { @@ -116,7 +115,7 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; // Let esc close the window. - (void)cancel:(id)sender { - [self closeSheet:self]; + [self close]; } - (void)keyDown:(NSEvent*)event { @@ -134,25 +133,6 @@ GeolocationExceptionsWindowController* g_exceptionWindow = nil; [super keyDown:event]; } -- (void)attachSheetTo:(NSWindow*)window { - [NSApp beginSheet:[self window] - modalForWindow:window - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:nil]; -} - -- (void)sheetDidEnd:(NSWindow*)sheet - returnCode:(NSInteger)returnCode - contextInfo:(void*)context { - [sheet close]; - [sheet orderOut:self]; -} - -- (IBAction)closeSheet:(id)sender { - [NSApp endSheet:[self window]]; -} - - (IBAction)removeException:(id)sender { GeolocationContentSettingsTableModel::Rows rows; [self selectedRows:&rows]; -- cgit v1.1