OLD | NEW |
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_IMPL_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ |
6 #define UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 }; | 45 }; |
46 | 46 |
47 // Constructs an ink drop that will attach the ink drop to the given | 47 // Constructs an ink drop that will attach the ink drop to the given |
48 // |ink_drop_host|. |host_size| is used to set the size of the ink drop layer. | 48 // |ink_drop_host|. |host_size| is used to set the size of the ink drop layer. |
49 // | 49 // |
50 // By default the highlight will be made visible while |this| is hovered but | 50 // By default the highlight will be made visible while |this| is hovered but |
51 // not focused and the NONE AutoHighlightMode will be used. | 51 // not focused and the NONE AutoHighlightMode will be used. |
52 InkDropImpl(InkDropHost* ink_drop_host, const gfx::Size& host_size); | 52 InkDropImpl(InkDropHost* ink_drop_host, const gfx::Size& host_size); |
53 ~InkDropImpl() override; | 53 ~InkDropImpl() override; |
54 | 54 |
55 void SetShowHighlightOnHover(bool show_highlight_on_hover); | |
56 | |
57 void SetShowHighlightOnFocus(bool show_highlight_on_focus); | |
58 | |
59 // Auto highlighting is a mechanism to show/hide the highlight based on the | 55 // Auto highlighting is a mechanism to show/hide the highlight based on the |
60 // visibility of the ripple. See the documentation of the AutoHighlightMode | 56 // visibility of the ripple. See the documentation of the AutoHighlightMode |
61 // for more info on the different modes. | 57 // for more info on the different modes. |
62 // | 58 // |
63 // This method is intended as a configuration option to be used after | 59 // This method is intended as a configuration option to be used after |
64 // construction. Behavior is undefined if |this| has already handled any | 60 // construction. Behavior is undefined if |this| has already handled any |
65 // InkDrop inherited functions. | 61 // InkDrop inherited functions. |
66 void SetAutoHighlightMode(AutoHighlightMode auto_highlight_mode); | 62 void SetAutoHighlightMode(AutoHighlightMode auto_highlight_mode); |
67 | 63 |
68 // InkDrop: | 64 // InkDrop: |
69 void HostSizeChanged(const gfx::Size& new_size) override; | 65 void HostSizeChanged(const gfx::Size& new_size) override; |
70 InkDropState GetTargetInkDropState() const override; | 66 InkDropState GetTargetInkDropState() const override; |
71 void AnimateToState(InkDropState ink_drop_state) override; | 67 void AnimateToState(InkDropState ink_drop_state) override; |
72 void SnapToActivated() override; | 68 void SnapToActivated() override; |
73 void SetHovered(bool is_hovered) override; | 69 void SetHovered(bool is_hovered) override; |
74 void SetFocused(bool is_focused) override; | 70 void SetFocused(bool is_focused) override; |
| 71 bool IsHighlightFadingInOrVisible() const override; |
| 72 void SetShowHighlightOnHover(bool show_highlight_on_hover) override; |
| 73 void SetShowHighlightOnFocus(bool show_highlight_on_focus) override; |
75 | 74 |
76 private: | 75 private: |
77 friend class InkDropImplTest; | 76 friend class InkDropImplTest; |
78 friend class test::InkDropImplTestApi; | 77 friend class test::InkDropImplTestApi; |
79 | 78 |
80 // Forward declaration for use by the HighlightState class definition. | 79 // Forward declaration for use by the HighlightState class definition. |
81 class HighlightStateFactory; | 80 class HighlightStateFactory; |
82 | 81 |
83 // Base HighlightState defines functions to handle all state changes that may | 82 // Base HighlightState defines functions to handle all state changes that may |
84 // affect the highlight state. | 83 // affect the highlight state. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void DestroyInkDropHighlight(); | 214 void DestroyInkDropHighlight(); |
216 | 215 |
217 // Adds the |root_layer_| to the |ink_drop_host_| if it hasn't already been | 216 // Adds the |root_layer_| to the |ink_drop_host_| if it hasn't already been |
218 // added. | 217 // added. |
219 void AddRootLayerToHostIfNeeded(); | 218 void AddRootLayerToHostIfNeeded(); |
220 | 219 |
221 // Removes the |root_layer_| from the |ink_drop_host_| if no ink drop ripple | 220 // Removes the |root_layer_| from the |ink_drop_host_| if no ink drop ripple |
222 // or highlight is active. | 221 // or highlight is active. |
223 void RemoveRootLayerFromHostIfNeeded(); | 222 void RemoveRootLayerFromHostIfNeeded(); |
224 | 223 |
225 // Returns true if the highlight animation is in the process of fading in or | |
226 // is visible. | |
227 bool IsHighlightFadingInOrVisible() const; | |
228 | |
229 // views::InkDropRippleObserver: | 224 // views::InkDropRippleObserver: |
230 void AnimationStarted(InkDropState ink_drop_state) override; | 225 void AnimationStarted(InkDropState ink_drop_state) override; |
231 void AnimationEnded(InkDropState ink_drop_state, | 226 void AnimationEnded(InkDropState ink_drop_state, |
232 InkDropAnimationEndedReason reason) override; | 227 InkDropAnimationEndedReason reason) override; |
233 | 228 |
234 // views::InkDropHighlightObserver: | 229 // views::InkDropHighlightObserver: |
235 void AnimationStarted( | 230 void AnimationStarted( |
236 InkDropHighlight::AnimationType animation_type) override; | 231 InkDropHighlight::AnimationType animation_type) override; |
237 void AnimationEnded(InkDropHighlight::AnimationType animation_type, | 232 void AnimationEnded(InkDropHighlight::AnimationType animation_type, |
238 InkDropAnimationEndedReason reason) override; | 233 InkDropAnimationEndedReason reason) override; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 306 |
312 // Used to fail DCHECKS to catch unexpected behavior during tear down. | 307 // Used to fail DCHECKS to catch unexpected behavior during tear down. |
313 bool destroying_; | 308 bool destroying_; |
314 | 309 |
315 DISALLOW_COPY_AND_ASSIGN(InkDropImpl); | 310 DISALLOW_COPY_AND_ASSIGN(InkDropImpl); |
316 }; | 311 }; |
317 | 312 |
318 } // namespace views | 313 } // namespace views |
319 | 314 |
320 #endif // UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ | 315 #endif // UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ |
OLD | NEW |