| 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 an InProcessCookieGetter object from a WebCookieJar. |
| 40 explicit InProcessCookieGetter(WebKit::WebCookieJar* cookie_jar); |
| 41 virtual ~InProcessCookieGetter(); |
| 42 |
| 43 // media::CookieGetter implementation. |
| 44 virtual void GetCookies(const std::string& url, |
| 45 const std::string& first_party_for_cookies, |
| 46 const GetCookieCB& callback) OVERRIDE; |
| 47 |
| 48 private: |
| 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 // Construct a WebMediaPlayerInProcessAndroid object. |
| 59 WebMediaPlayerInProcessAndroid( |
| 60 WebKit::WebFrame* frame, |
| 61 WebKit::WebMediaPlayerClient* client, |
| 62 WebKit::WebCookieJar* cookie_jar, |
| 63 WebMediaPlayerManagerAndroid* manager, |
| 64 media::MediaPlayerBridgeManager* resource_manager, |
| 65 StreamTextureFactory* factory, |
| 66 bool disable_media_history_logging); |
| 67 virtual ~WebMediaPlayerInProcessAndroid(); |
| 68 |
| 69 // Getters of playback state. |
| 70 virtual bool paused() const; |
| 71 |
| 72 // Callbacks from media::MediaPlayerBridge to WebMediaPlayerInProcessAndroid. |
| 73 void MediaErrorCallback(int player_id, int error_type); |
| 74 void VideoSizeChangedCallback(int player_id, int width, int height); |
| 75 void BufferingUpdateCallback(int player_id, int percent); |
| 76 void PlaybackCompleteCallback(int player_id); |
| 77 void SeekCompleteCallback(int player_id, base::TimeDelta current_time); |
| 78 void MediaPreparedCallback(int player_id, base::TimeDelta duration); |
| 79 void TimeUpdateCallback(int player_id, base::TimeDelta current_time) {} |
| 80 |
| 81 // WebMediaPlayerAndroid implementation. |
| 82 virtual void SetVideoSurface(jobject j_surface) OVERRIDE; |
| 83 virtual void OnTimeUpdate(base::TimeDelta current_time) OVERRIDE; |
| 84 |
| 85 private: |
| 86 // Methods inherited from WebMediaPlayerAndroid. |
| 87 virtual void InitializeMediaPlayer(GURL url) OVERRIDE; |
| 88 virtual void PlayInternal() OVERRIDE; |
| 89 virtual void PauseInternal() OVERRIDE; |
| 90 virtual void SeekInternal(base::TimeDelta time) OVERRIDE; |
| 91 virtual float GetCurrentTimeInternal() const OVERRIDE; |
| 92 virtual void ReleaseResourcesInternal() OVERRIDE; |
| 93 virtual void Destroy() OVERRIDE; |
| 94 |
| 95 WebKit::WebFrame* const frame_; |
| 96 |
| 97 // Bridge to the android media player. |
| 98 scoped_ptr<media::MediaPlayerBridge> media_player_; |
| 99 |
| 100 // Whether playback has completed. |
| 101 float playback_completed_; |
| 102 |
| 103 // Pointer to the cookie jar to get the cookie for the media url. |
| 104 WebKit::WebCookieJar* cookie_jar_; |
| 105 |
| 106 // Manager for managing all the hardware player resources. |
| 107 media::MediaPlayerBridgeManager* resource_manager_; |
| 108 |
| 109 // Whether we should disable history logging. |
| 110 bool disable_history_logging_; |
| 111 |
| 112 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerInProcessAndroid); |
| 113 }; |
| 114 |
| 115 } // namespace webkit_media |
| 116 |
| 117 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_IN_PROCESS_ANDROID_H_ |
| OLD | NEW |