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

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

Issue 1951593002: Add MD Ink Drop to host only when a ripple/hover is active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Replaced unique_ptr with scoped_ptr. Created 4 years, 8 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.h
diff --git a/ui/views/animation/ink_drop_animation_controller_impl.h b/ui/views/animation/ink_drop_animation_controller_impl.h
index 5769c3bdcf0f6400f3384c99de1b9db0f217a228..f39e4b9dd8a56bb793dfa9e14f937e30daa1320d 100644
--- a/ui/views/animation/ink_drop_animation_controller_impl.h
+++ b/ui/views/animation/ink_drop_animation_controller_impl.h
@@ -11,6 +11,7 @@
#include "ui/gfx/geometry/size.h"
#include "ui/views/animation/ink_drop_animation_controller.h"
#include "ui/views/animation/ink_drop_animation_observer.h"
+#include "ui/views/animation/ink_drop_hover_observer.h"
#include "ui/views/views_export.h"
namespace base {
@@ -30,7 +31,8 @@ class InkDropAnimationControllerFactoryTest;
// A functional implementation of an InkDropAnimationController.
class VIEWS_EXPORT InkDropAnimationControllerImpl
: public InkDropAnimationController,
- public InkDropAnimationObserver {
+ public InkDropAnimationObserver,
+ public InkDropHoverObserver {
public:
// Constructs an ink drop controller that will attach the ink drop to the
// given |ink_drop_host|.
@@ -65,6 +67,14 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl
// Destroys the current |hover_|.
void DestroyInkDropHover();
+ // Adds the |root_layer_| to the |ink_drop_host_| if it hasn't already been
+ // added.
+ void AddRootLayerToHostIfNeeded();
+
+ // Removes the |root_layer_| from the |ink_drop_host_| if no ink drop ripple
+ // or hover is active.
+ void RemoveRootLayerFromHostIfNeeded();
+
// Returns true if the hover animation is in the process of fading in or
// is visible.
bool IsHoverFadingInOrVisible() const;
@@ -74,6 +84,11 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl
void AnimationEnded(InkDropState ink_drop_state,
InkDropAnimationEndedReason reason) override;
+ // views::InkDropHoverObserver:
+ void AnimationStarted(InkDropHover::AnimationType animation_type) override;
+ void AnimationEnded(InkDropHover::AnimationType animation_type,
+ 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|. If |explode| is true the hover will expand as it
@@ -101,6 +116,9 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl
// from the InkDropHost.
scoped_ptr<ui::Layer> root_layer_;
+ // True when the |root_layer_| has been added to the |ink_drop_host_|.
+ bool root_layer_added_to_host_;
+
// The current InkDropHover. Lazily created using CreateInkDropHover();
scoped_ptr<InkDropHover> hover_;

Powered by Google App Engine
This is Rietveld 408576698