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 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/browser/android/content_video_view.h" | 15 #include "content/browser/android/content_video_view.h" |
16 #include "content/browser/media/android/media_session_observer.h" | |
17 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
18 #include "content/common/media/media_player_messages_enums_android.h" | 17 #include "content/common/media/media_player_messages_enums_android.h" |
19 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
20 #include "media/base/android/media_player_android.h" | 19 #include "media/base/android/media_player_android.h" |
21 #include "media/base/android/media_player_manager.h" | 20 #include "media/base/android/media_player_manager.h" |
22 #include "media/base/android/media_url_interceptor.h" | 21 #include "media/base/android/media_url_interceptor.h" |
23 #include "ui/gfx/geometry/rect_f.h" | 22 #include "ui/gfx/geometry/rect_f.h" |
24 #include "url/gurl.h" | 23 #include "url/gurl.h" |
25 | 24 |
26 namespace media { | 25 namespace media { |
(...skipping 10 matching lines...) Expand all Loading... |
37 class ExternalVideoSurfaceContainer; | 36 class ExternalVideoSurfaceContainer; |
38 class RenderFrameHost; | 37 class RenderFrameHost; |
39 class WebContents; | 38 class WebContents; |
40 | 39 |
41 // This class manages all the MediaPlayerAndroid objects. | 40 // This class manages all the MediaPlayerAndroid objects. |
42 // It receives control operations from the the render process, and forwards | 41 // It receives control operations from the the render process, and forwards |
43 // them to corresponding MediaPlayerAndroid object. Callbacks from | 42 // them to corresponding MediaPlayerAndroid object. Callbacks from |
44 // MediaPlayerAndroid objects are converted to IPCs and then sent to the render | 43 // MediaPlayerAndroid objects are converted to IPCs and then sent to the render |
45 // process. | 44 // process. |
46 class CONTENT_EXPORT BrowserMediaPlayerManager | 45 class CONTENT_EXPORT BrowserMediaPlayerManager |
47 : public media::MediaPlayerManager, | 46 : public media::MediaPlayerManager { |
48 public MediaSessionObserver { | |
49 public: | 47 public: |
50 // Permits embedders to provide an extended version of the class. | 48 // Permits embedders to provide an extended version of the class. |
51 typedef BrowserMediaPlayerManager* (*Factory)(RenderFrameHost*); | 49 typedef BrowserMediaPlayerManager* (*Factory)(RenderFrameHost*); |
52 static void RegisterFactory(Factory factory); | 50 static void RegisterFactory(Factory factory); |
53 | 51 |
54 // Permits embedders to handle custom urls. | 52 // Permits embedders to handle custom urls. |
55 static void RegisterMediaUrlInterceptor( | 53 static void RegisterMediaUrlInterceptor( |
56 media::MediaUrlInterceptor* media_url_interceptor); | 54 media::MediaUrlInterceptor* media_url_interceptor); |
57 | 55 |
58 // Pass a java surface object to the MediaPlayerAndroid object | 56 // Pass a java surface object to the MediaPlayerAndroid object |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 media::MediaUrlInterceptor* GetMediaUrlInterceptor() override; | 102 media::MediaUrlInterceptor* GetMediaUrlInterceptor() override; |
105 media::MediaPlayerAndroid* GetFullscreenPlayer() override; | 103 media::MediaPlayerAndroid* GetFullscreenPlayer() override; |
106 media::MediaPlayerAndroid* GetPlayer(int player_id) override; | 104 media::MediaPlayerAndroid* GetPlayer(int player_id) override; |
107 bool RequestPlay(int player_id, base::TimeDelta duration) override; | 105 bool RequestPlay(int player_id, base::TimeDelta duration) override; |
108 #if defined(VIDEO_HOLE) | 106 #if defined(VIDEO_HOLE) |
109 void AttachExternalVideoSurface(int player_id, jobject surface); | 107 void AttachExternalVideoSurface(int player_id, jobject surface); |
110 void DetachExternalVideoSurface(int player_id); | 108 void DetachExternalVideoSurface(int player_id); |
111 void OnFrameInfoUpdated(); | 109 void OnFrameInfoUpdated(); |
112 #endif // defined(VIDEO_HOLE) | 110 #endif // defined(VIDEO_HOLE) |
113 | 111 |
114 // MediaSessionObserver overrides. | |
115 void OnSuspend(int player_id) override; | |
116 void OnResume(int player_id) override; | |
117 | |
118 // Message handlers. | 112 // Message handlers. |
119 virtual void OnEnterFullscreen(int player_id); | 113 virtual void OnEnterFullscreen(int player_id); |
120 virtual void OnInitialize( | 114 virtual void OnInitialize( |
121 const MediaPlayerHostMsg_Initialize_Params& media_player_params); | 115 const MediaPlayerHostMsg_Initialize_Params& media_player_params); |
122 virtual void OnStart(int player_id); | 116 virtual void OnStart(int player_id); |
123 virtual void OnSeek(int player_id, const base::TimeDelta& time); | 117 virtual void OnSeek(int player_id, const base::TimeDelta& time); |
124 virtual void OnPause(int player_id, bool is_media_related_action); | 118 virtual void OnPause(int player_id, bool is_media_related_action); |
125 virtual void OnSetVolume(int player_id, double volume); | 119 virtual void OnSetVolume(int player_id, double volume); |
126 virtual void OnSetPoster(int player_id, const GURL& poster); | 120 virtual void OnSetPoster(int player_id, const GURL& poster); |
127 virtual void OnReleaseResources(int player_id); | 121 virtual void OnReleaseResources(int player_id); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 222 |
229 // NOTE: Weak pointers must be invalidated before all other member variables. | 223 // NOTE: Weak pointers must be invalidated before all other member variables. |
230 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 224 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
231 | 225 |
232 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 226 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
233 }; | 227 }; |
234 | 228 |
235 } // namespace content | 229 } // namespace content |
236 | 230 |
237 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 231 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
OLD | NEW |