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

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 and resolving merge conflicts 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 RenderViewHostObserver,
27 public media::MediaPlayerBridgeManager {
28 public:
29 // Create a MediaPlayerManagerAndroid object for the |render_view_host|.
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 const std::string& first_party_for_cookies);
61 void OnStart(int player_id);
62 void OnSeek(int player_id, base::TimeDelta time);
63 void OnPause(int player_id);
64 void OnReleaseResources(int player_id);
65 void OnDestroyPlayer(int player_id);
66
67 // An array of managed players.
68 ScopedVector<media::MediaPlayerBridge> players_;
69
70 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid);
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/android/cookie_getter_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