Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 // Construct a InProcessCookieGetter object from a WebCookieJar. | |
|
scherkus (not reviewing)
2012/09/11 11:56:25
s/a/an/
qinmin
2012/09/12 23:12:52
Done.
| |
| 40 InProcessCookieGetter( | |
| 41 WebKit::WebFrame* frame, | |
| 42 WebKit::WebCookieJar* cookie_jar); | |
| 43 virtual ~InProcessCookieGetter(); | |
| 44 | |
| 45 // media::CookieGetter implementation. | |
| 46 virtual void GetCookies( | |
| 47 const std::string& url, | |
| 48 const media::CookieGetter::GetCookieCB& callback) OVERRIDE; | |
| 49 | |
| 50 private: | |
| 51 WebKit::WebFrame* frame_; | |
| 52 WebKit::WebCookieJar* cookie_jar_; | |
| 53 DISALLOW_COPY_AND_ASSIGN(InProcessCookieGetter); | |
| 54 }; | |
| 55 | |
| 56 // This class implements WebKit::WebMediaPlayer by keeping the android | |
| 57 // mediaplayer in the render process. This mode is being deprecated | |
| 58 // as mediaplayer is going to be moved to the browser process. | |
| 59 class WebMediaPlayerInProcessAndroid : public WebMediaPlayerAndroid { | |
| 60 public: | |
| 61 // Construct a WebMediaPlayerInProcessAndroid object. | |
| 62 WebMediaPlayerInProcessAndroid( | |
| 63 WebKit::WebFrame* frame, | |
| 64 WebKit::WebMediaPlayerClient* client, | |
| 65 WebKit::WebCookieJar* cookie_jar, | |
| 66 WebMediaPlayerManagerAndroid* manager, | |
| 67 media::MediaPlayerBridgeManager* resource_manager, | |
| 68 StreamTextureFactory* factory, | |
| 69 bool disable_media_history_logging); | |
| 70 virtual ~WebMediaPlayerInProcessAndroid(); | |
| 71 | |
| 72 // Getters of playback state. | |
| 73 virtual bool paused() const; | |
| 74 | |
| 75 // Callbacks from media::MediaPlayerBridge to WebMediaPlayerInProcessAndroid. | |
| 76 void MediaErrorCallback(int player_id, int error_type); | |
| 77 void VideoSizeChangedCallback(int player_id, int width, int height); | |
| 78 void BufferingUpdateCallback(int player_id, int percent); | |
| 79 void PlaybackCompleteCallback(int player_id); | |
| 80 void SeekCompleteCallback(int player_id, base::TimeDelta current_time); | |
| 81 void MediaPreparedCallback(int player_id, base::TimeDelta duration); | |
| 82 void TimeUpdateCallback(int player_id, base::TimeDelta current_time) {} | |
| 83 | |
| 84 // WebMediaPlayerAndroid implementation. | |
| 85 virtual void SetVideoSurface(jobject j_surface) OVERRIDE; | |
| 86 virtual void OnTimeUpdate(base::TimeDelta current_time) OVERRIDE {} | |
|
scherkus (not reviewing)
2012/09/11 11:56:25
de-inline
qinmin
2012/09/12 23:12:52
Done.
| |
| 87 | |
| 88 private: | |
| 89 // Methods inherited from WebMediaPlayerAndroid. | |
| 90 virtual void InitializeMediaPlayer(GURL url) OVERRIDE; | |
| 91 virtual void PlayInternal() OVERRIDE; | |
| 92 virtual void PauseInternal() OVERRIDE; | |
| 93 virtual void SeekInternal(base::TimeDelta time) OVERRIDE; | |
| 94 virtual float GetCurrentTimeInternal() const OVERRIDE; | |
| 95 virtual void ReleaseResourcesInternal() OVERRIDE; | |
| 96 virtual void Destroy() OVERRIDE {} | |
|
scherkus (not reviewing)
2012/09/11 11:56:25
de-inline
qinmin
2012/09/12 23:12:52
Done.
| |
| 97 | |
| 98 WebKit::WebFrame* const frame_; | |
| 99 | |
| 100 // Bridge to the android media player. | |
| 101 scoped_ptr<media::MediaPlayerBridge> media_player_; | |
| 102 | |
| 103 // Whether playback has completed. | |
| 104 float playback_completed_; | |
| 105 | |
| 106 // Pointer to the cookie jar to get the cookie for the media url. | |
| 107 WebKit::WebCookieJar* cookie_jar_; | |
| 108 | |
| 109 // Manager for managing all the hardware player resources. | |
| 110 media::MediaPlayerBridgeManager* resource_manager_; | |
| 111 | |
| 112 // Whether we should disable history logging. | |
| 113 bool disable_history_logging_; | |
| 114 | |
| 115 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerInProcessAndroid); | |
| 116 }; | |
| 117 | |
| 118 } // namespace webkit_media | |
| 119 | |
| 120 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_IN_PROCESS_ANDROID_H_ | |
| OLD | NEW |