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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "content/browser/android/content_video_view.h" | 13 #include "content/browser/android/content_video_view.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/common/media/media_player_messages_enums_android.h" | 15 #include "content/common/media/media_player_messages_enums_android.h" |
16 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
17 #include "media/base/android/media_player_android.h" | 17 #include "media/base/android/media_player_android.h" |
18 #include "media/base/android/media_player_manager.h" | 18 #include "media/base/android/media_player_manager.h" |
| 19 #include "media/base/android/media_url_interceptor.h" |
19 #include "ui/gfx/rect_f.h" | 20 #include "ui/gfx/rect_f.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 namespace media { | 23 namespace media { |
23 class DemuxerAndroid; | 24 class DemuxerAndroid; |
24 } | 25 } |
25 | 26 |
26 struct MediaPlayerHostMsg_Initialize_Params; | 27 struct MediaPlayerHostMsg_Initialize_Params; |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 class BrowserDemuxerAndroid; | 30 class BrowserDemuxerAndroid; |
30 class ContentViewCoreImpl; | 31 class ContentViewCoreImpl; |
31 class ExternalVideoSurfaceContainer; | 32 class ExternalVideoSurfaceContainer; |
32 class RenderFrameHost; | 33 class RenderFrameHost; |
33 class WebContents; | 34 class WebContents; |
34 | 35 |
35 // This class manages all the MediaPlayerAndroid objects. | 36 // This class manages all the MediaPlayerAndroid objects. |
36 // It receives control operations from the the render process, and forwards | 37 // It receives 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 render | 39 // MediaPlayerAndroid objects are converted to IPCs and then sent to the render |
39 // process. | 40 // process. |
40 class CONTENT_EXPORT BrowserMediaPlayerManager | 41 class CONTENT_EXPORT BrowserMediaPlayerManager |
41 : public media::MediaPlayerManager { | 42 : public media::MediaPlayerManager { |
42 public: | 43 public: |
43 // Permits embedders to provide an extended version of the class. | 44 // Permits embedders to provide an extended version of the class. |
44 typedef BrowserMediaPlayerManager* (*Factory)(RenderFrameHost*); | 45 typedef BrowserMediaPlayerManager* (*Factory)(RenderFrameHost*); |
45 static void RegisterFactory(Factory factory); | 46 static void RegisterFactory(Factory factory); |
46 | 47 |
| 48 // Permits embedders to handle custom urls. |
| 49 static void RegisterMediaUrlInterceptor( |
| 50 media::MediaUrlInterceptor* media_url_interceptor); |
| 51 |
47 // Returns a new instance using the registered factory if available. | 52 // Returns a new instance using the registered factory if available. |
48 static BrowserMediaPlayerManager* Create(RenderFrameHost* rfh); | 53 static BrowserMediaPlayerManager* Create(RenderFrameHost* rfh); |
49 | 54 |
50 ContentViewCoreImpl* GetContentViewCore() const; | 55 ContentViewCoreImpl* GetContentViewCore() const; |
51 | 56 |
52 virtual ~BrowserMediaPlayerManager(); | 57 virtual ~BrowserMediaPlayerManager(); |
53 | 58 |
54 // Fullscreen video playback controls. | 59 // Fullscreen video playback controls. |
55 virtual void FullscreenPlayerPlay(); | 60 virtual void FullscreenPlayerPlay(); |
56 virtual void FullscreenPlayerPause(); | 61 virtual void FullscreenPlayerPause(); |
(...skipping 20 matching lines...) Expand all Loading... |
77 virtual void OnPlaybackComplete(int player_id) OVERRIDE; | 82 virtual void OnPlaybackComplete(int player_id) OVERRIDE; |
78 virtual void OnMediaInterrupted(int player_id) OVERRIDE; | 83 virtual void OnMediaInterrupted(int player_id) OVERRIDE; |
79 virtual void OnBufferingUpdate(int player_id, int percentage) OVERRIDE; | 84 virtual void OnBufferingUpdate(int player_id, int percentage) OVERRIDE; |
80 virtual void OnSeekComplete( | 85 virtual void OnSeekComplete( |
81 int player_id, | 86 int player_id, |
82 const base::TimeDelta& current_time) OVERRIDE; | 87 const base::TimeDelta& current_time) OVERRIDE; |
83 virtual void OnError(int player_id, int error) OVERRIDE; | 88 virtual void OnError(int player_id, int error) OVERRIDE; |
84 virtual void OnVideoSizeChanged( | 89 virtual void OnVideoSizeChanged( |
85 int player_id, int width, int height) OVERRIDE; | 90 int player_id, int width, int height) OVERRIDE; |
86 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; | 91 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; |
| 92 virtual media::MediaUrlInterceptor* GetMediaUrlInterceptor() OVERRIDE; |
87 virtual media::MediaPlayerAndroid* GetFullscreenPlayer() OVERRIDE; | 93 virtual media::MediaPlayerAndroid* GetFullscreenPlayer() OVERRIDE; |
88 virtual media::MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE; | 94 virtual media::MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE; |
89 virtual void RequestFullScreen(int player_id) OVERRIDE; | 95 virtual void RequestFullScreen(int player_id) OVERRIDE; |
90 #if defined(VIDEO_HOLE) | 96 #if defined(VIDEO_HOLE) |
91 virtual bool ShouldUseVideoOverlayForEmbeddedEncryptedVideo() OVERRIDE; | 97 virtual bool ShouldUseVideoOverlayForEmbeddedEncryptedVideo() OVERRIDE; |
92 | 98 |
93 void AttachExternalVideoSurface(int player_id, jobject surface); | 99 void AttachExternalVideoSurface(int player_id, jobject surface); |
94 void DetachExternalVideoSurface(int player_id); | 100 void DetachExternalVideoSurface(int player_id); |
95 void OnFrameInfoUpdated(); | 101 void OnFrameInfoUpdated(); |
96 #endif // defined(VIDEO_HOLE) | 102 #endif // defined(VIDEO_HOLE) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 192 |
187 // NOTE: Weak pointers must be invalidated before all other member variables. | 193 // NOTE: Weak pointers must be invalidated before all other member variables. |
188 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 194 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
189 | 195 |
190 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 196 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
191 }; | 197 }; |
192 | 198 |
193 } // namespace content | 199 } // namespace content |
194 | 200 |
195 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 201 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
OLD | NEW |