Chromium Code Reviews| Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| index 0dd797acccc9715a371e6e0108d7bab92ad5500c..4d965109a967be983a643b7b46896d5a030b3c7a 100644 |
| --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| @@ -89,6 +89,7 @@ const CGFloat kWrenchMenuLeftPadding = 3.0; |
| - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; |
| - (void)maintainMinimumLocationBarWidth; |
| - (void)adjustBrowserActionsContainerForNewWindow:(NSNotification*)notification; |
| +- (void)browserActionsContainerWillDrag:(NSNotification*)notification; |
| - (void)browserActionsContainerDragged:(NSNotification*)notification; |
| - (void)browserActionsContainerDragFinished:(NSNotification*)notification; |
| - (void)browserActionsVisibilityChanged:(NSNotification*)notification; |
| @@ -587,6 +588,11 @@ class NotificationBridge : public WrenchMenuBadgeController::Delegate { |
| containerView:browserActionsContainerView_]); |
| [[NSNotificationCenter defaultCenter] |
| addObserver:self |
| + selector:@selector(browserActionsContainerWillDrag:) |
| + name:kBrowseActionContainerWillTranslateOnXNotification |
|
Yoyo Zhou
2014/10/27 23:45:26
typo: kBrowserAction...
Malcolm
2014/10/28 06:56:09
Oops, I lost the 'r'.
On 2014/10/27 23:45:26, Yoyo
|
| + object:browserActionsController_]; |
| + [[NSNotificationCenter defaultCenter] |
| + addObserver:self |
| selector:@selector(browserActionsContainerDragged:) |
| name:kBrowserActionGrippyDraggingNotification |
| object:browserActionsController_]; |
| @@ -635,6 +641,18 @@ class NotificationBridge : public WrenchMenuBadgeController::Delegate { |
| [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:YES]; |
| } |
| +- (void)browserActionsContainerWillDrag:(NSNotification*)notification { |
| + CGFloat deltaX = [[notification.userInfo objectForKey:kTranslationWithDelta] |
| + floatValue]; |
| + CGFloat locationBarWidth = NSWidth([locationBar_ frame]); |
|
Yoyo Zhou
2014/10/27 23:45:26
I'm not very familiar with this code, so please be
Malcolm
2014/10/28 06:56:09
The -maintainMinimumLocationBarWidth only adjusts
|
| + BOOL locationBarWillBeAtMinSize = |
| + (locationBarWidth + deltaX) <= kMinimumLocationBarWidth; |
| + |
| + // Prevent the |browserActionsContainerView_| from dragging if the width of |
| + // location bar will reach the minimum. |
| + [browserActionsContainerView_ setCanDragLeft:!locationBarWillBeAtMinSize]; |
| +} |
| + |
| - (void)browserActionsVisibilityChanged:(NSNotification*)notification { |
| [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; |
| } |