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

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

Issue 1373983002: Enhanced the InkDropRippleImpl to create/destroy InkDropAnimations as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Based diff delta on dependant branch. Created 5 years, 2 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/observer_list.h"
sadrul 2015/10/08 01:06:01 This isn't needed?
bruthig 2015/10/08 21:42:55 Whoops, not yet at least. Removed.
9 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/geometry/size.h" 11 #include "ui/gfx/geometry/size.h"
11 #include "ui/views/animation/ink_drop_animation_controller.h" 12 #include "ui/views/animation/ink_drop_animation_controller.h"
13 #include "ui/views/animation/ink_drop_animation_observer.h"
12 #include "ui/views/views_export.h" 14 #include "ui/views/views_export.h"
13 15
14 namespace views { 16 namespace views {
15 class InkDropAnimation; 17 class InkDropAnimation;
16 class InkDropHost; 18 class InkDropHost;
17 19
18 // A functional implementation of an InkDropAnimationController. 20 // A functional implementation of an InkDropAnimationController.
19 class VIEWS_EXPORT InkDropAnimationControllerImpl 21 class VIEWS_EXPORT InkDropAnimationControllerImpl
20 : public InkDropAnimationController { 22 : public InkDropAnimationController,
23 public InkDropAnimationObserver {
21 public: 24 public:
22 // Constructs an ink drop controller that will attach the ink drop to the 25 // Constructs an ink drop controller that will attach the ink drop to the
23 // given |ink_drop_host|. 26 // given |ink_drop_host|.
24 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); 27 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host);
25 ~InkDropAnimationControllerImpl() override; 28 ~InkDropAnimationControllerImpl() override;
26 29
27 // InkDropAnimationController: 30 // InkDropAnimationController:
28 InkDropState GetInkDropState() const override; 31 InkDropState GetInkDropState() const override;
29 void AnimateToState(InkDropState state) override; 32 void AnimateToState(InkDropState ink_drop_state) override;
30 gfx::Size GetInkDropLargeSize() const override; 33 gfx::Size GetInkDropLargeSize() const override;
31 void SetInkDropSize(const gfx::Size& large_size, 34 void SetInkDropSize(const gfx::Size& large_size,
32 int large_corner_radius, 35 int large_corner_radius,
33 const gfx::Size& small_size, 36 const gfx::Size& small_size,
34 int small_corner_radius) override; 37 int small_corner_radius) override;
35 void SetInkDropCenter(const gfx::Point& center_point) override; 38 void SetInkDropCenter(const gfx::Point& center_point) override;
36 39
37 private: 40 private:
38 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If 41 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If
39 // |ink_drop_animation_| wasn't null then it will be removed from the 42 // |ink_drop_animation_| wasn't null then it will be destroyed using
40 // |ink_drop_host_|. 43 // DestroyInkDropAnimation().
41 void CreateInkDropAnimation(); 44 void CreateInkDropAnimation();
42 45
46 // Destroys the current |ink_drop_animation_|.
47 void DestroyInkDropAnimation();
48
49 // views::InkDropAnimationObserver:
50 void InkDropAnimationStarted(InkDropState ink_drop_state) override;
51 void InkDropAnimationEnded(InkDropState ink_drop_state,
52 InkDropAnimationEndedReason reason) override;
53
43 // The host of the ink drop. 54 // The host of the ink drop.
44 InkDropHost* ink_drop_host_; 55 InkDropHost* ink_drop_host_;
45 56
46 // Cached size for the ink drop's large size animations. 57 // Cached size for the ink drop's large size animations.
47 gfx::Size ink_drop_large_size_; 58 gfx::Size ink_drop_large_size_;
48 59
49 // Cached corner radius for the ink drop's large size animations. 60 // Cached corner radius for the ink drop's large size animations.
50 int ink_drop_large_corner_radius_; 61 int ink_drop_large_corner_radius_;
51 62
52 // Cached size for the ink drop's small size animations. 63 // Cached size for the ink drop's small size animations.
53 gfx::Size ink_drop_small_size_; 64 gfx::Size ink_drop_small_size_;
54 65
55 // Cached corner radius for the ink drop's small size animations. 66 // Cached corner radius for the ink drop's small size animations.
56 int ink_drop_small_corner_radius_; 67 int ink_drop_small_corner_radius_;
57 68
58 // Cached center point for the ink drop. 69 // Cached center point for the ink drop.
59 gfx::Point ink_drop_center_; 70 gfx::Point ink_drop_center_;
60 71
61 // The current InkDropAnimation. Created on demand using 72 // The current InkDropAnimation. Created on demand using
62 // CreateInkDropAnimation(). 73 // CreateInkDropAnimation().
63 scoped_ptr<InkDropAnimation> ink_drop_animation_; 74 scoped_ptr<InkDropAnimation> ink_drop_animation_;
64 75
65 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); 76 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl);
66 }; 77 };
67 78
68 } // namespace views 79 } // namespace views
69 80
70 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 81 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698