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