Index: ui/views/animation/ink_drop_animation_controller_impl.h |
diff --git a/ui/views/animation/ink_drop_animation_controller_impl.h b/ui/views/animation/ink_drop_animation_controller_impl.h |
index 5ca25633ba16cb6687e34b07ac96af79fdb7ad75..fdd713e6b1ff89ae180c3ea593f3e0273df50ce2 100644 |
--- a/ui/views/animation/ink_drop_animation_controller_impl.h |
+++ b/ui/views/animation/ink_drop_animation_controller_impl.h |
@@ -12,9 +12,16 @@ |
#include "ui/views/animation/ink_drop_animation_observer.h" |
#include "ui/views/views_export.h" |
+namespace base { |
+class Timer; |
+} // namespace base |
+ |
namespace views { |
class InkDropAnimation; |
+class InkDropConsumer; |
class InkDropHost; |
+class InkDropHover; |
+class MDInkDropAnimationControllerFactoryTest; |
// A functional implementation of an InkDropAnimationController. |
class VIEWS_EXPORT InkDropAnimationControllerImpl |
@@ -23,12 +30,15 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl |
public: |
// Constructs an ink drop controller that will attach the ink drop to the |
// given |ink_drop_host|. |
- explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); |
+ InkDropAnimationControllerImpl(InkDropHost* ink_drop_host, |
+ InkDropConsumer* ink_drop_consumer); |
~InkDropAnimationControllerImpl() override; |
// InkDropAnimationController: |
InkDropState GetInkDropState() const override; |
void AnimateToState(InkDropState ink_drop_state) override; |
+ void SetHovered(bool is_hovered) override; |
+ bool IsHovered() const override; |
gfx::Size GetInkDropLargeSize() const override; |
void SetInkDropSize(const gfx::Size& large_size, |
int large_corner_radius, |
@@ -37,6 +47,12 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl |
void SetInkDropCenter(const gfx::Point& center_point) override; |
private: |
+ friend class MDInkDropAnimationControllerFactoryTest; |
+ |
+ // Replace the |hover_after_animation_timer_| with |timer|. To be used by |
+ // tests only. |
+ void SetTimerForTest(base::Timer* timer); |
+ |
// Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If |
// |ink_drop_animation_| wasn't null then it will be destroyed using |
// DestroyInkDropAnimation(). |
@@ -45,14 +61,40 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl |
// Destroys the current |ink_drop_animation_|. |
void DestroyInkDropAnimation(); |
+ // Creates a new InkDropHover and sets it to |hover_|. If |hover_| wasn't null |
+ // then it will be destroyed using DestroyInkDropHover(). |
+ void CreateInkDropHover(); |
+ |
+ // Destroys the current |hover_|. |
+ void DestroyInkDropHover(); |
+ |
// views::InkDropAnimationObserver: |
void InkDropAnimationStarted(InkDropState ink_drop_state) override; |
void InkDropAnimationEnded(InkDropState ink_drop_state, |
InkDropAnimationEndedReason reason) override; |
+ // Enables or disables the hover state based on |is_hovered| and if an |
+ // animation is triggered it will be scheduled to have the given |
+ // |animation_duration|. |
+ void SetHoveredInternal(bool is_hovered, base::TimeDelta animation_duration); |
+ |
+ // Starts the |hover_after_animation_timer_| timer. This will stop the current |
+ // |hover_after_animation_timer_| instance if it exists. |
+ void StartHoverAfterAnimationTimer(); |
+ |
+ // Stops and destroys the current |hover_after_animation_timer_| instance. |
+ void StopHoverAfterAnimationTimer(); |
+ |
+ // Callback for when the |hover_after_animation_timer_| fires. |
+ void HoverAfterAnimationTimerFired(); |
+ |
// The host of the ink drop. |
InkDropHost* ink_drop_host_; |
+ // The consuming surface of the ink drop. Used to poll for information such as |
+ // whether the hover should be shown or not. |
+ InkDropConsumer* ink_drop_consumer_; |
+ |
// Cached size for the ink drop's large size animations. |
gfx::Size ink_drop_large_size_; |
@@ -68,10 +110,21 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl |
// Cached center point for the ink drop. |
gfx::Point ink_drop_center_; |
+ // The root Layer that parents the InkDropAnimation layers and the |
+ // InkDropHover layers. The |root_layer_| is the one that is added and removed |
+ // from the InkDropHost. |
+ scoped_ptr<ui::Layer> root_layer_; |
+ |
+ // The current InkDropHover. Lazily created using CreateInkDropHover(); |
+ scoped_ptr<InkDropHover> hover_; |
+ |
// The current InkDropAnimation. Created on demand using |
// CreateInkDropAnimation(). |
scoped_ptr<InkDropAnimation> ink_drop_animation_; |
+ // The timer used to delay the hover fade in after an ink drop animation. |
+ scoped_ptr<base::Timer> hover_after_animation_timer_; |
+ |
DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); |
}; |