| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ui/views/animation/ink_drop_animation_controller_impl.h" | 5 #include "ui/views/animation/ink_drop_animation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 10 #include "ui/views/animation/ink_drop_host.h" | 10 #include "ui/views/animation/ink_drop_host.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 if (!hover_) | 147 if (!hover_) |
| 148 return; | 148 return; |
| 149 root_layer_->Remove(hover_->layer()); | 149 root_layer_->Remove(hover_->layer()); |
| 150 hover_.reset(); | 150 hover_.reset(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool InkDropAnimationControllerImpl::IsHoverFadingInOrVisible() const { | 153 bool InkDropAnimationControllerImpl::IsHoverFadingInOrVisible() const { |
| 154 return hover_ && hover_->IsFadingInOrVisible(); | 154 return hover_ && hover_->IsFadingInOrVisible(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void InkDropAnimationControllerImpl::InkDropAnimationStarted( | 157 void InkDropAnimationControllerImpl::AnimationStarted( |
| 158 InkDropState ink_drop_state) { | 158 InkDropState ink_drop_state) {} |
| 159 } | |
| 160 | 159 |
| 161 void InkDropAnimationControllerImpl::InkDropAnimationEnded( | 160 void InkDropAnimationControllerImpl::AnimationEnded( |
| 162 InkDropState ink_drop_state, | 161 InkDropState ink_drop_state, |
| 163 InkDropAnimationEndedReason reason) { | 162 InkDropAnimationEndedReason reason) { |
| 164 if (reason != SUCCESS) | 163 if (reason != InkDropAnimationEndedReason::SUCCESS) |
| 165 return; | 164 return; |
| 166 if (ShouldAnimateToHidden(ink_drop_state)) { | 165 if (ShouldAnimateToHidden(ink_drop_state)) { |
| 167 ink_drop_animation_->AnimateToState(views::InkDropState::HIDDEN); | 166 ink_drop_animation_->AnimateToState(views::InkDropState::HIDDEN); |
| 168 } else if (ink_drop_state == views::InkDropState::HIDDEN) { | 167 } else if (ink_drop_state == views::InkDropState::HIDDEN) { |
| 169 if (is_hovered_) | 168 if (is_hovered_) |
| 170 StartHoverAfterAnimationTimer(); | 169 StartHoverAfterAnimationTimer(); |
| 171 // TODO(bruthig): Investigate whether creating and destroying | 170 // TODO(bruthig): Investigate whether creating and destroying |
| 172 // InkDropAnimations is expensive and consider creating an | 171 // InkDropAnimations is expensive and consider creating an |
| 173 // InkDropAnimationPool. See www.crbug.com/522175. | 172 // InkDropAnimationPool. See www.crbug.com/522175. |
| 174 DestroyInkDropAnimation(); | 173 DestroyInkDropAnimation(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 211 } |
| 213 | 212 |
| 214 void InkDropAnimationControllerImpl::HoverAfterAnimationTimerFired() { | 213 void InkDropAnimationControllerImpl::HoverAfterAnimationTimerFired() { |
| 215 SetHoveredInternal(true, base::TimeDelta::FromMilliseconds( | 214 SetHoveredInternal(true, base::TimeDelta::FromMilliseconds( |
| 216 kHoverFadeInAfterAnimationDurationInMs), | 215 kHoverFadeInAfterAnimationDurationInMs), |
| 217 true); | 216 true); |
| 218 hover_after_animation_timer_.reset(); | 217 hover_after_animation_timer_.reset(); |
| 219 } | 218 } |
| 220 | 219 |
| 221 } // namespace views | 220 } // namespace views |
| OLD | NEW |