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

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

Issue 10919075: Move android mediaplayer from render process to browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 8 years, 3 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/public/browser/render_view_host_observer.h"
15 #include "media/base/android/media_player_bridge.h"
16 #include "media/base/android/media_player_bridge_manager.h"
17
18 namespace content {
19
20 // This class manages all the MediaPlayerBridge objects. It receives
21 // control operations from the the render process, and forwards
22 // them to corresponding MediaPlayerBridge object. Callbacks from
23 // MediaPlayerBridge objects are converted to IPCs and then sent to the
24 // render process.
25 class MediaPlayerManagerAndroid
26 : public content::RenderViewHostObserver,
27 public media::MediaPlayerBridgeManager {
28 public:
29 // Create a MediaPlayerManagerAndroid object for the |renver_view_host|.
scherkus (not reviewing) 2012/09/11 11:56:25 s/renver/render/
qinmin 2012/09/12 23:12:52 Done.
30 explicit MediaPlayerManagerAndroid(RenderViewHost* render_view_host);
31 virtual ~MediaPlayerManagerAndroid();
32
33 // RenderViewHostObserver overrides.
34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
35
36 // An internal method that checks for current time routinely and generates
37 // time update events.
38 void OnTimeUpdate(int player_id, base::TimeDelta current_time);
39
40 // Callbacks needed by media::MediaPlayerBridge.
41 void OnPrepared(int player_id, base::TimeDelta duration);
42 void OnPlaybackComplete(int player_id);
43 void OnBufferingUpdate(int player_id, int percentage);
44 void OnSeekComplete(int player_id, base::TimeDelta current_time);
45 void OnError(int player_id, int error);
46 void OnVideoSizeChanged(int player_id, int width, int height);
47
48 // media::MediaPlayerBridgeManager overrides.
49 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE;
50 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE;
51
52 // Release all the players managed by this object.
53 void DestroyAllMediaPlayers();
54
55 media::MediaPlayerBridge* GetPlayer(int player_id);
56
57 private:
58 // Message handlers.
59 void OnInitialize(int player_id, const std::string& url);
60 void OnStart(int player_id);
61 void OnSeek(int player_id, base::TimeDelta time);
62 void OnPause(int player_id);
63 void OnReleaseResources(int player_id);
64 void OnDestroyPlayer(int player_id);
65
66 // An array of managed players.
67 ScopedVector<media::MediaPlayerBridge> players_;
68
69 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid);
70 };
71
72 } // namespace content
73
74 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698