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

Side by Side Diff: webkit/media/android/webmediaplayer_in_process_android.h

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 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_IN_PROCESS_ANDROID_H_
6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_IN_PROCESS_ANDROID_H_
7
8 #include <string>
9
10 #include <jni.h>
11
12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "media/base/android/cookie_getter.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
19 #include "webkit/media/android/webmediaplayer_android.h"
20
21 namespace WebKit {
22 class WebCookieJar;
23 class WebFrame;
24 }
25
26 namespace media {
27 class MediaPlayerBridge;
28 class MediaPlayerBridgeManager;
29 }
30
31 namespace webkit_media {
32
33 class StreamTextureFactory;
34 class WebMediaPlayerManagerAndroid;
35
36 // Class for retrieving the cookies from WebCookieJar.
37 class InProcessCookieGetter : public media::CookieGetter {
38 public:
39 explicit InProcessCookieGetter(WebKit::WebFrame* frame,
scherkus (not reviewing) 2012/09/10 12:19:08 remove explicit
qinmin 2012/09/11 04:50:24 Done.
40 WebKit::WebCookieJar* cookie_jar);
41 virtual ~InProcessCookieGetter();
42
43 // media::CookieGetter implementation.
44 virtual void GetCookies(const std::string& url,
45 const media::CookieGetter::GetCookieCB& callback) OVERRIDE;
scherkus (not reviewing) 2012/09/10 12:19:08 fix indent here -- perhaps url param should go on
qinmin 2012/09/11 04:50:24 Done.
46
47 private:
48 WebKit::WebFrame* frame_;
49 WebKit::WebCookieJar* cookie_jar_;
50 DISALLOW_COPY_AND_ASSIGN(InProcessCookieGetter);
51 };
52
53 // This class implements WebKit::WebMediaPlayer by keeping the android
54 // mediaplayer in the render process. This mode is being deprecated
55 // as mediaplayer is going to be moved to the browser process.
56 class WebMediaPlayerInProcessAndroid : public WebMediaPlayerAndroid {
57 public:
58 WebMediaPlayerInProcessAndroid(
59 WebKit::WebFrame* frame,
60 WebKit::WebMediaPlayerClient* client,
61 WebKit::WebCookieJar* cookie_jar,
62 WebMediaPlayerManagerAndroid* manager,
63 media::MediaPlayerBridgeManager* resource_manager,
64 StreamTextureFactory* factory,
65 bool disable_media_history_logging);
66 virtual ~WebMediaPlayerInProcessAndroid();
67
68 // Getters of playback state.
69 virtual bool paused() const;
70
71 // Callbacks from media::MediaPlayerBridge to WebMediaPlayerInProcessAndroid.
72 void MediaErrorCallback(int player_id, int error_type);
73 void VideoSizeChangedCallback(int player_id, int width, int height);
74 void BufferingUpdateCallback(int player_id, int percent);
75 void PlaybackCompleteCallback(int player_id);
76 void SeekCompleteCallback(int player_id, base::TimeDelta current_time);
77 void MediaPreparedCallback(int player_id, base::TimeDelta duration);
78 void TimeUpdateCallback(int player_id, base::TimeDelta current_time) {}
79
80 // Method to set the video surface for android media player.
81 virtual void SetVideoSurface(jobject j_surface) OVERRIDE;
82
83 private:
84 // Methods inherited from WebMediaPlayerAndroid.
85 virtual void InitializeMediaPlayer(GURL url) OVERRIDE;
86 virtual void PlayInternal() OVERRIDE;
87 virtual void PauseInternal() OVERRIDE;
88 virtual void SeekInternal(base::TimeDelta time) OVERRIDE;
89 virtual float GetCurrentTimeInternal() const OVERRIDE;
90 virtual void ReleaseResourcesInternal() OVERRIDE;
91
92 WebKit::WebFrame* const frame_;
93
94 // Bridge to the android media player.
95 scoped_ptr<media::MediaPlayerBridge> media_player_;
96
97 // Whether playback has completed.
98 float playback_completed_;
99
100 // Pointer to the cookie jar to get the cookie for the media url.
101 WebKit::WebCookieJar* cookie_jar_;
102
103 // Manager for managing all the hardware player resources.
104 media::MediaPlayerBridgeManager* resource_manager_;
105
106 // Whether we should disable history logging.
107 bool disable_history_logging_;
108
109 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerInProcessAndroid);
110 };
111
112 } // namespace webkit_media
113
114 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_IN_PROCESS_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698