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

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: Update CL 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..8d5b0aa052ddb50fd31b4b86f0f00fc8ae277513 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 kBrowserActionContainerWillTranslateOnXNotification =
Yoyo Zhou 2014/10/29 21:17:10 Should this name be more consistent with the other
Robert Sesek 2014/10/29 21:21:33 Yes, I'd recommend that.
Malcolm 2014/10/30 10:08:05 I will change the naming. On 2014/10/29 21:21:33,
+ @"BrowseActionContainerWillTranslateOnXNotification";
+NSString* const kTranslationWithDelta =
+ @"TranslationWithDelta";
namespace {
const CGFloat kAnimationDuration = 0.2;
@@ -118,6 +122,18 @@ 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 =
+ [NSDictionary dictionaryWithObjectsAndKeys:
Robert Sesek 2014/10/29 21:21:34 This can be simplified to @{ kTranslationWithDelta
Malcolm 2014/10/30 10:08:05 Absolutely! On 2014/10/29 21:21:34, Robert Sesek w
+ [NSNumber numberWithFloat:dX], kTranslationWithDelta, nil];
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:kBrowserActionContainerWillTranslateOnXNotification
+ object:self
+ userInfo:userInfo];
+ }
+
if ((dX < 0.0 && !canDragLeft_) || (dX > 0.0 && !canDragRight_))
return;

Powered by Google App Engine
This is Rietveld 408576698