 Chromium Code Reviews
 Chromium Code Reviews Issue 1286693004:
  Extracted InkDropAnimator class from InkDropAnimationController.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1286693004:
  Extracted InkDropAnimator class from InkDropAnimationController.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: ui/views/animation/ink_drop_animation.cc | 
| diff --git a/ui/views/animation/ink_drop_animation_controller_impl.cc b/ui/views/animation/ink_drop_animation.cc | 
| similarity index 88% | 
| copy from ui/views/animation/ink_drop_animation_controller_impl.cc | 
| copy to ui/views/animation/ink_drop_animation.cc | 
| index 2d5a25736471cc61d745e587eeee88476e40c870..6d4b3777b1b43d8cc64ad75eed9ebc6e50837c90 100644 | 
| --- a/ui/views/animation/ink_drop_animation_controller_impl.cc | 
| +++ b/ui/views/animation/ink_drop_animation.cc | 
| @@ -2,7 +2,7 @@ | 
| // Use of this source code is governed by a BSD-style license that can be | 
| // found in the LICENSE file. | 
| -#include "ui/views/animation/ink_drop_animation_controller_impl.h" | 
| +#include "ui/views/animation/ink_drop_animation.h" | 
| #include "base/command_line.h" | 
| #include "ui/base/ui_base_switches.h" | 
| @@ -11,11 +11,9 @@ | 
| #include "ui/compositor/layer_animation_sequence.h" | 
| #include "ui/compositor/paint_recorder.h" | 
| #include "ui/compositor/scoped_layer_animation_settings.h" | 
| -#include "ui/events/event.h" | 
| #include "ui/gfx/canvas.h" | 
| #include "ui/gfx/geometry/size.h" | 
| #include "ui/views/animation/ink_drop_delegate.h" | 
| -#include "ui/views/animation/ink_drop_host.h" | 
| #include "ui/views/view.h" | 
| namespace { | 
| @@ -184,10 +182,8 @@ bool AppearAnimationObserver::RequiresNotificationWhenAnimatorDestroyed() | 
| return true; | 
| } | 
| -InkDropAnimationControllerImpl::InkDropAnimationControllerImpl( | 
| - InkDropHost* ink_drop_host) | 
| - : ink_drop_host_(ink_drop_host), | 
| - root_layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), | 
| +InkDropAnimation::InkDropAnimation() | 
| + : root_layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), | 
| ink_drop_layer_(new ui::Layer()), | 
| appear_animation_observer_(nullptr), | 
| long_press_layer_(new ui::Layer()), | 
| @@ -205,19 +201,15 @@ InkDropAnimationControllerImpl::InkDropAnimationControllerImpl( | 
| root_layer_->Add(ink_drop_layer_.get()); | 
| root_layer_->Add(long_press_layer_.get()); | 
| - | 
| - // TODO(bruthig): Change this to only be called before the ink drop becomes | 
| - // active. See www.crbug.com/522175. | 
| - ink_drop_host_->AddInkDropLayer(root_layer_.get()); | 
| } | 
| -InkDropAnimationControllerImpl::~InkDropAnimationControllerImpl() { | 
| - // TODO(bruthig): Change this to be called when the ink drop becomes hidden. | 
| - // See www.crbug.com/522175. | 
| - ink_drop_host_->RemoveInkDropLayer(root_layer_.get()); | 
| +InkDropAnimation::~InkDropAnimation() {} | 
| + | 
| +ui::Layer* InkDropAnimation::GetRootLayer() { | 
| 
jonross
2015/08/19 21:41:01
This is just a simple accessor.
Change to:
ui::L
 
bruthig
2015/08/20 12:16:21
Done.
 | 
| + return root_layer_.get(); | 
| } | 
| -void InkDropAnimationControllerImpl::AnimateToState(InkDropState state) { | 
| +void InkDropAnimation::AnimateToState(InkDropState state) { | 
| // TODO(bruthig): Do not transition if we are already in |state| and restrict | 
| // any state transition that don't make sense or wouldn't look visually | 
| // appealing. | 
| @@ -241,21 +233,21 @@ void InkDropAnimationControllerImpl::AnimateToState(InkDropState state) { | 
| } | 
| } | 
| -void InkDropAnimationControllerImpl::SetInkDropSize(const gfx::Size& size) { | 
| +void InkDropAnimation::SetInkDropSize(const gfx::Size& size) { | 
| SetInkDropBounds(gfx::Rect(ink_drop_bounds_.origin(), size)); | 
| } | 
| -gfx::Rect InkDropAnimationControllerImpl::GetInkDropBounds() const { | 
| +gfx::Rect InkDropAnimation::GetInkDropBounds() const { | 
| return ink_drop_bounds_; | 
| } | 
| -void InkDropAnimationControllerImpl::SetInkDropBounds(const gfx::Rect& bounds) { | 
| +void InkDropAnimation::SetInkDropBounds(const gfx::Rect& bounds) { | 
| ink_drop_bounds_ = bounds; | 
| SetLayerBounds(ink_drop_layer_.get()); | 
| SetLayerBounds(long_press_layer_.get()); | 
| } | 
| -void InkDropAnimationControllerImpl::AnimateTapDown() { | 
| +void InkDropAnimation::AnimateTapDown() { | 
| if ((appear_animation_observer_ && | 
| appear_animation_observer_->IsAnimationActive()) || | 
| (long_press_animation_observer_ && | 
| @@ -272,7 +264,7 @@ void InkDropAnimationControllerImpl::AnimateTapDown() { | 
| : kShowInkDropAnimationDurationSlowMs))); | 
| } | 
| -void InkDropAnimationControllerImpl::AnimateHide() { | 
| +void InkDropAnimation::AnimateHide() { | 
| if (appear_animation_observer_ && | 
| appear_animation_observer_->IsAnimationActive()) { | 
| appear_animation_observer_->HideNowIfDoneOrOnceCompleted(); | 
| @@ -281,7 +273,7 @@ void InkDropAnimationControllerImpl::AnimateHide() { | 
| } | 
| } | 
| -void InkDropAnimationControllerImpl::AnimateLongPress() { | 
| +void InkDropAnimation::AnimateLongPress() { | 
| // Only one animation at a time. Subsequent long presses are ignored until the | 
| // current animation completes. | 
| if (long_press_animation_observer_ && | 
| @@ -298,10 +290,9 @@ void InkDropAnimationControllerImpl::AnimateLongPress() { | 
| : kShowLongPressAnimationDurationSlowMs)); | 
| } | 
| -void InkDropAnimationControllerImpl::AnimateShow( | 
| - ui::Layer* layer, | 
| - AppearAnimationObserver* observer, | 
| - base::TimeDelta duration) { | 
| +void InkDropAnimation::AnimateShow(ui::Layer* layer, | 
| + AppearAnimationObserver* observer, | 
| + base::TimeDelta duration) { | 
| layer->SetVisible(true); | 
| layer->SetOpacity(1.0f); | 
| @@ -331,7 +322,7 @@ void InkDropAnimationControllerImpl::AnimateShow( | 
| animator->StartAnimation(sequence); | 
| } | 
| -void InkDropAnimationControllerImpl::SetLayerBounds(ui::Layer* layer) { | 
| +void InkDropAnimation::SetLayerBounds(ui::Layer* layer) { | 
| bool circle = UseCircularFeedback(); | 
| gfx::Size size = ink_drop_bounds_.size(); | 
| float circle_width = circle ? 2.0f * kCircleRadius : size.width(); | 
| @@ -341,9 +332,8 @@ void InkDropAnimationControllerImpl::SetLayerBounds(ui::Layer* layer) { | 
| layer->SetBounds(gfx::Rect(circle_x, circle_y, circle_width, circle_height)); | 
| } | 
| -void InkDropAnimationControllerImpl::SetupAnimationLayer( | 
| - ui::Layer* layer, | 
| - InkDropDelegate* delegate) { | 
| +void InkDropAnimation::SetupAnimationLayer(ui::Layer* layer, | 
| + InkDropDelegate* delegate) { | 
| layer->SetFillsBoundsOpaquely(false); | 
| layer->set_delegate(delegate); | 
| layer->SetVisible(false); |