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

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,
scherkus (not reviewing) 2012/09/10 12:19:08 colon (:) goes on next line
qinmin 2012/09/11 04:50:24 Done.
27 public media::MediaPlayerBridgeManager {
28 public:
29 explicit MediaPlayerManagerAndroid(RenderViewHost* render_view_host);
30 virtual ~MediaPlayerManagerAndroid();
31
32 // RenderViewHostObserver overrides.
33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
34
35 // An internal method that checks for current time routinely and generates
36 // time update events.
37 void OnTimeUpdate(int player_id, base::TimeDelta current_time);
38
39 // Callbacks needed by media::MediaPlayerBridge.
40 void OnPrepared(int player_id, base::TimeDelta duration);
41 void OnPlaybackComplete(int player_id);
42 void OnBufferingUpdate(int player_id, int percentage);
43 void OnSeekComplete(int player_id, base::TimeDelta current_time);
44 void OnError(int player_id, int error);
45 void OnVideoSizeChanged(int player_id, int width, int height);
46
47 // media::MediaPlayerBridgeManager overrides.
48 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE;
49 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE;
50
51 // Release all the players managed by this object.
52 void DestroyAllMediaPlayers();
53
54 media::MediaPlayerBridge* GetPlayer(int player_id);
55
56 private:
57 // Message handlers.
58 void OnInitialize(int player_id, const std::string& url);
59 void OnStart(int player_id);
60 void OnSeek(int player_id, base::TimeDelta time);
61 void OnPause(int player_id);
62 void OnReleaseResources(int player_id);
63 void OnDestroyPlayer(int player_id);
64
65 // An array of managed players.
66 ScopedVector<media::MediaPlayerBridge> players_;
67
68 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid);
69 };
70
71 } // namespace content
72
73 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698