| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 void OnCreateSession(int media_keys_id, | 143 void OnCreateSession(int media_keys_id, |
| 144 uint32 session_id, | 144 uint32 session_id, |
| 145 const std::string& type, | 145 const std::string& type, |
| 146 const std::vector<uint8>& init_data); | 146 const std::vector<uint8>& init_data); |
| 147 void OnUpdateSession(int media_keys_id, | 147 void OnUpdateSession(int media_keys_id, |
| 148 uint32 session_id, | 148 uint32 session_id, |
| 149 const std::vector<uint8>& response); | 149 const std::vector<uint8>& response); |
| 150 void OnReleaseSession(int media_keys_id, uint32 session_id); | 150 void OnReleaseSession(int media_keys_id, uint32 session_id); |
| 151 void OnSetMediaKeys(int player_id, int media_keys_id); | 151 void OnSetMediaKeys(int player_id, int media_keys_id); |
| 152 | 152 |
| 153 void OnCancelAllPendingSessionCreations(int media_keys_id); |
| 154 |
| 153 #if defined(VIDEO_HOLE) | 155 #if defined(VIDEO_HOLE) |
| 154 virtual void OnNotifyExternalSurface( | 156 virtual void OnNotifyExternalSurface( |
| 155 int player_id, bool is_request, const gfx::RectF& rect); | 157 int player_id, bool is_request, const gfx::RectF& rect); |
| 156 #endif // defined(VIDEO_HOLE) | 158 #endif // defined(VIDEO_HOLE) |
| 157 | 159 |
| 158 // Adds a given player to the list. | 160 // Adds a given player to the list. |
| 159 void AddPlayer(media::MediaPlayerAndroid* player); | 161 void AddPlayer(media::MediaPlayerAndroid* player); |
| 160 | 162 |
| 161 // Removes the player with the specified id. | 163 // Removes the player with the specified id. |
| 162 void RemovePlayer(int player_id); | 164 void RemovePlayer(int player_id); |
| 163 | 165 |
| 164 // Replaces a player with the specified id with a given MediaPlayerAndroid | 166 // Replaces a player with the specified id with a given MediaPlayerAndroid |
| 165 // object. This will also return the original MediaPlayerAndroid object that | 167 // object. This will also return the original MediaPlayerAndroid object that |
| 166 // was replaced. | 168 // was replaced. |
| 167 scoped_ptr<media::MediaPlayerAndroid> SwapPlayer( | 169 scoped_ptr<media::MediaPlayerAndroid> SwapPlayer( |
| 168 int player_id, | 170 int player_id, |
| 169 media::MediaPlayerAndroid* player); | 171 media::MediaPlayerAndroid* player); |
| 170 | 172 |
| 171 // Adds a new MediaDrmBridge for the given |uuid|, |media_keys_id|, and | 173 // Adds a new MediaDrmBridge for the given |uuid|, |media_keys_id|, and |
| 172 // |frame_url|. | 174 // |frame_url|. |
| 173 void AddDrmBridge(int media_keys_id, | 175 void AddDrmBridge(int media_keys_id, |
| 174 const std::vector<uint8>& uuid, | 176 const std::vector<uint8>& uuid, |
| 175 const GURL& frame_url); | 177 const GURL& frame_url); |
| 176 | 178 |
| 177 // Removes the DRM bridge with the specified id. | 179 // Removes the DRM bridge with the specified id. |
| 178 void RemoveDrmBridge(int media_keys_id); | 180 void RemoveDrmBridge(int media_keys_id); |
| 179 | 181 |
| 180 private: | 182 private: |
| 181 void GenerateKeyIfAllowed(int media_keys_id, | 183 // If |permitted| is false, it does nothing but send |
| 182 uint32 session_id, | 184 // |MediaKeysMsg_SessionError| IPC message. |
| 183 const std::string& type, | 185 // The primary use case is info bar permission callback, i.e., when info bar |
| 184 const std::vector<uint8>& init_data, | 186 // can decide user's intention either from interacting with the actual info |
| 185 bool allowed); | 187 // bar or from the saved preference. |
| 188 void CreateSessionIfPermitted(int media_keys_id, |
| 189 uint32 session_id, |
| 190 const std::string& type, |
| 191 const std::vector<uint8>& init_data, |
| 192 bool permitted); |
| 186 | 193 |
| 187 // Constructs a MediaPlayerAndroid object. Declared static to permit embedders | 194 // Constructs a MediaPlayerAndroid object. Declared static to permit embedders |
| 188 // to override functionality. | 195 // to override functionality. |
| 189 // | 196 // |
| 190 // Objects must call |manager->RequestMediaResources()| before decoding | 197 // Objects must call |manager->RequestMediaResources()| before decoding |
| 191 // and |manager->ReleaseMediaSources()| after finishing. This allows the | 198 // and |manager->ReleaseMediaSources()| after finishing. This allows the |
| 192 // manager to track decoding resources across the process and free them as | 199 // manager to track decoding resources across the process and free them as |
| 193 // needed. | 200 // needed. |
| 194 static media::MediaPlayerAndroid* CreateMediaPlayer( | 201 static media::MediaPlayerAndroid* CreateMediaPlayer( |
| 195 MediaPlayerHostMsg_Initialize_Type type, | 202 MediaPlayerHostMsg_Initialize_Type type, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; | 237 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; |
| 231 | 238 |
| 232 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 239 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
| 233 | 240 |
| 234 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 241 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
| 235 }; | 242 }; |
| 236 | 243 |
| 237 } // namespace content | 244 } // namespace content |
| 238 | 245 |
| 239 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 246 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
| OLD | NEW |