| 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_CONTROLLER_IMPL_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 // Constructs an ink drop controller that will attach the ink drop to the | 31 // Constructs an ink drop controller that will attach the ink drop to the |
| 32 // given |ink_drop_host|. | 32 // given |ink_drop_host|. |
| 33 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); | 33 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); |
| 34 ~InkDropAnimationControllerImpl() override; | 34 ~InkDropAnimationControllerImpl() override; |
| 35 | 35 |
| 36 // InkDropAnimationController: | 36 // InkDropAnimationController: |
| 37 InkDropState GetTargetInkDropState() const override; | 37 InkDropState GetTargetInkDropState() const override; |
| 38 bool IsVisible() const override; | 38 bool IsVisible() const override; |
| 39 void AnimateToState(InkDropState ink_drop_state) override; | 39 void AnimateToState(InkDropState ink_drop_state) override; |
| 40 void SnapToActivated() override; |
| 40 void SetHovered(bool is_hovered) override; | 41 void SetHovered(bool is_hovered) override; |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 friend class InkDropAnimationControllerFactoryTest; | 44 friend class InkDropAnimationControllerFactoryTest; |
| 44 friend class InkDropAnimationControllerImplTest; | 45 friend class InkDropAnimationControllerImplTest; |
| 45 | 46 |
| 47 // Forcibly transition to the HIDDEN state if completing the current animation |
| 48 // sequence would eventually be HIDDEN. |
| 49 void CompleteHiddenTargetedAnimations(); |
| 50 |
| 46 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If | 51 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If |
| 47 // |ink_drop_animation_| wasn't null then it will be destroyed using | 52 // |ink_drop_animation_| wasn't null then it will be destroyed using |
| 48 // DestroyInkDropAnimation(). | 53 // DestroyInkDropAnimation(). |
| 49 void CreateInkDropAnimation(); | 54 void CreateInkDropAnimation(); |
| 50 | 55 |
| 51 // Destroys the current |ink_drop_animation_|. | 56 // Destroys the current |ink_drop_animation_|. |
| 52 void DestroyInkDropAnimation(); | 57 void DestroyInkDropAnimation(); |
| 53 | 58 |
| 54 // Creates a new InkDropHover and sets it to |hover_|. If |hover_| wasn't null | 59 // Creates a new InkDropHover and sets it to |hover_|. If |hover_| wasn't null |
| 55 // then it will be destroyed using DestroyInkDropHover(). | 60 // then it will be destroyed using DestroyInkDropHover(). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 InkDropHost* ink_drop_host_; | 92 InkDropHost* ink_drop_host_; |
| 88 | 93 |
| 89 // The root Layer that parents the InkDropAnimation layers and the | 94 // The root Layer that parents the InkDropAnimation layers and the |
| 90 // InkDropHover layers. The |root_layer_| is the one that is added and removed | 95 // InkDropHover layers. The |root_layer_| is the one that is added and removed |
| 91 // from the InkDropHost. | 96 // from the InkDropHost. |
| 92 scoped_ptr<ui::Layer> root_layer_; | 97 scoped_ptr<ui::Layer> root_layer_; |
| 93 | 98 |
| 94 // The current InkDropHover. Lazily created using CreateInkDropHover(); | 99 // The current InkDropHover. Lazily created using CreateInkDropHover(); |
| 95 scoped_ptr<InkDropHover> hover_; | 100 scoped_ptr<InkDropHover> hover_; |
| 96 | 101 |
| 102 // Tracks the logical hovered state of |this| as manipulated by the public |
| 103 // SetHovered() function. |
| 104 bool is_hovered_; |
| 105 |
| 97 // The current InkDropAnimation. Created on demand using | 106 // The current InkDropAnimation. Created on demand using |
| 98 // CreateInkDropAnimation(). | 107 // CreateInkDropAnimation(). |
| 99 scoped_ptr<InkDropAnimation> ink_drop_animation_; | 108 scoped_ptr<InkDropAnimation> ink_drop_animation_; |
| 100 | 109 |
| 101 // The timer used to delay the hover fade in after an ink drop animation. | 110 // The timer used to delay the hover fade in after an ink drop animation. |
| 102 scoped_ptr<base::Timer> hover_after_animation_timer_; | 111 scoped_ptr<base::Timer> hover_after_animation_timer_; |
| 103 | 112 |
| 104 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); | 113 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); |
| 105 }; | 114 }; |
| 106 | 115 |
| 107 } // namespace views | 116 } // namespace views |
| 108 | 117 |
| 109 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 118 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ |
| OLD | NEW |