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

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

Issue 1280953003: Enhance the material design ripple API so the ripple's state can be controlled by it's owning View. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed minor typo. Created 5 years, 4 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.h b/ui/views/animation/ink_drop_animation_controller_impl.h
similarity index 54%
copy from ui/views/animation/ink_drop_animation_controller.h
copy to ui/views/animation/ink_drop_animation_controller_impl.h
index 8fb9162f81205ae52e0e56281cbf92d76b454503..c41f261217c67ea0996ded861386ed3589fe1d95 100644
--- a/ui/views/animation/ink_drop_animation_controller.h
+++ b/ui/views/animation/ink_drop_animation_controller_impl.h
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_H_
-#define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_H_
+#ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
+#define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "ui/events/event_handler.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/views/animation/ink_drop_animation_controller.h"
#include "ui/views/views_export.h"
namespace ui {
@@ -17,18 +20,23 @@ class Layer;
namespace views {
class AppearAnimationObserver;
class InkDropDelegate;
+class InkDropHost;
class View;
-// Controls an animation which can be associated to a ui::Layer backed View.
-// It sets itself as the pre-target handler for the supplied view, providing
-// animations for user interactions. The events will not be consumed.
-//
-// The supplied views::View will be forced to have a layer, and this controller
-// will add child layers to that.
-class VIEWS_EXPORT InkDropAnimationController : public ui::EventHandler {
+// Controls an ink drop animation which is hosted by an InkDropHost.
+class VIEWS_EXPORT InkDropAnimationControllerImpl
+ : public InkDropAnimationController {
public:
- explicit InkDropAnimationController(View* view);
- ~InkDropAnimationController() override;
+ // Constructs an ink drop controller that will attach the ink drop to the
+ // given |ink_drop_host|.
+ explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host);
+ ~InkDropAnimationControllerImpl() override;
+
+ // InkDropAnimationController:
+ void AnimateToState(InkDropState state) override;
+ void SetInkDropSize(const gfx::Size& size) override;
+ gfx::Rect GetInkDropBounds() const override;
+ void SetInkDropBounds(const gfx::Rect& bounds) override;
private:
// Starts the animation of a touch event.
@@ -46,22 +54,20 @@ class VIEWS_EXPORT InkDropAnimationController : public ui::EventHandler {
// Starts the showing animation on |layer|, with a |duration| in milliseconds.
void AnimateShow(ui::Layer* layer,
AppearAnimationObserver* observer,
- bool circle,
base::TimeDelta duration);
// Sets the bounds for |layer|.
- void SetLayerBounds(ui::Layer* layer, bool circle, int width, int height);
+ void SetLayerBounds(ui::Layer* layer);
+
+ // Initializes |layer|'s properties.
+ void SetupAnimationLayer(ui::Layer* layer, InkDropDelegate* delegate);
- // Initializes |layer| and attaches it to |parent|.
- void SetupAnimationLayer(ui::Layer* parent,
- ui::Layer* layer,
- InkDropDelegate* delegate);
+ InkDropHost* ink_drop_host_;
- // ui::EventHandler:
- void OnGestureEvent(ui::GestureEvent* event) override;
+ // The root layer that parents the animating layers.
+ scoped_ptr<ui::Layer> root_layer_;
- // The layer for animating a user touch. Added as a child to |view_|'s layer.
- // It will be stacked underneath.
+ // The layer used for animating a user touch.
scoped_ptr<ui::Layer> ink_drop_layer_;
// ui::LayerDelegate responsible for painting to |ink_drop_layer_|.
@@ -71,8 +77,7 @@ class VIEWS_EXPORT InkDropAnimationController : public ui::EventHandler {
// used to automatically trigger a hide animation upon completion.
scoped_ptr<AppearAnimationObserver> appear_animation_observer_;
- // The layer for animating a long press. Added as a child to |view_|'s layer.
- // It will be stacked underneath.
+ // The layer used for animating a long press.
scoped_ptr<ui::Layer> long_press_layer_;
// ui::LayerDelegate responsible for painting to |long_press_layer_|.
@@ -82,12 +87,13 @@ class VIEWS_EXPORT InkDropAnimationController : public ui::EventHandler {
// be used to automatically trigger a hide animation upon completion.
scoped_ptr<AppearAnimationObserver> long_press_animation_observer_;
- // The View for which InkDropAnimationController is a PreTargetHandler.
- View* view_;
+ // The bounds of the ink drop layers. Defined in the coordinate space of the
+ // parent ui::Layer that the ink drop layers were added to.
+ gfx::Rect ink_drop_bounds_;
- DISALLOW_COPY_AND_ASSIGN(InkDropAnimationController);
+ DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl);
};
} // namespace views
-#endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_H_
+#endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
« no previous file with comments | « ui/views/animation/ink_drop_animation_controller_factory.cc ('k') | ui/views/animation/ink_drop_animation_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698