| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/gfx/rect_f.h" | 23 #include "ui/gfx/rect_f.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 class DemuxerAndroid; | 27 class DemuxerAndroid; |
| 28 class MediaDrmBridge; | 28 class MediaDrmBridge; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace content { | 31 namespace content { |
| 32 class BrowserDemuxerAndroid; | 32 class BrowserDemuxerAndroid; |
| 33 class ContentViewCoreImpl; |
| 33 class WebContents; | 34 class WebContents; |
| 34 | 35 |
| 35 // This class manages all the MediaPlayerAndroid objects. It receives | 36 // This class manages all the MediaPlayerAndroid objects. It receives |
| 36 // control operations from the the render process, and forwards | 37 // control operations from the the render process, and forwards |
| 37 // them to corresponding MediaPlayerAndroid object. Callbacks from | 38 // them to corresponding MediaPlayerAndroid object. Callbacks from |
| 38 // MediaPlayerAndroid objects are converted to IPCs and then sent to the | 39 // MediaPlayerAndroid objects are converted to IPCs and then sent to the |
| 39 // render process. | 40 // render process. |
| 40 class CONTENT_EXPORT BrowserMediaPlayerManager | 41 class CONTENT_EXPORT BrowserMediaPlayerManager |
| 41 : public WebContentsObserver, | 42 : public WebContentsObserver, |
| 42 public media::MediaPlayerManager { | 43 public media::MediaPlayerManager { |
| 43 public: | 44 public: |
| 44 // Permits embedders to provide an extended version of the class. | 45 // Permits embedders to provide an extended version of the class. |
| 45 typedef BrowserMediaPlayerManager* (*Factory)(RenderViewHost*); | 46 typedef BrowserMediaPlayerManager* (*Factory)(RenderViewHost*); |
| 46 static void RegisterFactory(Factory factory); | 47 static void RegisterFactory(Factory factory); |
| 47 | 48 |
| 48 // Returns a new instance using the registered factory if available. | 49 // Returns a new instance using the registered factory if available. |
| 49 static BrowserMediaPlayerManager* Create(RenderViewHost* rvh); | 50 static BrowserMediaPlayerManager* Create(RenderViewHost* rvh); |
| 50 | 51 |
| 52 ContentViewCoreImpl* GetContentViewCore() const; |
| 53 |
| 51 virtual ~BrowserMediaPlayerManager(); | 54 virtual ~BrowserMediaPlayerManager(); |
| 52 | 55 |
| 53 // WebContentsObserver overrides. | 56 // WebContentsObserver overrides. |
| 54 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 55 | 58 |
| 56 // Fullscreen video playback controls. | 59 // Fullscreen video playback controls. |
| 57 virtual void FullscreenPlayerPlay(); | 60 virtual void FullscreenPlayerPlay(); |
| 58 virtual void FullscreenPlayerPause(); | 61 virtual void FullscreenPlayerPause(); |
| 59 virtual void FullscreenPlayerSeek(int msec); | 62 virtual void FullscreenPlayerSeek(int msec); |
| 60 virtual void ExitFullscreen(bool release_media_player); | 63 virtual void ExitFullscreen(bool release_media_player); |
| 61 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface); | 64 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface); |
| 65 virtual void SuspendFullscreen(); |
| 66 virtual void ResumeFullscreen(gfx::ScopedJavaSurface surface); |
| 62 | 67 |
| 63 // Called when browser player wants the renderer media element to seek. | 68 // Called when browser player wants the renderer media element to seek. |
| 64 // Any actual seek started by renderer will be handled by browser in OnSeek(). | 69 // Any actual seek started by renderer will be handled by browser in OnSeek(). |
| 65 void OnSeekRequest(int player_id, const base::TimeDelta& time_to_seek); | 70 void OnSeekRequest(int player_id, const base::TimeDelta& time_to_seek); |
| 66 | 71 |
| 67 // media::MediaPlayerManager overrides. | 72 // media::MediaPlayerManager overrides. |
| 68 virtual void OnTimeUpdate( | 73 virtual void OnTimeUpdate( |
| 69 int player_id, base::TimeDelta current_time) OVERRIDE; | 74 int player_id, base::TimeDelta current_time) OVERRIDE; |
| 70 virtual void OnMediaMetadataChanged( | 75 virtual void OnMediaMetadataChanged( |
| 71 int player_id, | 76 int player_id, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // The fullscreen video view object or NULL if video is not played in | 217 // The fullscreen video view object or NULL if video is not played in |
| 213 // fullscreen. | 218 // fullscreen. |
| 214 scoped_ptr<ContentVideoView> video_view_; | 219 scoped_ptr<ContentVideoView> video_view_; |
| 215 | 220 |
| 216 // Player ID of the fullscreen media player. | 221 // Player ID of the fullscreen media player. |
| 217 int fullscreen_player_id_; | 222 int fullscreen_player_id_; |
| 218 | 223 |
| 219 // The player ID pending to enter fullscreen. | 224 // The player ID pending to enter fullscreen. |
| 220 int pending_fullscreen_player_id_; | 225 int pending_fullscreen_player_id_; |
| 221 | 226 |
| 222 // Whether the fullscreen player has been Release()-d. | |
| 223 bool fullscreen_player_is_released_; | |
| 224 | |
| 225 WebContents* web_contents_; | 227 WebContents* web_contents_; |
| 226 | 228 |
| 227 // Object for retrieving resources media players. | 229 // Object for retrieving resources media players. |
| 228 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; | 230 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; |
| 229 | 231 |
| 230 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 232 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
| 231 | 233 |
| 232 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 234 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
| 233 }; | 235 }; |
| 234 | 236 |
| 235 } // namespace content | 237 } // namespace content |
| 236 | 238 |
| 237 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 239 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
| OLD | NEW |