Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 class MediaPlayerManagerImpl | 31 class MediaPlayerManagerImpl |
| 32 : public RenderViewHostObserver, | 32 : public RenderViewHostObserver, |
| 33 public media::MediaPlayerManager { | 33 public media::MediaPlayerManager { |
| 34 public: | 34 public: |
| 35 virtual ~MediaPlayerManagerImpl(); | 35 virtual ~MediaPlayerManagerImpl(); |
| 36 | 36 |
| 37 // RenderViewHostObserver overrides. | 37 // RenderViewHostObserver overrides. |
| 38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 39 | 39 |
| 40 // Fullscreen video playback controls. | 40 // Fullscreen video playback controls. |
| 41 void FullscreenPlayerPlay(); | 41 virtual void FullscreenPlayerPlay(); |
|
qinmin
2013/05/25 04:41:44
if you really need to override so many functions,
whywhat
2013/05/28 15:16:40
I only need to override a few of them but it feels
| |
| 42 void FullscreenPlayerPause(); | 42 virtual void FullscreenPlayerPause(); |
| 43 void FullscreenPlayerSeek(int msec); | 43 virtual void FullscreenPlayerSeek(int msec); |
| 44 void ExitFullscreen(bool release_media_player); | 44 virtual void ExitFullscreen(bool release_media_player); |
| 45 void SetVideoSurface(jobject surface); | 45 virtual void SetVideoSurface(jobject surface); |
| 46 | 46 |
| 47 // media::MediaPlayerManager overrides. | 47 // media::MediaPlayerManager overrides. |
| 48 virtual void OnTimeUpdate( | 48 virtual void OnTimeUpdate( |
| 49 int player_id, base::TimeDelta current_time) OVERRIDE; | 49 int player_id, base::TimeDelta current_time) OVERRIDE; |
| 50 virtual void OnMediaMetadataChanged( | 50 virtual void OnMediaMetadataChanged( |
| 51 int player_id, | 51 int player_id, |
| 52 base::TimeDelta duration, | 52 base::TimeDelta duration, |
| 53 int width, | 53 int width, |
| 54 int height, | 54 int height, |
| 55 bool success) OVERRIDE; | 55 bool success) OVERRIDE; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 80 #endif | 80 #endif |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 friend MediaPlayerManager* MediaPlayerManager::Create( | 83 friend MediaPlayerManager* MediaPlayerManager::Create( |
| 84 content::RenderViewHost*); | 84 content::RenderViewHost*); |
| 85 | 85 |
| 86 // The instance of this class is supposed to be created by either Create() | 86 // The instance of this class is supposed to be created by either Create() |
| 87 // method of MediaPlayerManager or the derived classes constructors. | 87 // method of MediaPlayerManager or the derived classes constructors. |
| 88 explicit MediaPlayerManagerImpl(RenderViewHost* render_view_host); | 88 explicit MediaPlayerManagerImpl(RenderViewHost* render_view_host); |
| 89 | 89 |
| 90 private: | |
| 91 // Message handlers. | 90 // Message handlers. |
| 92 void OnEnterFullscreen(int player_id); | 91 virtual void OnEnterFullscreen(int player_id); |
|
qinmin
2013/05/29 04:42:19
all these message handlers are now public just for
whywhat
2013/05/29 15:49:18
The handlers are protected, not public. Not only I
| |
| 93 void OnExitFullscreen(int player_id); | 92 virtual void OnExitFullscreen(int player_id); |
| 94 void OnInitialize(int player_id, const GURL& url, | 93 virtual void OnInitialize(int player_id, const GURL& url, |
| 95 bool is_media_source, | 94 bool is_media_source, |
|
qinmin
2013/05/29 04:42:19
fix indentation
whywhat
2013/05/29 15:49:18
Done.
| |
| 96 const GURL& first_party_for_cookies); | 95 const GURL& first_party_for_cookies); |
| 97 void OnStart(int player_id); | 96 virtual void OnStart(int player_id); |
| 98 void OnSeek(int player_id, base::TimeDelta time); | 97 virtual void OnSeek(int player_id, base::TimeDelta time); |
| 99 void OnPause(int player_id); | 98 virtual void OnPause(int player_id); |
| 100 void OnReleaseResources(int player_id); | 99 virtual void OnReleaseResources(int player_id); |
| 101 void OnDestroyPlayer(int player_id); | 100 virtual void OnDestroyPlayer(int player_id); |
| 102 void OnDemuxerReady( | 101 virtual void OnDemuxerReady( |
| 103 int player_id, | 102 int player_id, |
| 104 const media::MediaPlayerHostMsg_DemuxerReady_Params& params); | 103 const media::MediaPlayerHostMsg_DemuxerReady_Params& params); |
| 105 void OnReadFromDemuxerAck( | 104 virtual void OnReadFromDemuxerAck( |
| 106 int player_id, | 105 int player_id, |
| 107 const media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params); | 106 const media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params); |
| 108 | 107 |
| 109 #if defined(GOOGLE_TV) | 108 #if defined(GOOGLE_TV) |
| 110 void OnNotifyExternalSurface( | 109 virtual void OnNotifyExternalSurface( |
| 111 int player_id, bool is_request, const gfx::RectF& rect); | 110 int player_id, bool is_request, const gfx::RectF& rect); |
| 112 #endif | 111 #endif |
| 113 | 112 |
| 113 // Adds a given player to the list. | |
| 114 void AddPlayer(media::MediaPlayerAndroid* player); | |
| 115 | |
| 116 // Removes the player with the specified id. | |
| 117 void RemovePlayer(int player_id); | |
| 118 | |
| 119 private: | |
| 114 // An array of managed players. | 120 // An array of managed players. |
| 115 ScopedVector<media::MediaPlayerAndroid> players_; | 121 ScopedVector<media::MediaPlayerAndroid> players_; |
| 116 | 122 |
| 117 // The fullscreen video view object. | 123 // The fullscreen video view object. |
| 118 ContentVideoView video_view_; | 124 ContentVideoView video_view_; |
| 119 | 125 |
| 120 // Player ID of the fullscreen media player. | 126 // Player ID of the fullscreen media player. |
| 121 int fullscreen_player_id_; | 127 int fullscreen_player_id_; |
| 122 | 128 |
| 123 WebContents* web_contents_; | 129 WebContents* web_contents_; |
| 124 | 130 |
| 125 // Object for retrieving resources media players. | 131 // Object for retrieving resources media players. |
| 126 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; | 132 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; |
| 127 | 133 |
| 128 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerImpl); | 134 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerImpl); |
| 129 }; | 135 }; |
| 130 | 136 |
| 131 } // namespace content | 137 } // namespace content |
| 132 | 138 |
| 133 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ | 139 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ |
| OLD | NEW |