| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (!hover_) | 145 if (!hover_) |
| 146 return; | 146 return; |
| 147 root_layer_->Remove(hover_->layer()); | 147 root_layer_->Remove(hover_->layer()); |
| 148 hover_.reset(); | 148 hover_.reset(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool InkDropAnimationControllerImpl::IsHoverFadingInOrVisible() const { | 151 bool InkDropAnimationControllerImpl::IsHoverFadingInOrVisible() const { |
| 152 return hover_ && hover_->IsFadingInOrVisible(); | 152 return hover_ && hover_->IsFadingInOrVisible(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void InkDropAnimationControllerImpl::InkDropAnimationStarted( | 155 void InkDropAnimationControllerImpl::AnimationStarted( |
| 156 InkDropState ink_drop_state) { | 156 InkDropState ink_drop_state) {} |
| 157 } | |
| 158 | 157 |
| 159 void InkDropAnimationControllerImpl::InkDropAnimationEnded( | 158 void InkDropAnimationControllerImpl::AnimationEnded( |
| 160 InkDropState ink_drop_state, | 159 InkDropState ink_drop_state, |
| 161 InkDropAnimationEndedReason reason) { | 160 InkDropAnimationEndedReason reason) { |
| 162 if (reason != SUCCESS) | 161 if (reason != InkDropAnimationEndedReason::SUCCESS) |
| 163 return; | 162 return; |
| 164 if (ShouldAnimateToHidden(ink_drop_state)) { | 163 if (ShouldAnimateToHidden(ink_drop_state)) { |
| 165 ink_drop_animation_->AnimateToState(views::InkDropState::HIDDEN); | 164 ink_drop_animation_->AnimateToState(views::InkDropState::HIDDEN); |
| 166 } else if (ink_drop_state == views::InkDropState::HIDDEN) { | 165 } else if (ink_drop_state == views::InkDropState::HIDDEN) { |
| 167 if (is_hovered_) | 166 if (is_hovered_) |
| 168 StartHoverAfterAnimationTimer(); | 167 StartHoverAfterAnimationTimer(); |
| 169 // TODO(bruthig): Investigate whether creating and destroying | 168 // TODO(bruthig): Investigate whether creating and destroying |
| 170 // InkDropAnimations is expensive and consider creating an | 169 // InkDropAnimations is expensive and consider creating an |
| 171 // InkDropAnimationPool. See www.crbug.com/522175. | 170 // InkDropAnimationPool. See www.crbug.com/522175. |
| 172 DestroyInkDropAnimation(); | 171 DestroyInkDropAnimation(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 hover_after_animation_timer_.reset(); | 207 hover_after_animation_timer_.reset(); |
| 209 } | 208 } |
| 210 | 209 |
| 211 void InkDropAnimationControllerImpl::HoverAfterAnimationTimerFired() { | 210 void InkDropAnimationControllerImpl::HoverAfterAnimationTimerFired() { |
| 212 SetHoveredInternal(true, base::TimeDelta::FromMilliseconds( | 211 SetHoveredInternal(true, base::TimeDelta::FromMilliseconds( |
| 213 kHoverFadeInAfterAnimationDurationInMs)); | 212 kHoverFadeInAfterAnimationDurationInMs)); |
| 214 hover_after_animation_timer_.reset(); | 213 hover_after_animation_timer_.reset(); |
| 215 } | 214 } |
| 216 | 215 |
| 217 } // namespace views | 216 } // namespace views |
| OLD | NEW |