Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: content/browser/android/media_player_manager_android.h

Issue 14314020: Rename MediaPlayerBridgeManager to MediaPlayerManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional rebase conflict Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_
6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_
7
8 #include <map>
9
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h"
13 #include "base/time.h"
14 #include "content/browser/android/content_video_view.h"
15 #include "content/public/browser/render_view_host_observer.h"
16 #include "googleurl/src/gurl.h"
17 #if defined(GOOGLE_TV)
18 #include "media/base/android/demuxer_stream_player_params.h"
19 #endif
20 #include "media/base/android/media_player_bridge.h"
21 #include "media/base/android/media_player_bridge_manager.h"
22 #include "ui/gfx/rect_f.h"
23
24 namespace content {
25
26 class WebContents;
27
28 // This class manages all the MediaPlayerBridge objects. It receives
29 // control operations from the the render process, and forwards
30 // them to corresponding MediaPlayerBridge object. Callbacks from
31 // MediaPlayerBridge objects are converted to IPCs and then sent to the
32 // render process.
33 class MediaPlayerManagerAndroid
34 : public RenderViewHostObserver,
35 public media::MediaPlayerBridgeManager {
36 public:
37 // Create a MediaPlayerManagerAndroid object for the |render_view_host|.
38 explicit MediaPlayerManagerAndroid(RenderViewHost* render_view_host);
39 virtual ~MediaPlayerManagerAndroid();
40
41 // RenderViewHostObserver overrides.
42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
43
44 // Fullscreen video playback controls.
45 void FullscreenPlayerPlay();
46 void FullscreenPlayerPause();
47 void FullscreenPlayerSeek(int msec);
48 void ExitFullscreen(bool release_media_player);
49 void SetVideoSurface(jobject surface);
50
51 // An internal method that checks for current time routinely and generates
52 // time update events.
53 void OnTimeUpdate(int player_id, base::TimeDelta current_time);
54
55 // Callbacks needed by media::MediaPlayerBridge.
56 void OnMediaMetadataChanged(int player_id, base::TimeDelta duration,
57 int width, int height, bool success);
58 void OnPlaybackComplete(int player_id);
59 void OnMediaInterrupted(int player_id);
60 void OnBufferingUpdate(int player_id, int percentage);
61 void OnSeekComplete(int player_id, base::TimeDelta current_time);
62 void OnError(int player_id, int error);
63 void OnVideoSizeChanged(int player_id, int width, int height);
64
65 #if defined(GOOGLE_TV)
66 // Callbacks needed by media::DemuxerStreamPlayer.
67 void OnReadFromDemuxer(
68 int player_id, media::DemuxerStream::Type type, bool seek_done);
69 #endif
70
71 // media::MediaPlayerBridgeManager overrides.
72 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE;
73 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE;
74
75 // Release all the players managed by this object.
76 void DestroyAllMediaPlayers();
77
78 #if defined(GOOGLE_TV)
79 void AttachExternalVideoSurface(int player_id, jobject surface);
80 void DetachExternalVideoSurface(int player_id);
81 #endif
82
83 media::MediaPlayerBridge* GetFullscreenPlayer();
84 media::MediaPlayerBridge* GetPlayer(int player_id);
85
86 private:
87 // Message handlers.
88 void OnEnterFullscreen(int player_id);
89 void OnExitFullscreen(int player_id);
90 void OnInitialize(int player_id, const GURL& url,
91 bool is_media_source,
92 const GURL& first_party_for_cookies);
93 void OnStart(int player_id);
94 void OnSeek(int player_id, base::TimeDelta time);
95 void OnPause(int player_id);
96 void OnReleaseResources(int player_id);
97 void OnDestroyPlayer(int player_id);
98 #if defined(GOOGLE_TV)
99 void OnRequestExternalSurface(int player_id);
100 void OnNotifyGeometryChange(int player_id, const gfx::RectF& rect);
101 void OnDemuxerReady(
102 int player_id,
103 const media::MediaPlayerHostMsg_DemuxerReady_Params& params);
104 void OnReadFromDemuxerAck(
105 int player_id,
106 const media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params);
107 #endif
108
109 // An array of managed players.
110 ScopedVector<media::MediaPlayerBridge> players_;
111
112 // The fullscreen video view object.
113 ContentVideoView video_view_;
114
115 // Player ID of the fullscreen media player.
116 int fullscreen_player_id_;
117
118 WebContents* web_contents_;
119
120 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid);
121 };
122
123 } // namespace content
124
125 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/browser/android/media_player_manager_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698