| 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/compositor/scoped_layer_animation_settings.h" | 5 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 6 | 6 |
| 7 #include "ui/compositor/layer.h" | 7 #include "ui/compositor/layer.h" |
| 8 #include "ui/compositor/layer_animation_observer.h" | 8 #include "ui/compositor/layer_animation_observer.h" |
| 9 #include "ui/compositor/layer_animation_sequence.h" | 9 #include "ui/compositor/layer_animation_sequence.h" |
| 10 #include "ui/compositor/layer_animator.h" | 10 #include "ui/compositor/layer_animator.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 void ScopedLayerAnimationSettings::SetTransitionDuration( | 114 void ScopedLayerAnimationSettings::SetTransitionDuration( |
| 115 base::TimeDelta duration) { | 115 base::TimeDelta duration) { |
| 116 animator_->transition_duration_ = duration; | 116 animator_->transition_duration_ = duration; |
| 117 } | 117 } |
| 118 | 118 |
| 119 base::TimeDelta ScopedLayerAnimationSettings::GetTransitionDuration() const { | 119 base::TimeDelta ScopedLayerAnimationSettings::GetTransitionDuration() const { |
| 120 return animator_->transition_duration_; | 120 return animator_->transition_duration_; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ScopedLayerAnimationSettings::SetTweenType(Tween::Type tween_type) { | 123 void ScopedLayerAnimationSettings::SetTweenType(gfx::Tween::Type tween_type) { |
| 124 animator_->set_tween_type(tween_type); | 124 animator_->set_tween_type(tween_type); |
| 125 } | 125 } |
| 126 | 126 |
| 127 Tween::Type ScopedLayerAnimationSettings::GetTweenType() const { | 127 gfx::Tween::Type ScopedLayerAnimationSettings::GetTweenType() const { |
| 128 return animator_->tween_type(); | 128 return animator_->tween_type(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void ScopedLayerAnimationSettings::SetPreemptionStrategy( | 131 void ScopedLayerAnimationSettings::SetPreemptionStrategy( |
| 132 LayerAnimator::PreemptionStrategy strategy) { | 132 LayerAnimator::PreemptionStrategy strategy) { |
| 133 animator_->set_preemption_strategy(strategy); | 133 animator_->set_preemption_strategy(strategy); |
| 134 } | 134 } |
| 135 | 135 |
| 136 LayerAnimator::PreemptionStrategy | 136 LayerAnimator::PreemptionStrategy |
| 137 ScopedLayerAnimationSettings::GetPreemptionStrategy() const { | 137 ScopedLayerAnimationSettings::GetPreemptionStrategy() const { |
| 138 return animator_->preemption_strategy(); | 138 return animator_->preemption_strategy(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void ScopedLayerAnimationSettings::SetInverselyAnimatedBaseLayer(Layer* base) { | 141 void ScopedLayerAnimationSettings::SetInverselyAnimatedBaseLayer(Layer* base) { |
| 142 if (inverse_observer_->layer() && !base) { | 142 if (inverse_observer_->layer() && !base) { |
| 143 animator_->RemoveObserver(inverse_observer_.get()); | 143 animator_->RemoveObserver(inverse_observer_.get()); |
| 144 } else if (base && !(inverse_observer_->layer())) { | 144 } else if (base && !(inverse_observer_->layer())) { |
| 145 animator_->AddObserver(inverse_observer_.get()); | 145 animator_->AddObserver(inverse_observer_.get()); |
| 146 } | 146 } |
| 147 inverse_observer_->SetLayer(base); | 147 inverse_observer_->SetLayer(base); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void ScopedLayerAnimationSettings::AddInverselyAnimatedLayer( | 150 void ScopedLayerAnimationSettings::AddInverselyAnimatedLayer( |
| 151 Layer* inverse_layer) { | 151 Layer* inverse_layer) { |
| 152 inverse_observer_->AddInverselyAnimatedLayer(inverse_layer); | 152 inverse_observer_->AddInverselyAnimatedLayer(inverse_layer); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace ui | 155 } // namespace ui |
| OLD | NEW |