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