OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/animation_registrar.h" |
| 6 |
| 7 #include "cc/layer_animation_controller.h" |
| 8 |
| 9 namespace cc { |
| 10 |
| 11 AnimationRegistrar::AnimationRegistrar() { } |
| 12 AnimationRegistrar::~AnimationRegistrar() { } |
| 13 |
| 14 scoped_refptr<LayerAnimationController> |
| 15 AnimationRegistrar::GetAnimationControllerForId(int id) |
| 16 { |
| 17 scoped_refptr<LayerAnimationController> toReturn; |
| 18 if (!ContainsKey(all_animation_controllers_, id)) { |
| 19 toReturn = LayerAnimationController::create(id); |
| 20 toReturn->setAnimationRegistrar(this); |
| 21 all_animation_controllers_[id] = toReturn.get(); |
| 22 } else |
| 23 toReturn = all_animation_controllers_[id]; |
| 24 return toReturn; |
| 25 } |
| 26 |
| 27 void AnimationRegistrar::DidActivateAnimationController(LayerAnimationController
* controller) { |
| 28 active_animation_controllers_[controller->id()] = controller; |
| 29 } |
| 30 |
| 31 void AnimationRegistrar::DidDeactivateAnimationController(LayerAnimationControll
er* controller) { |
| 32 if (ContainsKey(active_animation_controllers_, controller->id())) |
| 33 active_animation_controllers_.erase(controller->id()); |
| 34 } |
| 35 |
| 36 void AnimationRegistrar::RegisterAnimationController(LayerAnimationController* c
ontroller) { |
| 37 all_animation_controllers_[controller->id()] = controller; |
| 38 } |
| 39 |
| 40 void AnimationRegistrar::UnregisterAnimationController(LayerAnimationController*
controller) { |
| 41 if (ContainsKey(all_animation_controllers_, controller->id())) |
| 42 all_animation_controllers_.erase(controller->id()); |
| 43 DidDeactivateAnimationController(controller); |
| 44 } |
| 45 |
| 46 } // namespace cc |
OLD | NEW |