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_PROXY_ANDROID_H_ | |
| 6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 | |
| 10 namespace base { | |
| 11 class MessageLoopProxy; | |
| 12 } | |
| 13 | |
| 14 namespace webkit_media { | |
| 15 | |
| 16 class WebMediaPlayerAndroid; | |
| 17 | |
| 18 // Acts as a thread proxy between media::MediaPlayerBridge and | |
| 19 // WebMediaPlayerAndroid so that callbacks are posted onto the render thread. | |
| 20 class WebMediaPlayerProxyAndroid | |
| 21 : public base::RefCountedThreadSafe<WebMediaPlayerProxyAndroid> { | |
|
scherkus (not reviewing)
2012/04/17 03:57:31
AFAIK this class can be vastly simplified if WMPA
qinmin
2012/04/18 20:06:30
Done. SetWebMediaPlayer(NULL) actually can be call
| |
| 22 public: | |
| 23 WebMediaPlayerProxyAndroid( | |
| 24 const scoped_refptr<base::MessageLoopProxy>& render_loop); | |
| 25 | |
| 26 // Set the |webmediaplayer_| for callback. | |
| 27 void SetWebMediaPlayer(WebMediaPlayerAndroid* webmediaplayer); | |
| 28 | |
| 29 // Callbacks from media::MediaPlayerBridge to WebMediaPlayerAndroid. | |
| 30 void MediaErrorCallback(int error_type); | |
| 31 void MediaInfoCallback(int info_type); | |
| 32 void VideoSizeChangedCallback(int width, int height); | |
| 33 void BufferingUpdateCallback(int percent); | |
| 34 void PlaybackCompleteCallback(); | |
| 35 void SeekCompleteCallback(); | |
| 36 void MediaPreparedCallback(); | |
| 37 | |
| 38 private: | |
| 39 friend class base::RefCountedThreadSafe<WebMediaPlayerProxyAndroid>; | |
| 40 virtual ~WebMediaPlayerProxyAndroid(); | |
| 41 | |
| 42 // Notify |webmediaplayer_| that an error has occured. | |
| 43 void MediaErrorTask(int error_type); | |
| 44 | |
| 45 // Notify |webmediaplayer_| that some info has been received from | |
| 46 // media::MediaPlayerBridge. | |
| 47 void MediaInfoTask(int info_type); | |
| 48 | |
| 49 // Notify |webmediaplayer_| that the video size has changed. | |
| 50 void VideoSizeChangedTask(int width, int height); | |
| 51 | |
| 52 // Notify |webmediaplayer_| that an update in buffering has occured. | |
| 53 void BufferingUpdateTask(int percent); | |
| 54 | |
| 55 // Notify |webmediaplayer_| that playback has completed. | |
| 56 void PlaybackCompleteTask(); | |
| 57 | |
| 58 // Notify |webmediaplayer_| that seek has completed. | |
| 59 void SeekCompleteTask(); | |
| 60 | |
| 61 // Notify |webmediaplayer_| that media has been prepared successfully. | |
| 62 void MediaPreparedTask(); | |
| 63 | |
| 64 // The WebMediaPlayerAndroid object all the callbacks should be send to. | |
| 65 WebMediaPlayerAndroid* webmediaplayer_; | |
| 66 | |
| 67 // The render message loop where WebKit lives. | |
| 68 scoped_refptr<base::MessageLoopProxy> render_loop_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerProxyAndroid); | |
| 71 }; | |
| 72 | |
| 73 } // namespace webkit_media | |
| 74 | |
| 75 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_ | |
| OLD | NEW |