| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/fullscreen_toolbar_animation_control
ler.h" | 5 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_control
ler.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" | 7 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void FullscreenToolbarAnimationController::StopAnimationAndTimer() { | 47 void FullscreenToolbarAnimationController::StopAnimationAndTimer() { |
| 48 animation_.Stop(); | 48 animation_.Stop(); |
| 49 hide_toolbar_timer_.Stop(); | 49 hide_toolbar_timer_.Stop(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void FullscreenToolbarAnimationController::AnimateToolbarForTabstripChanges() { | 52 void FullscreenToolbarAnimationController::AnimateToolbarForTabstripChanges() { |
| 53 // Don't kickstart the animation if the toolbar is already displayed. | 53 // Don't kickstart the animation if the toolbar is already displayed. |
| 54 if ([owner_ mustShowFullscreenToolbar]) | 54 if ([owner_ mustShowFullscreenToolbar]) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 if (animation_.IsShowing()) { |
| 58 hide_toolbar_timer_.Reset(); |
| 59 return; |
| 60 } |
| 61 |
| 62 should_hide_toolbar_after_delay_ = true; |
| 57 AnimateToolbarIn(); | 63 AnimateToolbarIn(); |
| 58 should_hide_toolbar_after_delay_ = true; | |
| 59 } | 64 } |
| 60 | 65 |
| 61 void FullscreenToolbarAnimationController::AnimateToolbarIn() { | 66 void FullscreenToolbarAnimationController::AnimateToolbarIn() { |
| 62 if (![owner_ isInFullscreen]) | 67 if (![owner_ isInFullscreen]) |
| 63 return; | 68 return; |
| 64 | 69 |
| 65 if (animation_.IsShowing()) | |
| 66 return; | |
| 67 | |
| 68 animation_.Reset(animation_start_value_); | 70 animation_.Reset(animation_start_value_); |
| 69 animation_.Show(); | 71 animation_.Show(); |
| 70 } | 72 } |
| 71 | 73 |
| 72 void FullscreenToolbarAnimationController::AnimateToolbarOutIfPossible() { | 74 void FullscreenToolbarAnimationController::AnimateToolbarOutIfPossible() { |
| 73 if (![owner_ isInFullscreen] || [owner_ mustShowFullscreenToolbar]) | 75 if (![owner_ isInFullscreen] || [owner_ mustShowFullscreenToolbar]) |
| 74 return; | 76 return; |
| 75 | 77 |
| 76 if (animation_.IsClosing()) | 78 if (animation_.IsClosing()) |
| 77 return; | 79 return; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 102 [owner_ updateToolbarLayout]; | 104 [owner_ updateToolbarLayout]; |
| 103 } | 105 } |
| 104 | 106 |
| 105 void FullscreenToolbarAnimationController::AnimationEnded( | 107 void FullscreenToolbarAnimationController::AnimationEnded( |
| 106 const gfx::Animation* animation) { | 108 const gfx::Animation* animation) { |
| 107 if (animation_.IsShowing() && should_hide_toolbar_after_delay_) { | 109 if (animation_.IsShowing() && should_hide_toolbar_after_delay_) { |
| 108 hide_toolbar_timer_.Reset(); | 110 hide_toolbar_timer_.Reset(); |
| 109 should_hide_toolbar_after_delay_ = false; | 111 should_hide_toolbar_after_delay_ = false; |
| 110 } | 112 } |
| 111 } | 113 } |
| OLD | NEW |