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