Chromium Code Reviews| 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 bee28087eb69274f25b34dbd33ce242df1b79605..a1c903b8c8b774007407895c728c914b7d8333eb 100644 |
| --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
| @@ -70,6 +70,9 @@ using content::WebContents; |
| namespace { |
| +// Duration of the toolbar animation. |
| +const NSTimeInterval kToolBarAnimationDuration = 0.12; |
| + |
| // Height of the toolbar in pixels when the bookmark bar is closed. |
| const CGFloat kBaseToolbarHeightNormal = 35.0; |
| @@ -129,6 +132,7 @@ CGFloat BrowserActionsContainerDelegate::GetMaxAllowedWidth() { |
| - (void)initCommandStatus:(CommandUpdater*)commands; |
| - (void)prefChanged:(const std::string&)prefName; |
| - (BackgroundGradientView*)backgroundGradientView; |
| +- (AnimatableView*)animatableView; |
| - (void)toolbarFrameChanged; |
| - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; |
| - (void)maintainMinimumLocationBarWidth; |
| @@ -597,13 +601,20 @@ class NotificationBridge : public WrenchMenuBadgeController::Delegate { |
| return locationBar_; |
| } |
| -// (Private) Returns the backdrop to the toolbar. |
| +// (Private) Returns the backdrop to the toolbar as a BackgroundGradientView. |
| - (BackgroundGradientView*)backgroundGradientView { |
| // We really do mean |[super view]|; see our override of |-view|. |
| DCHECK([[super view] isKindOfClass:[BackgroundGradientView class]]); |
| return (BackgroundGradientView*)[super view]; |
| } |
| +// (Private) Returns the backdrop to the toolbar as an AnimatableView. |
| +- (AnimatableView*)animatableView{ |
| + // We really do mean |[super view]|; see our override of |-view|. |
| + DCHECK([[super view] isKindOfClass:[AnimatableView class]]); |
| + return (AnimatableView*)[super view]; |
|
tapted
2015/10/12 23:56:43
use base::mac::ObjCCastStrict<AnimatableView>([sup
dominickn
2015/10/15 06:22:28
Done.
|
| +} |
| + |
| - (id)customFieldEditorForObject:(id)obj { |
| if (obj == locationBar_) { |
| // Lazilly construct Field editor, Cocoa UI code always runs on the |
| @@ -726,6 +737,21 @@ class NotificationBridge : public WrenchMenuBadgeController::Delegate { |
| [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; |
| } |
| +- (void)updateVisibility:(BOOL)visible withAnimation:(BOOL)animate { |
| + // This method is only called in a hosted app, when the bookmark bar is never |
| + // visible. Hence, the height will always be kBaseToolbarHeightNormal. |
| + [self setHasToolbar:hasToolbar_ hasLocationBar:visible]; |
| + |
| + AnimatableView* view = [self animatableView]; |
| + CGFloat newHeight = (visible ? kBaseToolbarHeightNormal : 0); |
|
tapted
2015/10/12 23:56:43
parens (..) not required
dominickn
2015/10/15 06:22:28
Done.
|
| + if (animate) { |
| + [view animateToNewHeight:newHeight |
| + duration:kToolBarAnimationDuration]; |
| + } else { |
| + [view setHeight:newHeight]; |
|
tapted
2015/10/12 23:56:43
Shouldn't setting the height to zero be sufficient
dominickn
2015/10/15 06:22:28
That was previously necessary because of the lack
|
| + } |
| +} |
| + |
| - (void)adjustBrowserActionsContainerForNewWindow: |
| (NSNotification*)notification { |
| [self toolbarFrameChanged]; |