Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_RIPPLE_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_RIPPLE_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_RIPPLE_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_RIPPLE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
| 10 #include "ui/views/animation/ink_drop_ripple_observer.h" | 10 #include "ui/views/animation/ink_drop_ripple_observer.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 // In the event that an animation is in progress for ink drop state 's1' and | 50 // In the event that an animation is in progress for ink drop state 's1' and |
| 51 // an animation to a new state 's2' is triggered, then | 51 // an animation to a new state 's2' is triggered, then |
| 52 // AnimationEnded(s1, PRE_EMPTED) will be called before | 52 // AnimationEnded(s1, PRE_EMPTED) will be called before |
| 53 // AnimationStarted(s2). | 53 // AnimationStarted(s2). |
| 54 void set_observer(InkDropRippleObserver* observer) { observer_ = observer; } | 54 void set_observer(InkDropRippleObserver* observer) { observer_ = observer; } |
| 55 | 55 |
| 56 // Animates from the current InkDropState to the new |ink_drop_state|. | 56 // Animates from the current InkDropState to the new |ink_drop_state|. |
| 57 // | 57 // |
| 58 // NOTE: GetTargetInkDropState() should return the new |ink_drop_state| value | 58 // NOTE: GetTargetInkDropState() should return the new |ink_drop_state| value |
| 59 // to any observers being notified as a result of the call. | 59 // to any observers being notified as a result of the call. |
| 60 void AnimateToState(InkDropState ink_drop_state); | 60 virtual void AnimateToState(InkDropState ink_drop_state); |
|
bruthig
2016/08/25 17:45:29
This was intended to be a non-virtual function tha
Evan Stade
2016/08/26 23:36:15
Generally speaking, extracting logic like this red
bruthig
2016/08/31 22:22:29
The InkDropRipple class defines a contract that gu
Evan Stade
2016/09/01 01:19:15
It's not really a choice, because AnimateStateChan
bruthig
2016/09/01 15:53:57
I would have to see this more concretely. The maj
Evan Stade
2016/09/07 23:46:19
updated.
I don't think it's really a problem if a
bruthig
2016/09/08 15:56:04
Right, the layer won't leak memory but it will exi
Evan Stade
2016/09/08 19:17:31
I don't understand the motivation to do that. We'r
bruthig
2016/09/09 16:05:47
That is the current scenario. I am requesting tha
Evan Stade
2016/09/09 18:55:48
The memory footprint is negligible and it's not a
bruthig
2016/09/09 19:30:05
How about this, in the quick return you could invo
| |
| 61 | 61 |
| 62 InkDropState target_ink_drop_state() const { return target_ink_drop_state_; } | 62 InkDropState target_ink_drop_state() const { return target_ink_drop_state_; } |
| 63 | 63 |
| 64 // Immediately aborts all in-progress animations and hides the ink drop. | 64 // Immediately aborts all in-progress animations and hides the ink drop. |
| 65 // | 65 // |
| 66 // NOTE: This will NOT raise Animation(Started|Ended) events for the state | 66 // NOTE: This will NOT raise Animation(Started|Ended) events for the state |
| 67 // transition to HIDDEN! | 67 // transition to HIDDEN! |
| 68 void HideImmediately(); | 68 void HideImmediately(); |
| 69 | 69 |
| 70 // Immediately snaps the ink drop to the ACTIVATED target state. All pending | 70 // Immediately snaps the ink drop to the ACTIVATED target state. All pending |
| 71 // animations are aborted. Events will be raised for the pending animations | 71 // animations are aborted. Events will be raised for the pending animations |
| 72 // as well as the transition to the ACTIVATED state. | 72 // as well as the transition to the ACTIVATED state. |
| 73 virtual void SnapToActivated(); | 73 virtual void SnapToActivated(); |
| 74 | 74 |
| 75 // The root Layer that can be added in to a Layer tree. | 75 // The root Layer that can be added in to a Layer tree. This may return null. |
| 76 virtual ui::Layer* GetRootLayer() = 0; | 76 virtual ui::Layer* GetRootLayer() = 0; |
| 77 | 77 |
| 78 // Returns true when the ripple is visible. This is different from checking if | 78 // Returns true when the ripple is visible. This is different from checking if |
| 79 // the ink_drop_state() == HIDDEN because the ripple may be visible while it | 79 // the ink_drop_state() == HIDDEN because the ripple may be visible while it |
| 80 // animates to the target HIDDEN state. | 80 // animates to the target HIDDEN state. |
| 81 virtual bool IsVisible() const = 0; | 81 bool IsVisible(); |
| 82 | |
| 83 // Returns true if this ripple is mutually exclusive with InkDropHighlight. | |
| 84 virtual bool OverridesHighlight() const = 0; | |
| 82 | 85 |
| 83 // Returns a test api to access internals of this. Default implmentations | 86 // Returns a test api to access internals of this. Default implmentations |
| 84 // should return nullptr and test specific subclasses can override to return | 87 // should return nullptr and test specific subclasses can override to return |
| 85 // an instance. | 88 // an instance. |
| 86 virtual test::InkDropRippleTestApi* GetTestApi(); | 89 virtual test::InkDropRippleTestApi* GetTestApi(); |
| 87 | 90 |
| 88 protected: | 91 protected: |
| 89 // Animates the ripple from the |old_ink_drop_state| to the | 92 // Animates the ripple from the |old_ink_drop_state| to the |
| 90 // |new_ink_drop_state|. |observer| is added to all LayerAnimationSequence's | 93 // |new_ink_drop_state|. |observer| is added to all LayerAnimationSequence's |
| 91 // used if not null. | 94 // used if not null. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 117 InkDropState target_ink_drop_state_; | 120 InkDropState target_ink_drop_state_; |
| 118 | 121 |
| 119 InkDropRippleObserver* observer_; | 122 InkDropRippleObserver* observer_; |
| 120 | 123 |
| 121 DISALLOW_COPY_AND_ASSIGN(InkDropRipple); | 124 DISALLOW_COPY_AND_ASSIGN(InkDropRipple); |
| 122 }; | 125 }; |
| 123 | 126 |
| 124 } // namespace views | 127 } // namespace views |
| 125 | 128 |
| 126 #endif // UI_VIEWS_ANIMATION_INK_DROP_RIPPLE_H_ | 129 #endif // UI_VIEWS_ANIMATION_INK_DROP_RIPPLE_H_ |
| OLD | NEW |