| 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_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "content/browser/android/content_video_view.h" | 14 #include "content/browser/android/content_video_view.h" |
| 15 #include "content/public/browser/render_view_host_observer.h" | 15 #include "content/public/browser/render_view_host_observer.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #if defined(GOOGLE_TV) | 17 #if defined(GOOGLE_TV) |
| 18 #include "media/base/android/demuxer_stream_player_params.h" | 18 #include "media/base/android/demuxer_stream_player_params.h" |
| 19 #endif | 19 #endif |
| 20 #include "media/base/android/media_player_bridge.h" | 20 #include "media/base/android/media_player_bridge.h" |
| 21 #include "media/base/android/media_player_bridge_manager.h" | 21 #include "media/base/android/media_player_manager.h" |
| 22 #include "ui/gfx/rect_f.h" | 22 #include "ui/gfx/rect_f.h" |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 | 25 |
| 26 class WebContents; | 26 class WebContents; |
| 27 | 27 |
| 28 // This class manages all the MediaPlayerBridge objects. It receives | 28 // This class manages all the MediaPlayerBridge objects. It receives |
| 29 // control operations from the the render process, and forwards | 29 // control operations from the the render process, and forwards |
| 30 // them to corresponding MediaPlayerBridge object. Callbacks from | 30 // them to corresponding MediaPlayerBridge object. Callbacks from |
| 31 // MediaPlayerBridge objects are converted to IPCs and then sent to the | 31 // MediaPlayerBridge objects are converted to IPCs and then sent to the |
| 32 // render process. | 32 // render process. |
| 33 class MediaPlayerManagerAndroid | 33 class MediaPlayerManagerImpl |
| 34 : public RenderViewHostObserver, | 34 : public RenderViewHostObserver, |
| 35 public media::MediaPlayerBridgeManager { | 35 public media::MediaPlayerManager { |
| 36 public: | 36 public: |
| 37 // Create a MediaPlayerManagerAndroid object for the |render_view_host|. | 37 // Create a MediaPlayerManagerImpl object for the |render_view_host|. |
| 38 explicit MediaPlayerManagerAndroid(RenderViewHost* render_view_host); | 38 explicit MediaPlayerManagerImpl(RenderViewHost* render_view_host); |
| 39 virtual ~MediaPlayerManagerAndroid(); | 39 virtual ~MediaPlayerManagerImpl(); |
| 40 | 40 |
| 41 // RenderViewHostObserver overrides. | 41 // RenderViewHostObserver overrides. |
| 42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 43 | 43 |
| 44 // Fullscreen video playback controls. | 44 // Fullscreen video playback controls. |
| 45 void FullscreenPlayerPlay(); | 45 void FullscreenPlayerPlay(); |
| 46 void FullscreenPlayerPause(); | 46 void FullscreenPlayerPause(); |
| 47 void FullscreenPlayerSeek(int msec); | 47 void FullscreenPlayerSeek(int msec); |
| 48 void ExitFullscreen(bool release_media_player); | 48 void ExitFullscreen(bool release_media_player); |
| 49 void SetVideoSurface(jobject surface); | 49 void SetVideoSurface(jobject surface); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 #if defined(GOOGLE_TV) | 65 #if defined(GOOGLE_TV) |
| 66 // Callbacks needed by media::DemuxerStreamPlayer. | 66 // Callbacks needed by media::DemuxerStreamPlayer. |
| 67 void OnReadFromDemuxer( | 67 void OnReadFromDemuxer( |
| 68 int player_id, media::DemuxerStream::Type type, bool seek_done); | 68 int player_id, media::DemuxerStream::Type type, bool seek_done); |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 // media::MediaPlayerBridgeManager overrides. | 71 // media::MediaPlayerBridgeManager overrides. |
| 72 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 72 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
| 73 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 73 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
| 74 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; |
| 74 | 75 |
| 75 // Release all the players managed by this object. | 76 // Release all the players managed by this object. |
| 76 void DestroyAllMediaPlayers(); | 77 void DestroyAllMediaPlayers(); |
| 77 | 78 |
| 78 #if defined(GOOGLE_TV) | 79 #if defined(GOOGLE_TV) |
| 79 void AttachExternalVideoSurface(int player_id, jobject surface); | 80 void AttachExternalVideoSurface(int player_id, jobject surface); |
| 80 void DetachExternalVideoSurface(int player_id); | 81 void DetachExternalVideoSurface(int player_id); |
| 81 #endif | 82 #endif |
| 82 | 83 |
| 83 media::MediaPlayerBridge* GetFullscreenPlayer(); | 84 media::MediaPlayerBridge* GetFullscreenPlayer(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 110 ScopedVector<media::MediaPlayerBridge> players_; | 111 ScopedVector<media::MediaPlayerBridge> players_; |
| 111 | 112 |
| 112 // The fullscreen video view object. | 113 // The fullscreen video view object. |
| 113 ContentVideoView video_view_; | 114 ContentVideoView video_view_; |
| 114 | 115 |
| 115 // Player ID of the fullscreen media player. | 116 // Player ID of the fullscreen media player. |
| 116 int fullscreen_player_id_; | 117 int fullscreen_player_id_; |
| 117 | 118 |
| 118 WebContents* web_contents_; | 119 WebContents* web_contents_; |
| 119 | 120 |
| 120 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid); | 121 // Object for retrieving resources media players. |
| 122 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; |
| 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerImpl); |
| 121 }; | 125 }; |
| 122 | 126 |
| 123 } // namespace content | 127 } // namespace content |
| 124 | 128 |
| 125 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 129 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ |
| OLD | NEW |