Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Unified Diff: ui/views/animation/ink_drop_animation_controller_impl.cc

Issue 1724963002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky review Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/animation/ink_drop_animation_controller_impl.cc
diff --git a/ui/views/animation/ink_drop_animation_controller_impl.cc b/ui/views/animation/ink_drop_animation_controller_impl.cc
index 23bf9f254ef7917b43d6910461d1dedb86c6e034..7ca5a0d8d43cc4723a8e8181bfe1e4265c9babdb 100644
--- a/ui/views/animation/ink_drop_animation_controller_impl.cc
+++ b/ui/views/animation/ink_drop_animation_controller_impl.cc
@@ -54,7 +54,6 @@ InkDropAnimationControllerImpl::InkDropAnimationControllerImpl(
InkDropHost* ink_drop_host)
: ink_drop_host_(ink_drop_host),
root_layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)),
- can_destroy_after_hidden_animation_(true),
hover_after_animation_timer_(nullptr) {
root_layer_->set_name("InkDropAnimationControllerImpl:RootLayer");
ink_drop_host_->AddInkDropLayer(root_layer_.get());
@@ -82,13 +81,6 @@ void InkDropAnimationControllerImpl::AnimateToState(
if (!ink_drop_animation_)
CreateInkDropAnimation();
- // The InkDropAnimationObserver::InkDropAnimationEnded() callback needs to
- // know if it is safe to destroy the |ink_drop_animation_| and it is not safe
- // when the notification is raised within a call to
- // InkDropAnimation::AnimateToState().
- base::AutoReset<bool> auto_reset_can_destroy_after_hidden_animation(
- &can_destroy_after_hidden_animation_, false);
-
if (ink_drop_state != views::InkDropState::HIDDEN) {
SetHoveredInternal(false, base::TimeDelta::FromMilliseconds(
kHoverFadeOutBeforeAnimationDurationInMs));
@@ -114,7 +106,7 @@ void InkDropAnimationControllerImpl::SetHovered(bool is_hovered) {
void InkDropAnimationControllerImpl::CreateInkDropAnimation() {
DestroyInkDropAnimation();
ink_drop_animation_ = ink_drop_host_->CreateInkDropAnimation();
- ink_drop_animation_->AddObserver(this);
+ ink_drop_animation_->set_observer(this);
root_layer_->Add(ink_drop_animation_->GetRootLayer());
}
@@ -122,7 +114,6 @@ void InkDropAnimationControllerImpl::DestroyInkDropAnimation() {
if (!ink_drop_animation_)
return;
root_layer_->Remove(ink_drop_animation_->GetRootLayer());
- ink_drop_animation_->RemoveObserver(this);
ink_drop_animation_.reset();
}
@@ -159,12 +150,10 @@ void InkDropAnimationControllerImpl::InkDropAnimationEnded(
ink_drop_animation_->AnimateToState(views::InkDropState::HIDDEN);
} else if (ink_drop_state == views::InkDropState::HIDDEN) {
StartHoverAfterAnimationTimer();
- if (can_destroy_after_hidden_animation_) {
- // TODO(bruthig): Investigate whether creating and destroying
- // InkDropAnimations is expensive and consider creating an
- // InkDropAnimationPool. See www.crbug.com/522175.
- DestroyInkDropAnimation();
- }
+ // TODO(bruthig): Investigate whether creating and destroying
+ // InkDropAnimations is expensive and consider creating an
+ // InkDropAnimationPool. See www.crbug.com/522175.
+ DestroyInkDropAnimation();
}
}
« no previous file with comments | « ui/views/animation/ink_drop_animation_controller_impl.h ('k') | ui/views/animation/ink_drop_animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698