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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 636283004: To ensure that the location bar will not reach the minimum width. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/ui/cocoa/extensions/browser_actions_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
}
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698