OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/blink/web_compositor_animation_player_impl.h" |
| 6 |
| 7 #include "cc/animation/animation_id_provider.h" |
| 8 #include "cc/animation/animation_player.h" |
| 9 #include "cc/blink/web_animation_impl.h" |
| 10 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" |
| 11 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 12 |
| 13 using cc::AnimationPlayer; |
| 14 |
| 15 namespace cc_blink { |
| 16 |
| 17 WebCompositorAnimationPlayerImpl::WebCompositorAnimationPlayerImpl() |
| 18 : animation_player_( |
| 19 AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId())) { |
| 20 } |
| 21 |
| 22 WebCompositorAnimationPlayerImpl::~WebCompositorAnimationPlayerImpl() { |
| 23 } |
| 24 |
| 25 CC_BLINK_EXPORT cc::AnimationPlayer* |
| 26 WebCompositorAnimationPlayerImpl::animation_player() const { |
| 27 return animation_player_.get(); |
| 28 } |
| 29 |
| 30 void WebCompositorAnimationPlayerImpl::setAnimationDelegate( |
| 31 blink::WebCompositorAnimationDelegate* delegate) { |
| 32 animation_delegate_adapter_.reset( |
| 33 new WebToCCAnimationDelegateAdapter(delegate)); |
| 34 animation_player_->set_layer_animation_delegate( |
| 35 animation_delegate_adapter_.get()); |
| 36 } |
| 37 |
| 38 void WebCompositorAnimationPlayerImpl::attachLayer(blink::WebLayer* web_layer) { |
| 39 animation_player_->AttachLayer(web_layer->id()); |
| 40 } |
| 41 |
| 42 void WebCompositorAnimationPlayerImpl::detachLayer() { |
| 43 animation_player_->DetachLayer(); |
| 44 } |
| 45 |
| 46 bool WebCompositorAnimationPlayerImpl::isLayerAttached() const { |
| 47 return animation_player_->layer_id() != 0; |
| 48 } |
| 49 |
| 50 void WebCompositorAnimationPlayerImpl::addAnimation( |
| 51 blink::WebCompositorAnimation* animation) { |
| 52 animation_player_->AddAnimation( |
| 53 static_cast<WebCompositorAnimationImpl*>(animation)->PassAnimation()); |
| 54 delete animation; |
| 55 } |
| 56 |
| 57 void WebCompositorAnimationPlayerImpl::removeAnimation(int animation_id) { |
| 58 animation_player_->RemoveAnimation(animation_id); |
| 59 } |
| 60 |
| 61 void WebCompositorAnimationPlayerImpl::pauseAnimation(int animation_id, |
| 62 double time_offset) { |
| 63 animation_player_->PauseAnimation(animation_id, time_offset); |
| 64 } |
| 65 |
| 66 } // namespace cc_blink |
OLD | NEW |