Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: webkit/media/android/webmediaplayer_impl_android.cc

Issue 10919075: Move android mediaplayer from render process to browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "webkit/media/android/webmediaplayer_impl_android.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "media/base/android/media_player_bridge.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h"
12 #include "webkit/media/android/stream_texture_factory_android.h"
13 #include "webkit/media/android/webmediaplayer_manager_android.h"
14 #include "webkit/media/android/webmediaplayer_proxy_android.h"
15
16 using WebKit::WebMediaPlayerClient;
17 using WebKit::WebMediaPlayer;
18
19 namespace webkit_media {
20
21 WebMediaPlayerImplAndroid::WebMediaPlayerImplAndroid(
22 WebKit::WebFrame* frame,
23 WebMediaPlayerClient* client,
24 WebMediaPlayerManagerAndroid* manager,
25 WebMediaPlayerProxyAndroid* proxy,
26 StreamTextureFactory* factory)
27 : WebMediaPlayerAndroid(client, manager, factory),
28 frame_(frame),
29 proxy_(proxy),
30 current_time_(0) {
31 }
32
33 WebMediaPlayerImplAndroid::~WebMediaPlayerImplAndroid() {
34 }
35
36 void WebMediaPlayerImplAndroid::InitializeMediaPlayer(GURL url) {
37 if (proxy_)
38 proxy_->Initialize(player_id(), url.spec());
39
40 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading);
41 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing);
42 }
43
44 void WebMediaPlayerImplAndroid::PlayInternal() {
45 if (paused() && proxy_)
46 proxy_->Start(player_id());
47 }
48
49 void WebMediaPlayerImplAndroid::PauseInternal() {
50 if (proxy_)
51 proxy_->Pause(player_id());
52 }
53
54 void WebMediaPlayerImplAndroid::SeekInternal(base::TimeDelta time) {
55 if (proxy_)
56 proxy_->Seek(player_id(), time);
57 }
58
59 float WebMediaPlayerImplAndroid::GetCurrentTimeInternal() const {
60 return current_time_;
61 }
62
63 void WebMediaPlayerImplAndroid::ReleaseResourcesInternal() {
64 if (proxy_)
65 proxy_->ReleaseResources(player_id());
66 }
67
68 void WebMediaPlayerImplAndroid::OnTimeUpdate(base::TimeDelta current_time) {
69 current_time_ = static_cast<float>(current_time.InSecondsF());
70 }
71
72 void WebMediaPlayerImplAndroid::Destroy() {
73 proxy_->DestroyPlayer(player_id());
74 proxy_ = NULL;
75 }
76
77 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698