| 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 #include "ui/views/animation/ink_drop_impl.h" | 5 #include "ui/views/animation/ink_drop_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 10 #include "ui/views/animation/ink_drop_highlight.h" | 10 #include "ui/views/animation/ink_drop_highlight.h" |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 | 731 |
| 732 void InkDropImpl::AnimationStarted(InkDropState ink_drop_state) { | 732 void InkDropImpl::AnimationStarted(InkDropState ink_drop_state) { |
| 733 highlight_state_->AnimationStarted(ink_drop_state); | 733 highlight_state_->AnimationStarted(ink_drop_state); |
| 734 } | 734 } |
| 735 | 735 |
| 736 void InkDropImpl::AnimationEnded(InkDropState ink_drop_state, | 736 void InkDropImpl::AnimationEnded(InkDropState ink_drop_state, |
| 737 InkDropAnimationEndedReason reason) { | 737 InkDropAnimationEndedReason reason) { |
| 738 highlight_state_->AnimationEnded(ink_drop_state, reason); | 738 highlight_state_->AnimationEnded(ink_drop_state, reason); |
| 739 if (reason != InkDropAnimationEndedReason::SUCCESS) | 739 if (reason != InkDropAnimationEndedReason::SUCCESS) |
| 740 return; | 740 return; |
| 741 // |ink_drop_ripple_| might be null during destruction. |
| 742 if (!ink_drop_ripple_) |
| 743 return; |
| 741 if (ShouldAnimateToHidden(ink_drop_state)) { | 744 if (ShouldAnimateToHidden(ink_drop_state)) { |
| 742 ink_drop_ripple_->AnimateToState(views::InkDropState::HIDDEN); | 745 ink_drop_ripple_->AnimateToState(views::InkDropState::HIDDEN); |
| 743 } else if (ink_drop_state == views::InkDropState::HIDDEN) { | 746 } else if (ink_drop_state == views::InkDropState::HIDDEN) { |
| 744 // TODO(bruthig): Investigate whether creating and destroying | 747 // TODO(bruthig): Investigate whether creating and destroying |
| 745 // InkDropRipples is expensive and consider creating an | 748 // InkDropRipples is expensive and consider creating an |
| 746 // InkDropRipplePool. See www.crbug.com/522175. | 749 // InkDropRipplePool. See www.crbug.com/522175. |
| 747 DestroyInkDropRipple(); | 750 DestroyInkDropRipple(); |
| 748 } | 751 } |
| 749 } | 752 } |
| 750 | 753 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 "within a call to " | 803 "within a call to " |
| 801 "HighlightState::Exit()."; | 804 "HighlightState::Exit()."; |
| 802 if (highlight_state_) { | 805 if (highlight_state_) { |
| 803 base::AutoReset<bool> exit_guard(&exiting_highlight_state_, true); | 806 base::AutoReset<bool> exit_guard(&exiting_highlight_state_, true); |
| 804 highlight_state_->Exit(); | 807 highlight_state_->Exit(); |
| 805 } | 808 } |
| 806 highlight_state_ = nullptr; | 809 highlight_state_ = nullptr; |
| 807 } | 810 } |
| 808 | 811 |
| 809 } // namespace views | 812 } // namespace views |
| OLD | NEW |