Chromium Code Reviews| Index: webkit/media/android/webmediaplayer_impl_android.cc |
| diff --git a/webkit/media/android/webmediaplayer_impl_android.cc b/webkit/media/android/webmediaplayer_impl_android.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7150a8b00b9dd02dd67263ab321a5aa19ae9be8e |
| --- /dev/null |
| +++ b/webkit/media/android/webmediaplayer_impl_android.cc |
| @@ -0,0 +1,77 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "webkit/media/android/webmediaplayer_impl_android.h" |
| + |
| +#include "base/bind.h" |
| +#include "base/logging.h" |
| +#include "media/base/android/media_player_bridge.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.h" |
| +#include "webkit/media/android/stream_texture_factory_android.h" |
| +#include "webkit/media/android/webmediaplayer_manager_android.h" |
| +#include "webkit/media/android/webmediaplayer_proxy_android.h" |
| + |
| +using WebKit::WebMediaPlayerClient; |
| +using WebKit::WebMediaPlayer; |
| + |
| +namespace webkit_media { |
| + |
| +WebMediaPlayerImplAndroid::WebMediaPlayerImplAndroid( |
| + WebKit::WebFrame* frame, |
| + WebMediaPlayerClient* client, |
| + WebMediaPlayerManagerAndroid* manager, |
| + WebMediaPlayerProxyAndroid* proxy, |
| + StreamTextureFactory* factory) |
| + : WebMediaPlayerAndroid(client, manager, factory), |
| + frame_(frame), |
| + proxy_(proxy), |
| + current_time_(0) { |
| +} |
| + |
| +WebMediaPlayerImplAndroid::~WebMediaPlayerImplAndroid() { |
|
scherkus (not reviewing)
2012/09/10 12:19:08
{}
qinmin
2012/09/11 04:50:24
Done.
|
| +} |
| + |
| +void WebMediaPlayerImplAndroid::InitializeMediaPlayer(GURL url) { |
| + if (proxy_) |
| + proxy_->Initialize(player_id(), url.spec()); |
| + |
| + UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
| + UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
| +} |
| + |
| +void WebMediaPlayerImplAndroid::PlayInternal() { |
| + if (paused() && proxy_) |
| + proxy_->Start(player_id()); |
| +} |
| + |
| +void WebMediaPlayerImplAndroid::PauseInternal() { |
| + if (proxy_) |
| + proxy_->Pause(player_id()); |
| +} |
| + |
| +void WebMediaPlayerImplAndroid::SeekInternal(base::TimeDelta time) { |
| + if (proxy_) |
| + proxy_->Seek(player_id(), time); |
| +} |
| + |
| +float WebMediaPlayerImplAndroid::GetCurrentTimeInternal() const { |
| + return current_time_; |
| +} |
| + |
| +void WebMediaPlayerImplAndroid::ReleaseResourcesInternal() { |
| + if (proxy_) |
| + proxy_->ReleaseResources(player_id()); |
| +} |
| + |
| +void WebMediaPlayerImplAndroid::OnTimeUpdate(base::TimeDelta current_time) { |
| + current_time_ = static_cast<float>(current_time.InSecondsF()); |
| +} |
| + |
| +void WebMediaPlayerImplAndroid::Destroy() { |
| + proxy_->DestroyPlayer(player_id()); |
| + proxy_ = NULL; |
| +} |
| + |
| +} // namespace webkit_media |