| 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];
|
| }
|
|
|