| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/fullscreen_mode_controller.h" | 5 #import "chrome/browser/ui/cocoa/fullscreen_mode_controller.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 7 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 8 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 9 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 9 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 [self startAnimationToState:kFullscreenToolbarOnly]; | 134 [self startAnimationToState:kFullscreenToolbarOnly]; |
| 135 } | 135 } |
| 136 | 136 |
| 137 - (void)startAnimationToState:(FullscreenToolbarState)state { | 137 - (void)startAnimationToState:(FullscreenToolbarState)state { |
| 138 DCHECK_NE(currentState_, state); | 138 DCHECK_NE(currentState_, state); |
| 139 | 139 |
| 140 destinationState_ = state; | 140 destinationState_ = state; |
| 141 | 141 |
| 142 // Turn on fast resize mode to ensure a smooth web contents animation. | |
| 143 // TODO(rsesek): This makes the animation jump at the end. | |
| 144 [[controller_ tabContentArea] setFastResizeMode:YES]; | |
| 145 | |
| 146 animation_.reset([[FullscreenModeDropDownAnimation alloc] | 142 animation_.reset([[FullscreenModeDropDownAnimation alloc] |
| 147 initWithFullscreenModeController:self]); | 143 initWithFullscreenModeController:self]); |
| 148 [animation_ startAnimation]; | 144 [animation_ startAnimation]; |
| 149 } | 145 } |
| 150 | 146 |
| 151 - (void)setMenuBarRevealProgress:(CGFloat)progress { | 147 - (void)setMenuBarRevealProgress:(CGFloat)progress { |
| 152 menuBarRevealFraction_ = progress; | 148 menuBarRevealFraction_ = progress; |
| 153 | 149 |
| 154 // If an animation is not running, then -layoutSubviews will not be called | 150 // If an animation is not running, then -layoutSubviews will not be called |
| 155 // for each tick of the menu bar reveal. Do that manually. | 151 // for each tick of the menu bar reveal. Do that manually. |
| 156 // TODO(rsesek): This is kind of hacky and janky. | 152 // TODO(rsesek): This is kind of hacky and janky. |
| 157 if (!animation_) | 153 if (!animation_) |
| 158 [controller_ layoutSubviews]; | 154 [controller_ layoutSubviews]; |
| 159 } | 155 } |
| 160 | 156 |
| 161 - (void)setRevealAnimationProgress:(NSAnimationProgress)progress { | 157 - (void)setRevealAnimationProgress:(NSAnimationProgress)progress { |
| 162 // When hiding the tabstrip, invert the fraction. | 158 // When hiding the tabstrip, invert the fraction. |
| 163 if (destinationState_ == kFullscreenToolbarOnly) | 159 if (destinationState_ == kFullscreenToolbarOnly) |
| 164 progress = 1.0 - progress; | 160 progress = 1.0 - progress; |
| 165 [controller_ setFloatingBarShownFraction:progress]; | 161 [controller_ setFloatingBarShownFraction:progress]; |
| 166 } | 162 } |
| 167 | 163 |
| 168 - (void)animationDidEnd:(NSAnimation*)animation { | 164 - (void)animationDidEnd:(NSAnimation*)animation { |
| 169 DCHECK_EQ(animation_.get(), animation); | 165 DCHECK_EQ(animation_.get(), animation); |
| 170 | 166 |
| 171 currentState_ = destinationState_; | 167 currentState_ = destinationState_; |
| 172 | 168 |
| 173 [animation_ setDelegate:nil]; | 169 [animation_ setDelegate:nil]; |
| 174 animation_.reset(); | 170 animation_.reset(); |
| 175 | |
| 176 [[controller_ tabContentArea] setFastResizeMode:NO]; | |
| 177 } | 171 } |
| 178 | 172 |
| 179 @end | 173 @end |
| OLD | NEW |