| 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 <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/views/animation/ink_drop_animation_ended_reason.h" |
| 11 #include "ui/views/animation/ink_drop_state.h" | 12 #include "ui/views/animation/ink_drop_state.h" |
| 12 #include "ui/views/views_export.h" | 13 #include "ui/views/views_export.h" |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 | 16 |
| 16 // Pure-virtual base class of an observer that can be attached to | 17 // Observer to attach to an InkDropAnimation. |
| 17 // InkDropAnimations. | |
| 18 class VIEWS_EXPORT InkDropAnimationObserver { | 18 class VIEWS_EXPORT InkDropAnimationObserver { |
| 19 public: | 19 public: |
| 20 // Enumeration of the different reasons why an InkDropAnimation has finished. | 20 // An animation for the given |ink_drop_state| has started. |
| 21 enum InkDropAnimationEndedReason { | 21 virtual void AnimationStarted(InkDropState ink_drop_state) = 0; |
| 22 // The animation was completed successfully. | |
| 23 SUCCESS, | |
| 24 // The animation was stopped prematurely before reaching its final state. | |
| 25 PRE_EMPTED | |
| 26 }; | |
| 27 | 22 |
| 28 // Notifies the observer that an animation for |ink_drop_state| has started. | 23 // Notifies the observer that an animation for the given |ink_drop_state| has |
| 29 virtual void InkDropAnimationStarted(InkDropState ink_drop_state) = 0; | 24 // finished and the reason for completion is given by |reason|. If |reason| is |
| 30 | 25 // SUCCESS then the animation has progressed to its final frame however if |
| 31 // Notifies the observer that an animation for |ink_drop_state| has finished | 26 // |reason| is |PRE_EMPTED| then the animation was stopped before its final |
| 32 // and the reason for completion is given by |reason|. If |reason| is SUCCESS | 27 // frame. |
| 33 // then the animation has progressed to its final frame however if |reason| | 28 virtual void AnimationEnded(InkDropState ink_drop_state, |
| 34 // is |PRE_EMPTED| then the animation was stopped before its final frame. In | 29 InkDropAnimationEndedReason reason) = 0; |
| 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 | 30 |
| 42 protected: | 31 protected: |
| 43 InkDropAnimationObserver() {} | 32 InkDropAnimationObserver() {} |
| 44 virtual ~InkDropAnimationObserver() {} | 33 virtual ~InkDropAnimationObserver() {} |
| 45 | 34 |
| 46 private: | 35 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationObserver); | 36 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationObserver); |
| 48 }; | 37 }; |
| 49 | 38 |
| 50 // Returns a human readable string for |reason|. Useful for logging. | |
| 51 std::string ToString( | |
| 52 InkDropAnimationObserver::InkDropAnimationEndedReason reason); | |
| 53 | |
| 54 } // namespace views | 39 } // namespace views |
| 55 | 40 |
| 56 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_OBSERVER_H_ | 41 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_OBSERVER_H_ |
| OLD | NEW |