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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_actions_container_view.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: Make naming consistent. 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
Index: chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm
index 2a0a0d3609e643e1e41b7315b2910954f1224c5f..514ce3354aabcd4c742ffb1465334dcb69a6b409 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm
@@ -15,6 +15,10 @@ NSString* const kBrowserActionGrippyDraggingNotification =
@"BrowserActionGrippyDraggingNotification";
NSString* const kBrowserActionGrippyDragFinishedNotification =
@"BrowserActionGrippyDragFinishedNotification";
+NSString* const kBrowserActionGrippyWillDragNotification =
+ @"BrowserActionGrippyWillDragNotification";
+NSString* const kTranslationWithDelta =
+ @"TranslationWithDelta";
namespace {
const CGFloat kAnimationDuration = 0.2;
@@ -118,6 +122,16 @@ const CGFloat kMinimumContainerWidth = 10.0;
(NSWidth(containerFrame) > kMinimumContainerWidth);
canDragLeft_ = (withDelta <= initialDragPoint_.x) &&
(NSWidth(containerFrame) < maxWidth_);
+
+ // Notify others to see whether this dragging is allowed.
+ if (canDragLeft_ || canDragRight_) {
+ NSDictionary* userInfo = @{ kTranslationWithDelta : @(dX) };
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:kBrowserActionGrippyWillDragNotification
+ object:self
+ userInfo:userInfo];
+ }
+
if ((dX < 0.0 && !canDragLeft_) || (dX > 0.0 && !canDragRight_))
return;

Powered by Google App Engine
This is Rietveld 408576698