Chromium Code Reviews| Index: content/browser/media/android/browser_media_player_manager.h |
| diff --git a/content/browser/media/android/browser_media_player_manager.h b/content/browser/media/android/browser_media_player_manager.h |
| index 4a5ba6fb42c803467fb6683f5d9b7e092af4be0d..0e60186d7081084f60b36480c19d933fbc4a4833 100644 |
| --- a/content/browser/media/android/browser_media_player_manager.h |
| +++ b/content/browser/media/android/browser_media_player_manager.h |
| @@ -16,9 +16,10 @@ |
| #include "base/memory/scoped_vector.h" |
| #include "base/time/time.h" |
| #include "content/browser/android/content_video_view.h" |
| +#include "content/common/content_export.h" |
| #include "content/common/media/cdm_messages_enums.h" |
| #include "content/common/media/media_player_messages_enums_android.h" |
| -#include "content/public/browser/web_contents_observer.h" |
| +#include "ipc/ipc_message.h" |
| #include "media/base/android/media_player_android.h" |
| #include "media/base/android/media_player_manager.h" |
| #include "ui/gfx/rect_f.h" |
| @@ -33,6 +34,7 @@ namespace content { |
| class BrowserDemuxerAndroid; |
| class ContentViewCoreImpl; |
| class ExternalVideoSurfaceContainer; |
| +class RenderFrameHost; |
| class WebContents; |
| // This class manages all the MediaPlayerAndroid and CDM objects. |
| @@ -41,23 +43,19 @@ class WebContents; |
| // MediaPlayerAndroid and CDM objects are converted to IPCs and then sent to |
| // the render process. |
| class CONTENT_EXPORT BrowserMediaPlayerManager |
| - : public WebContentsObserver, |
| - public media::MediaPlayerManager { |
| + : public media::MediaPlayerManager { |
| public: |
| // Permits embedders to provide an extended version of the class. |
| - typedef BrowserMediaPlayerManager* (*Factory)(RenderViewHost*); |
| + typedef BrowserMediaPlayerManager* (*Factory)(RenderFrameHost*); |
| static void RegisterFactory(Factory factory); |
| // Returns a new instance using the registered factory if available. |
| - static BrowserMediaPlayerManager* Create(RenderViewHost* rvh); |
| + static BrowserMediaPlayerManager* Create(RenderFrameHost* rfh); |
| ContentViewCoreImpl* GetContentViewCore() const; |
| virtual ~BrowserMediaPlayerManager(); |
| - // WebContentsObserver overrides. |
| - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| - |
| // Fullscreen video playback controls. |
| virtual void FullscreenPlayerPlay(); |
| virtual void FullscreenPlayerPause(); |
| @@ -113,10 +111,6 @@ class CONTENT_EXPORT BrowserMediaPlayerManager |
| void OnFrameInfoUpdated(); |
| #endif // defined(VIDEO_HOLE) |
| - protected: |
| - // Clients must use Create() or subclass constructor. |
| - explicit BrowserMediaPlayerManager(RenderViewHost* render_view_host); |
| - |
| // Message handlers. |
| virtual void OnEnterFullscreen(int player_id); |
| virtual void OnExitFullscreen(int player_id); |
| @@ -148,6 +142,14 @@ class CONTENT_EXPORT BrowserMediaPlayerManager |
| void OnSetCdm(int player_id, int cdm_id); |
| void OnDestroyCdm(int cdm_id); |
| + protected: |
| + // Clients must use Create() or subclass constructor. |
| + explicit BrowserMediaPlayerManager(RenderFrameHost* render_frame_host); |
| + |
| + WebContents* web_contents() const { return web_contents_; } |
| + |
| + int routing_id() const { return routing_id_; } |
| + |
| // Cancels all pending session creations associated with |cdm_id|. |
| void CancelAllPendingSessionCreations(int cdm_id); |
| @@ -172,6 +174,9 @@ class CONTENT_EXPORT BrowserMediaPlayerManager |
| // Removes the CDM with the specified id. |
| void RemoveCdm(int cdm_id); |
| + // Helper function to send messages to RenderFrameObserver. |
| + bool Send(IPC::Message* msg); |
| + |
| private: |
| // If |permitted| is false, it does nothing but send |
| // |CdmMsg_SessionError| IPC message. |
| @@ -212,6 +217,9 @@ class CONTENT_EXPORT BrowserMediaPlayerManager |
| void OnRequestExternalSurface(int player_id, const gfx::RectF& rect); |
| #endif // defined(VIDEO_HOLE) |
| + RenderFrameHost* const render_frame_host_; |
| + const int routing_id_; |
|
jam
2014/05/20 00:34:49
nit: this is redundant since you can always get it
xhwang
2014/05/22 19:06:00
Done.
|
| + |
| // An array of managed players. |
| ScopedVector<media::MediaPlayerAndroid> players_; |
| @@ -241,7 +249,7 @@ class CONTENT_EXPORT BrowserMediaPlayerManager |
| // Whether the fullscreen player has been Release()-d. |
| bool fullscreen_player_is_released_; |
| - WebContents* web_contents_; |
| + WebContents* const web_contents_; |
| // Object for retrieving resources media players. |
| scoped_ptr<media::MediaResourceGetter> media_resource_getter_; |