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

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

Issue 1682893002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit tests Created 4 years, 10 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/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
(...skipping 21 matching lines...) Expand all
32 // given |ink_drop_host|. 32 // given |ink_drop_host|.
33 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); 33 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host);
34 ~InkDropAnimationControllerImpl() override; 34 ~InkDropAnimationControllerImpl() override;
35 35
36 // InkDropAnimationController: 36 // InkDropAnimationController:
37 InkDropState GetInkDropState() const override; 37 InkDropState GetInkDropState() const override;
38 bool IsVisible() const override; 38 bool IsVisible() const override;
39 void AnimateToState(InkDropState ink_drop_state) override; 39 void AnimateToState(InkDropState ink_drop_state) override;
40 void SetHovered(bool is_hovered) override; 40 void SetHovered(bool is_hovered) override;
41 bool IsHovered() const override; 41 bool IsHovered() const override;
42 gfx::Size GetInkDropLargeSize() const override;
43 void SetInkDropSize(const gfx::Size& large_size, 42 void SetInkDropSize(const gfx::Size& large_size,
44 int large_corner_radius, 43 int large_corner_radius,
45 const gfx::Size& small_size, 44 const gfx::Size& small_size,
46 int small_corner_radius) override; 45 int small_corner_radius) override;
47 void SetInkDropCenter(const gfx::Point& center_point) override; 46 void SetInkDropCenter(const gfx::Point& center_point) override;
48 47
49 private: 48 private:
50 friend class InkDropAnimationControllerFactoryTest; 49 friend class InkDropAnimationControllerFactoryTest;
51 friend class InkDropAnimationControllerImplTest; 50 friend class InkDropAnimationControllerImplTest;
52 51
53 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If 52 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If
54 // |ink_drop_animation_| wasn't null then it will be destroyed using 53 // |ink_drop_animation_| wasn't null then it will be destroyed using
55 // DestroyInkDropAnimation(). 54 // DestroyInkDropAnimation().
56 void CreateInkDropAnimation(); 55 void EnsureInkDropAnimation();
57 56
58 // Destroys the current |ink_drop_animation_|. 57 // Destroys the current |ink_drop_animation_|.
59 void DestroyInkDropAnimation(); 58 void DestroyInkDropAnimation();
60 59
61 // Creates a new InkDropHover and sets it to |hover_|. If |hover_| wasn't null 60 // Creates a new InkDropHover and sets it to |hover_|. If |hover_| wasn't null
62 // then it will be destroyed using DestroyInkDropHover(). 61 // then it will be destroyed using DestroyInkDropHover().
63 void CreateInkDropHover(); 62 void EnsureInkDropHover();
64 63
65 // Destroys the current |hover_|. 64 // Destroys the current |hover_|.
66 void DestroyInkDropHover(); 65 void DestroyInkDropHover();
67 66
68 // views::InkDropAnimationObserver: 67 // views::InkDropAnimationObserver:
69 void InkDropAnimationStarted(InkDropState ink_drop_state) override; 68 void InkDropAnimationStarted(InkDropState ink_drop_state) override;
70 void InkDropAnimationEnded(InkDropState ink_drop_state, 69 void InkDropAnimationEnded(InkDropState ink_drop_state,
71 InkDropAnimationEndedReason reason) override; 70 InkDropAnimationEndedReason reason) override;
72 71
73 // Enables or disables the hover state based on |is_hovered| and if an 72 // Enables or disables the hover state based on |is_hovered| and if an
(...skipping 28 matching lines...) Expand all
102 int ink_drop_small_corner_radius_; 101 int ink_drop_small_corner_radius_;
103 102
104 // Cached center point for the ink drop. 103 // Cached center point for the ink drop.
105 gfx::Point ink_drop_center_; 104 gfx::Point ink_drop_center_;
106 105
107 // The root Layer that parents the InkDropAnimation layers and the 106 // The root Layer that parents the InkDropAnimation layers and the
108 // InkDropHover layers. The |root_layer_| is the one that is added and removed 107 // InkDropHover layers. The |root_layer_| is the one that is added and removed
109 // from the InkDropHost. 108 // from the InkDropHost.
110 scoped_ptr<ui::Layer> root_layer_; 109 scoped_ptr<ui::Layer> root_layer_;
111 110
112 // The current InkDropHover. Lazily created using CreateInkDropHover(); 111 // The current InkDropHover. Lazily created using EnsureInkDropHover();
113 scoped_ptr<InkDropHover> hover_; 112 scoped_ptr<InkDropHover> hover_;
114 113
115 // The current InkDropAnimation. Created on demand using 114 // The current InkDropAnimation. Created on demand using
116 // CreateInkDropAnimation(). 115 // EnsureInkDropAnimation().
117 scoped_ptr<SquareInkDropAnimation> ink_drop_animation_; 116 scoped_ptr<SquareInkDropAnimation> ink_drop_animation_;
118 117
119 // Tracks whether the InkDropAnimation can safely be destroyed when an 118 // Tracks whether the InkDropAnimation can safely be destroyed when an
120 // InkDropState::HIDDEN animation completes. 119 // InkDropState::HIDDEN animation completes.
121 bool can_destroy_after_hidden_animation_; 120 bool can_destroy_after_hidden_animation_;
122 121
123 // The timer used to delay the hover fade in after an ink drop animation. 122 // The timer used to delay the hover fade in after an ink drop animation.
124 scoped_ptr<base::Timer> hover_after_animation_timer_; 123 scoped_ptr<base::Timer> hover_after_animation_timer_;
125 124
126 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); 125 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl);
127 }; 126 };
128 127
129 } // namespace views 128 } // namespace views
130 129
131 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ 130 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698