OLD | NEW |
(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 WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_MANAGER_ANDROID_H_ |
| 6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_MANAGER_ANDROID_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <jni.h> |
| 10 #include <map> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 |
| 14 namespace webkit_media { |
| 15 |
| 16 class WebMediaPlayerAndroid; |
| 17 |
| 18 // Class for managing all the WebMediaPlayerAndroid objects in a renderer |
| 19 // process. |
| 20 class WebMediaPlayerManagerAndroid { |
| 21 public: |
| 22 WebMediaPlayerManagerAndroid(); |
| 23 ~WebMediaPlayerManagerAndroid(); |
| 24 |
| 25 // Register and unregister a WebMediaPlayerAndroid object. |
| 26 int RegisterMediaPlayer(WebMediaPlayerAndroid* player); |
| 27 void UnregisterMediaPlayer(int player_id); |
| 28 |
| 29 // Release all the media resources on the renderer process. |
| 30 void ReleaseMediaResources(); |
| 31 |
| 32 // Get the pointer to WebMediaPlayerAndroid given the |player_id|. |
| 33 WebMediaPlayerAndroid* GetMediaPlayer(int player_id); |
| 34 |
| 35 private: |
| 36 // Information needed to manage WebMediaPlayerAndroid. |
| 37 // TODO(qinmin): more informations will be added here for resource management. |
| 38 struct MediaPlayerInfo { |
| 39 webkit_media::WebMediaPlayerAndroid* player; |
| 40 }; |
| 41 |
| 42 // Info for all available WebMediaPlayerAndroid on a page; kept so that |
| 43 // we can enumerate them to send updates about tab focus and visibily. |
| 44 std::map<int32, MediaPlayerInfo> media_players_; |
| 45 |
| 46 int32 next_media_player_id_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerManagerAndroid); |
| 49 }; |
| 50 |
| 51 } // namespace webkit_media |
| 52 |
| 53 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_MANAGER_ANDROID_H_ |
OLD | NEW |