| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "views/animator.h" | 5 #include "views/animator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/slide_animation.h" | 9 #include "app/slide_animation.h" |
| 10 #include "views/view.h" | 10 #include "views/view.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 start_bounds_.set_height(target_bounds_.height()); | 77 start_bounds_.set_height(target_bounds_.height()); |
| 78 | 78 |
| 79 // Make sure the host view has the start bounds to avoid a flicker. | 79 // Make sure the host view has the start bounds to avoid a flicker. |
| 80 host_->SetBounds(start_bounds_); | 80 host_->SetBounds(start_bounds_); |
| 81 | 81 |
| 82 // Start the animation from the beginning. | 82 // Start the animation from the beginning. |
| 83 animation_->Reset(0.0); | 83 animation_->Reset(0.0); |
| 84 animation_->Show(); | 84 animation_->Show(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void Animator::AnimateToBounds(int x, int y, int width, int height, |
| 88 int direction) { |
| 89 AnimateToBounds(gfx::Rect(x, y, std::max(0, width), std::max(0, height)), |
| 90 direction); |
| 91 } |
| 92 |
| 87 //////////////////////////////////////////////////////////////////////////////// | 93 //////////////////////////////////////////////////////////////////////////////// |
| 88 // Animator, AnimationDelegate: | 94 // Animator, AnimationDelegate: |
| 89 | 95 |
| 90 void Animator::AnimationEnded(const Animation* animation) { | 96 void Animator::AnimationEnded(const Animation* animation) { |
| 91 // |delegate_| could be NULL if we're called back from the destructor. | 97 // |delegate_| could be NULL if we're called back from the destructor. |
| 92 if (delegate_) | 98 if (delegate_) |
| 93 delegate_->AnimationCompletedForHost(host_); | 99 delegate_->AnimationCompletedForHost(host_); |
| 94 } | 100 } |
| 95 | 101 |
| 96 void Animator::AnimationProgressed(const Animation* animation) { | 102 void Animator::AnimationProgressed(const Animation* animation) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 int Animator::GetClampedY() const { | 148 int Animator::GetClampedY() const { |
| 143 if (delegate_ && direction_ & ANIMATE_CLAMP && direction_ & ANIMATE_Y) { | 149 if (delegate_ && direction_ & ANIMATE_CLAMP && direction_ & ANIMATE_Y) { |
| 144 View* previous_view = delegate_->GetClampedView(host_); | 150 View* previous_view = delegate_->GetClampedView(host_); |
| 145 if (previous_view) | 151 if (previous_view) |
| 146 return previous_view->bounds().bottom(); | 152 return previous_view->bounds().bottom(); |
| 147 } | 153 } |
| 148 return host_->y(); | 154 return host_->y(); |
| 149 } | 155 } |
| 150 | 156 |
| 151 } // namespace views | 157 } // namespace views |
| OLD | NEW |