summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_controller.mm
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 22:31:24 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 22:31:24 +0000
commitcf5889eddcb85c35e539835f137c710763f37b08 (patch)
tree763367cab82744afe511222c52657ae1863158d2 /chrome/browser/cocoa/toolbar_controller.mm
parent25af92056d8145d044674e3544010e9500b78ea3 (diff)
downloadchromium_src-cf5889eddcb85c35e539835f137c710763f37b08.zip
chromium_src-cf5889eddcb85c35e539835f137c710763f37b08.tar.gz
chromium_src-cf5889eddcb85c35e539835f137c710763f37b08.tar.bz2
[Mac] Enables drag N' drop for the buttons within the Browser Actions container. Also fixes an issue where the grippy was being shown when no Browser Actions were installed.
Known issue: You can drag the buttons outside of the container, even though they will recover by snapping back into place. This will be fixed in a further revision. TEST=try dragging browser action buttons in order to reorder them. BUG=26990 Review URL: http://codereview.chromium.org/1418003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42845 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.mm')
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm24
1 files changed, 15 insertions, 9 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index dbb949c..68819f1 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -639,9 +639,10 @@ class PrefObserverBridge : public NotificationObserver {
name:NSWindowDidBecomeKeyNotification
object:[[self view] window]];
}
-
- CGFloat dX = NSWidth([browserActionsContainerView_ frame]) * -1;
- [self adjustLocationAndGoPositionsBy:dX animate:NO];
+ CGFloat containerWidth = [browserActionsContainerView_ isHidden] ? 0.0 :
+ NSWidth([browserActionsContainerView_ frame]);
+ if (containerWidth > 0.0)
+ [self adjustLocationAndGoPositionsBy:(containerWidth * -1) animate:NO];
BOOL rightBorderShown = !([pageButton_ isHidden] && [wrenchButton_ isHidden]);
[browserActionsContainerView_ setRightBorderShown:rightBorderShown];
}
@@ -674,13 +675,18 @@ class PrefObserverBridge : public NotificationObserver {
}
- (void)pinGoButtonToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate {
- NSRect goFrame = [goButton_ frame];
- NSRect containerFrame = animate ?
- [browserActionsContainerView_ animationEndFrame] :
- [browserActionsContainerView_ frame];
+ CGFloat goXPos = [goButton_ frame].origin.x + NSWidth([goButton_ frame]);
+ CGFloat leftPadding;
- CGFloat leftPadding = containerFrame.origin.x -
- (goFrame.origin.x + NSWidth(goFrame));
+ if ([browserActionsContainerView_ isHidden]) {
+ leftPadding = NSWidth([[goButton_ window] frame]) - goXPos;
+ } else {
+ NSRect containerFrame = animate ?
+ [browserActionsContainerView_ animationEndFrame] :
+ [browserActionsContainerView_ frame];
+
+ leftPadding = containerFrame.origin.x - goXPos;
+ }
if (leftPadding != kBrowserActionsContainerLeftPadding) {
CGFloat dX = leftPadding - kBrowserActionsContainerLeftPadding;
[self adjustLocationAndGoPositionsBy:dX animate:animate];