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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // The fullscreen video view object or NULL if video is not played in | 218 // The fullscreen video view object or NULL if video is not played in |
214 // fullscreen. | 219 // fullscreen. |
215 scoped_ptr<ContentVideoView> video_view_; | 220 scoped_ptr<ContentVideoView> video_view_; |
216 | 221 |
217 // Player ID of the fullscreen media player. | 222 // Player ID of the fullscreen media player. |
218 int fullscreen_player_id_; | 223 int fullscreen_player_id_; |
219 | 224 |
220 // The player ID pending to enter fullscreen. | 225 // The player ID pending to enter fullscreen. |
221 int pending_fullscreen_player_id_; | 226 int pending_fullscreen_player_id_; |
222 | 227 |
223 // Whether the fullscreen player has been Release()-d. | |
224 bool fullscreen_player_is_released_; | |
225 | |
226 WebContents* web_contents_; | 228 WebContents* web_contents_; |
227 | 229 |
228 // Object for retrieving resources media players. | 230 // Object for retrieving resources media players. |
229 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; | 231 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; |
230 | 232 |
231 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 233 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
232 | 234 |
233 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 235 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
234 }; | 236 }; |
235 | 237 |
236 } // namespace content | 238 } // namespace content |
237 | 239 |
238 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 240 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
OLD | NEW |