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_ANIMATION_OBSERVER_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_OBSERVER_H_ |
6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_OBSERVER_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_OBSERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include "ui/views/animation/animation_observer.h" |
9 | |
10 #include "base/macros.h" | |
11 #include "ui/views/animation/ink_drop_state.h" | 9 #include "ui/views/animation/ink_drop_state.h" |
12 #include "ui/views/views_export.h" | |
13 | 10 |
14 namespace views { | 11 namespace views { |
15 | 12 |
16 // Pure-virtual base class of an observer that can be attached to | 13 // The same type as used by InkDropAnimation::set_observer(). Observer classes |
17 // InkDropAnimations. | 14 // should inherit from this typedef. |
18 class VIEWS_EXPORT InkDropAnimationObserver { | 15 typedef AnimationObserver<InkDropState> InkDropAnimationObserver; |
sky
2016/04/20 19:38:47
typedef->using
bruthig
2016/04/20 21:20:09
Done.
| |
19 public: | |
20 // Enumeration of the different reasons why an InkDropAnimation has finished. | |
21 enum InkDropAnimationEndedReason { | |
22 // The animation was completed successfully. | |
23 SUCCESS, | |
24 // The animation was stopped prematurely before reaching its final state. | |
25 PRE_EMPTED | |
26 }; | |
27 | |
28 // Notifies the observer that an animation for |ink_drop_state| has started. | |
29 virtual void InkDropAnimationStarted(InkDropState ink_drop_state) = 0; | |
30 | |
31 // Notifies the observer that an animation for |ink_drop_state| has finished | |
32 // and the reason for completion is given by |reason|. If |reason| is SUCCESS | |
33 // then the animation has progressed to its final frame however if |reason| | |
34 // is |PRE_EMPTED| then the animation was stopped before its final frame. In | |
35 // the event that an animation is in progress for ink drop state 's1' and an | |
36 // animation to a new state 's2' is triggered, then | |
37 // InkDropAnimationEnded(s1, PRE_EMPTED) will be called before | |
38 // InkDropAnimationStarted(s2). | |
39 virtual void InkDropAnimationEnded(InkDropState ink_drop_state, | |
40 InkDropAnimationEndedReason reason) = 0; | |
41 | |
42 protected: | |
43 InkDropAnimationObserver() {} | |
44 virtual ~InkDropAnimationObserver() {} | |
45 | |
46 private: | |
47 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationObserver); | |
48 }; | |
49 | |
50 // Returns a human readable string for |reason|. Useful for logging. | |
51 std::string ToString( | |
52 InkDropAnimationObserver::InkDropAnimationEndedReason reason); | |
53 | 16 |
54 } // namespace views | 17 } // namespace views |
55 | 18 |
56 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_OBSERVER_H_ | 19 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_OBSERVER_H_ |
OLD | NEW |