| 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_IMPL_ANDROID_H_ |
| 6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_IMPL_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 "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 18 #include "webkit/media/android/webmediaplayer_android.h" |
| 19 |
| 20 namespace WebKit { |
| 21 class WebFrame; |
| 22 } |
| 23 |
| 24 namespace webkit_media { |
| 25 |
| 26 class StreamTextureFactory; |
| 27 class WebMediaPlayerManagerAndroid; |
| 28 class WebMediaPlayerProxyAndroid; |
| 29 |
| 30 // This class implements WebKit::WebMediaPlayer by keeping the android |
| 31 // media player in the browser process. It listens to all the status changes |
| 32 // sent from the browser process and sends playback controls to the media |
| 33 // player. |
| 34 class WebMediaPlayerImplAndroid : public WebMediaPlayerAndroid { |
| 35 public: |
| 36 // Construct a WebMediaPlayerImplAndroid object. This class communicates |
| 37 // with the MediaPlayerBridge object in the browser process through |
| 38 // |proxy|. |
| 39 // TODO(qinmin): |frame| argument is used to determine whether the current |
| 40 // player can enter fullscreen. |
| 41 WebMediaPlayerImplAndroid(WebKit::WebFrame* frame, |
| 42 WebKit::WebMediaPlayerClient* client, |
| 43 WebMediaPlayerManagerAndroid* manager, |
| 44 WebMediaPlayerProxyAndroid* proxy, |
| 45 StreamTextureFactory* factory); |
| 46 virtual ~WebMediaPlayerImplAndroid(); |
| 47 |
| 48 // WebMediaPlayerAndroid implementation. |
| 49 virtual void OnTimeUpdate(base::TimeDelta current_time) OVERRIDE; |
| 50 virtual void SetVideoSurface(jobject j_surface) OVERRIDE; |
| 51 |
| 52 private: |
| 53 // Methods inherited from WebMediaPlayerAndroid. |
| 54 virtual void InitializeMediaPlayer(GURL url) OVERRIDE; |
| 55 virtual void PlayInternal() OVERRIDE; |
| 56 virtual void PauseInternal() OVERRIDE; |
| 57 virtual void SeekInternal(base::TimeDelta time) OVERRIDE; |
| 58 virtual float GetCurrentTimeInternal() const OVERRIDE; |
| 59 virtual void ReleaseResourcesInternal() OVERRIDE; |
| 60 virtual void Destroy() OVERRIDE; |
| 61 |
| 62 WebKit::WebFrame* const frame_; |
| 63 |
| 64 // Proxy object that delegates method calls on Render Thread. |
| 65 // This object is created on the Render Thread and is only called in the |
| 66 // destructor. |
| 67 WebMediaPlayerProxyAndroid* proxy_; |
| 68 |
| 69 // The current playing time. Because the mediaplayer is in the browser |
| 70 // process, it will regularly update the |current_time_| by calling |
| 71 // OnTimeUpdate(). |
| 72 float current_time_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImplAndroid); |
| 75 }; |
| 76 |
| 77 } // namespace webkit_media |
| 78 |
| 79 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_IMPL_ANDROID_H_ |
| OLD | NEW |