Chromium Code Reviews| Index: content/browser/android/media_player_manager_android.h |
| diff --git a/content/browser/android/media_player_manager_android.h b/content/browser/android/media_player_manager_android.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8f1ea1c77f608888f04ff48ac329ca2f0eae5960 |
| --- /dev/null |
| +++ b/content/browser/android/media_player_manager_android.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ |
| +#define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_vector.h" |
| +#include "base/time.h" |
| +#include "content/public/browser/render_view_host_observer.h" |
| +#include "media/base/android/media_player_bridge.h" |
| +#include "media/base/android/media_player_bridge_manager.h" |
| + |
| +namespace content { |
| + |
| +// This class manages all the android mediaplayer objects. It receives the |
|
scherkus (not reviewing)
2012/09/07 13:17:35
nit: replace "mediaplayer" with "media player"
ev
qinmin
2012/09/07 22:48:27
Done.
|
| +// control operations from the the renderer process, and forward |
|
scherkus (not reviewing)
2012/09/07 13:17:35
s/the control/control/
scherkus (not reviewing)
2012/09/07 13:17:35
s/, and forward/ and forwards/
qinmin
2012/09/07 22:48:27
Done.
qinmin
2012/09/07 22:48:27
Done.
|
| +// them to corresponding mediaplayers. Media notification messages are sent |
| +// this class first, before it forwards them to the renderer process. |
|
scherkus (not reviewing)
2012/09/07 13:17:35
Are media notification messages callbacks from Med
qinmin
2012/09/07 22:48:27
Yes, they are callbacks from MPB. Rephrased the se
|
| +class MediaPlayerManagerAndroid : public content::RenderViewHostObserver, |
|
scherkus (not reviewing)
2012/09/07 13:17:35
use initializer list style
class A
: public B
qinmin
2012/09/07 22:48:27
Done.
|
| + public media::MediaPlayerBridgeManager { |
| + public: |
| + explicit MediaPlayerManagerAndroid(RenderViewHost* render_view_host); |
| + virtual ~MediaPlayerManagerAndroid(); |
| + |
| + // RenderViewHostObserver overrides. |
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| + |
| + // An internal method that checks for current time routinely and generates |
| + // time update events. |
| + void OnTimeUpdate(int player_id, base::TimeDelta current_time); |
| + |
| + // Callbacks needed by media::MediaPlayerBridge. |
| + void OnPrepared(int player_id, base::TimeDelta duration); |
| + void OnPlaybackComplete(int player_id); |
| + void OnBufferingUpdate(int player_id, int percentage); |
| + void OnSeekComplete(int player_id, base::TimeDelta current_time); |
| + void OnError(int player_id, int error); |
| + void OnVideoSizeChanged(int player_id, int width, int height); |
| + |
| + // media::MediaPlayerBridgeManager overrides. |
| + virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
| + virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
| + |
| + // Release all the players managed by this object. |
| + void CleanUpAllPlayers(); |
| + |
| + media::MediaPlayerBridge* GetPlayer(int player_id); |
| + |
| + private: |
| + // Message handlers. |
| + void OnInitialize(int player_id, const std::string& url); |
| + void OnStart(int player_id); |
| + void OnSeek(int player_id, base::TimeDelta time); |
| + void OnPause(int player_id); |
| + void OnReleaseResources(int player_id); |
| + void OnDestroyPlayer(int player_id); |
| + |
| + // An array of managed players. |
| + ScopedVector<media::MediaPlayerBridge> players_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ |