| 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_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_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 #include "media/base/android/media_player_bridge.h" | 17 #include "media/base/android/media_player_bridge.h" |
| 18 #include "media/base/android/media_player_bridge_manager.h" | 18 #include "media/base/android/media_player_bridge_manager.h" |
| 19 #include "ui/gfx/rect_f.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 class WebContents; | 23 class WebContents; |
| 23 | 24 |
| 24 // This class manages all the MediaPlayerBridge objects. It receives | 25 // This class manages all the MediaPlayerBridge objects. It receives |
| 25 // control operations from the the render process, and forwards | 26 // control operations from the the render process, and forwards |
| 26 // them to corresponding MediaPlayerBridge object. Callbacks from | 27 // them to corresponding MediaPlayerBridge object. Callbacks from |
| 27 // MediaPlayerBridge objects are converted to IPCs and then sent to the | 28 // MediaPlayerBridge objects are converted to IPCs and then sent to the |
| 28 // render process. | 29 // render process. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 void OnError(int player_id, int error); | 59 void OnError(int player_id, int error); |
| 59 void OnVideoSizeChanged(int player_id, int width, int height); | 60 void OnVideoSizeChanged(int player_id, int width, int height); |
| 60 | 61 |
| 61 // media::MediaPlayerBridgeManager overrides. | 62 // media::MediaPlayerBridgeManager overrides. |
| 62 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 63 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
| 63 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 64 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
| 64 | 65 |
| 65 // Release all the players managed by this object. | 66 // Release all the players managed by this object. |
| 66 void DestroyAllMediaPlayers(); | 67 void DestroyAllMediaPlayers(); |
| 67 | 68 |
| 69 #if defined(GOOGLE_TV) |
| 68 void AttachExternalVideoSurface(int player_id, jobject surface); | 70 void AttachExternalVideoSurface(int player_id, jobject surface); |
| 69 void DetachExternalVideoSurface(int player_id); | 71 void DetachExternalVideoSurface(int player_id); |
| 72 #endif |
| 70 | 73 |
| 71 media::MediaPlayerBridge* GetFullscreenPlayer(); | 74 media::MediaPlayerBridge* GetFullscreenPlayer(); |
| 72 media::MediaPlayerBridge* GetPlayer(int player_id); | 75 media::MediaPlayerBridge* GetPlayer(int player_id); |
| 73 | 76 |
| 74 private: | 77 private: |
| 75 // Message handlers. | 78 // Message handlers. |
| 76 void OnEnterFullscreen(int player_id); | 79 void OnEnterFullscreen(int player_id); |
| 77 void OnExitFullscreen(int player_id); | 80 void OnExitFullscreen(int player_id); |
| 78 void OnInitialize(int player_id, const GURL& url, | 81 void OnInitialize(int player_id, const GURL& url, |
| 79 const GURL& first_party_for_cookies); | 82 const GURL& first_party_for_cookies); |
| 80 void OnStart(int player_id); | 83 void OnStart(int player_id); |
| 81 void OnSeek(int player_id, base::TimeDelta time); | 84 void OnSeek(int player_id, base::TimeDelta time); |
| 82 void OnPause(int player_id); | 85 void OnPause(int player_id); |
| 83 void OnReleaseResources(int player_id); | 86 void OnReleaseResources(int player_id); |
| 84 void OnDestroyPlayer(int player_id); | 87 void OnDestroyPlayer(int player_id); |
| 88 #if defined(GOOGLE_TV) |
| 85 void OnRequestExternalSurface(int player_id); | 89 void OnRequestExternalSurface(int player_id); |
| 90 void OnNotifyGeometryChange(int player_id, const gfx::RectF& rect); |
| 91 #endif |
| 86 | 92 |
| 87 // An array of managed players. | 93 // An array of managed players. |
| 88 ScopedVector<media::MediaPlayerBridge> players_; | 94 ScopedVector<media::MediaPlayerBridge> players_; |
| 89 | 95 |
| 90 // The fullscreen video view object. | 96 // The fullscreen video view object. |
| 91 ContentVideoView video_view_; | 97 ContentVideoView video_view_; |
| 92 | 98 |
| 93 // Player ID of the fullscreen media player. | 99 // Player ID of the fullscreen media player. |
| 94 int fullscreen_player_id_; | 100 int fullscreen_player_id_; |
| 95 | 101 |
| 96 WebContents* web_contents_; | 102 WebContents* web_contents_; |
| 97 | 103 |
| 98 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid); | 104 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid); |
| 99 }; | 105 }; |
| 100 | 106 |
| 101 } // namespace content | 107 } // namespace content |
| 102 | 108 |
| 103 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 109 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ |
| OLD | NEW |