| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bounds_animator.h" | 5 #include "ui/views/animation/bounds_animator.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "ui/base/animation/animation_container.h" | 8 #include "ui/base/animation/animation_container.h" |
| 9 #include "ui/base/animation/slide_animation.h" | 9 #include "ui/base/animation/slide_animation.h" |
| 10 #include "ui/views/animation/bounds_animator_observer.h" | 10 #include "ui/views/animation/bounds_animator_observer.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 void BoundsAnimator::SetTargetBounds(View* view, const gfx::Rect& target) { | 73 void BoundsAnimator::SetTargetBounds(View* view, const gfx::Rect& target) { |
| 74 if (!IsAnimating(view)) { | 74 if (!IsAnimating(view)) { |
| 75 AnimateViewTo(view, target); | 75 AnimateViewTo(view, target); |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 data_[view].target_bounds = target; | 79 data_[view].target_bounds = target; |
| 80 } | 80 } |
| 81 | 81 |
| 82 gfx::Rect BoundsAnimator::GetTargetBounds(View* view) { |
| 83 if (!IsAnimating(view)) |
| 84 return view->bounds(); |
| 85 return data_[view].target_bounds; |
| 86 } |
| 87 |
| 82 void BoundsAnimator::SetAnimationForView(View* view, | 88 void BoundsAnimator::SetAnimationForView(View* view, |
| 83 SlideAnimation* animation) { | 89 SlideAnimation* animation) { |
| 84 DCHECK(animation); | 90 DCHECK(animation); |
| 85 | 91 |
| 86 scoped_ptr<SlideAnimation> animation_wrapper(animation); | 92 scoped_ptr<SlideAnimation> animation_wrapper(animation); |
| 87 | 93 |
| 88 if (!IsAnimating(view)) | 94 if (!IsAnimating(view)) |
| 89 return; | 95 return; |
| 90 | 96 |
| 91 // We delay deleting the animation until the end so that we don't prematurely | 97 // We delay deleting the animation until the end so that we don't prematurely |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 FOR_EACH_OBSERVER(BoundsAnimatorObserver, | 279 FOR_EACH_OBSERVER(BoundsAnimatorObserver, |
| 274 observers_, | 280 observers_, |
| 275 OnBoundsAnimatorDone(this)); | 281 OnBoundsAnimatorDone(this)); |
| 276 } | 282 } |
| 277 } | 283 } |
| 278 | 284 |
| 279 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) { | 285 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) { |
| 280 } | 286 } |
| 281 | 287 |
| 282 } // namespace views | 288 } // namespace views |
| OLD | NEW |