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

Side by Side Diff: ui/views/animation/ink_drop_animation_controller_impl.h

Issue 1286693004: Extracted InkDropAnimator class from InkDropAnimationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h"
10 #include "ui/events/event_handler.h"
11 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h" 10 #include "ui/gfx/geometry/size.h"
13 #include "ui/views/animation/ink_drop_animation_controller.h" 11 #include "ui/views/animation/ink_drop_animation_controller.h"
14 #include "ui/views/views_export.h" 12 #include "ui/views/views_export.h"
15 13
16 namespace ui {
17 class Layer;
18 }
19
20 namespace views { 14 namespace views {
21 class AppearAnimationObserver; 15 class InkDropAnimation;
22 class InkDropDelegate;
23 class InkDropHost; 16 class InkDropHost;
24 class View;
25 17
26 // Controls an ink drop animation which is hosted by an InkDropHost. 18 // Controls an ink drop animation which is hosted by an InkDropHost.
27 class VIEWS_EXPORT InkDropAnimationControllerImpl 19 class VIEWS_EXPORT InkDropAnimationControllerImpl
28 : public InkDropAnimationController { 20 : public InkDropAnimationController {
29 public: 21 public:
30 // Constructs an ink drop controller that will attach the ink drop to the 22 // Constructs an ink drop controller that will attach the ink drop to the
31 // given |ink_drop_host|. 23 // given |ink_drop_host|.
32 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); 24 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host);
33 ~InkDropAnimationControllerImpl() override; 25 ~InkDropAnimationControllerImpl() override;
34 26
35 // InkDropAnimationController: 27 // InkDropAnimationController:
36 void AnimateToState(InkDropState state) override; 28 void AnimateToState(InkDropState state) override;
37 void SetInkDropSize(const gfx::Size& size) override; 29 void SetInkDropSize(const gfx::Size& size) override;
38 gfx::Rect GetInkDropBounds() const override; 30 gfx::Rect GetInkDropBounds() const override;
39 void SetInkDropBounds(const gfx::Rect& bounds) override; 31 void SetInkDropBounds(const gfx::Rect& bounds) override;
40 32
41 private: 33 private:
42 // Starts the animation of a touch event. 34 // The host of the ink drop.
43 void AnimateTapDown();
44
45 // Schedules the hide animation of |ink_drop_layer_| for once its current
46 // animation has completed. If |ink_drop_layer_| is not animating, the hide
47 // animation begins immediately.
48 void AnimateHide();
49
50 // Starts the animation of a long press, and cancels hiding |ink_drop_layer_|
51 // until the long press has completed.
52 void AnimateLongPress();
53
54 // Starts the showing animation on |layer|, with a |duration| in milliseconds.
55 void AnimateShow(ui::Layer* layer,
56 AppearAnimationObserver* observer,
57 base::TimeDelta duration);
58
59 // Sets the bounds for |layer|.
60 void SetLayerBounds(ui::Layer* layer);
61
62 // Initializes |layer|'s properties.
63 void SetupAnimationLayer(ui::Layer* layer, InkDropDelegate* delegate);
64
65 InkDropHost* ink_drop_host_; 35 InkDropHost* ink_drop_host_;
66 36
67 // The root layer that parents the animating layers. 37 // TODO(bruthig): It will be expensive to maintain InkDropAnimation instances
68 scoped_ptr<ui::Layer> root_layer_; 38 // when they are not actually being used. Consider creating InkDropAnimations
69 39 // on an as-needed basis and if construction is also expensive then consider
70 // The layer used for animating a user touch. 40 // creating an InkDropAnimationPool. See www.crbug.com/522175.
71 scoped_ptr<ui::Layer> ink_drop_layer_; 41 scoped_ptr<InkDropAnimation> ink_drop_animation_;
72
73 // ui::LayerDelegate responsible for painting to |ink_drop_layer_|.
74 scoped_ptr<InkDropDelegate> ink_drop_delegate_;
75
76 // ui::ImplicitAnimationObserver which observes |ink_drop_layer_| and can be
77 // used to automatically trigger a hide animation upon completion.
78 scoped_ptr<AppearAnimationObserver> appear_animation_observer_;
79
80 // The layer used for animating a long press.
81 scoped_ptr<ui::Layer> long_press_layer_;
82
83 // ui::LayerDelegate responsible for painting to |long_press_layer_|.
84 scoped_ptr<InkDropDelegate> long_press_delegate_;
85
86 // ui::ImplicitAnimationObserver which observers |long_press_layer_| and can
87 // be used to automatically trigger a hide animation upon completion.
88 scoped_ptr<AppearAnimationObserver> long_press_animation_observer_;
89
90 // The bounds of the ink drop layers. Defined in the coordinate space of the
91 // parent ui::Layer that the ink drop layers were added to.
92 gfx::Rect ink_drop_bounds_;
93 42
94 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); 43 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl);
95 }; 44 };
96 45
97 } // namespace views 46 } // namespace views
98 47
99 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 48 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_animation_controller.h ('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