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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm

Issue 1105713002: [Extension Toolbar] Slide out overflowed actions for popups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 d718eec153dc75ff690b75632600604f5e46e7bf..4bde52dca66c516adceabffd396c8bfc2d6407e9 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_actions_container_view.mm
@@ -21,6 +21,8 @@ NSString* const kBrowserActionsContainerWillAnimate =
@"BrowserActionsContainerWillAnimate";
NSString* const kBrowserActionsContainerMouseEntered =
@"BrowserActionsContainerMouseEntered";
+NSString* const kBrowserActionsContainerAnimationEnded =
+ @"BrowserActionsContainerAnimationEnded";
NSString* const kTranslationWithDelta =
@"TranslationWithDelta";
@@ -30,6 +32,49 @@ const CGFloat kGrippyWidth = 3.0;
const CGFloat kMinimumContainerWidth = 3.0;
} // namespace
+@interface ContainerAnimationHelper : NSObject<NSAnimationDelegate> {
+ BrowserActionsContainerView* container_;
+}
+
+- (id)initWithContainer:(BrowserActionsContainerView*)container;
+
+- (void)animationDidEnd:(NSAnimation*)animation;
+- (void)animationDidStop:(NSAnimation*)animation;
+
+- (void)notifyAnimationEnded;
+
+@end
+
+@implementation ContainerAnimationHelper
+
+- (id)initWithContainer:(BrowserActionsContainerView*)container {
+ if ((self = [super init])) {
+ container_ = container;
+ }
+ return self;
+}
+
+- (void)animationDidEnd:(NSAnimation*)animation {
+ [self performSelector:@selector(notifyAnimationEnded)
+ withObject:self
+ afterDelay:0];
+}
+
+- (void)animationDidStop:(NSAnimation*)animation {
+ [self performSelector:@selector(notifyAnimationEnded)
+ withObject:self
+ afterDelay:0];
+}
+
+- (void)notifyAnimationEnded {
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:kBrowserActionsContainerAnimationEnded
+ object:container_];
+}
+
+@end
+
+
@interface BrowserActionsContainerView(Private)
// Returns the cursor that should be shown when hovering over the grippy based
// on |canDragLeft_| and |canDragRight_|.
@@ -58,9 +103,12 @@ const CGFloat kMinimumContainerWidth = 3.0;
canDragRight_ = YES;
resizable_ = YES;
+ animationHelper_.reset(
+ [[ContainerAnimationHelper alloc] initWithContainer:self]);
resizeAnimation_.reset([[NSViewAnimation alloc] init]);
[resizeAnimation_ setDuration:kAnimationDuration];
[resizeAnimation_ setAnimationBlockingMode:NSAnimationNonblocking];
+ [resizeAnimation_ setDelegate:animationHelper_.get()];
[self setHidden:YES];
}

Powered by Google App Engine
This is Rietveld 408576698