| 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 #include "content/renderer/media/android/renderer_media_player_manager.h" | 5 #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/common/media/cdm_messages.h" | 9 #include "content/common/media/cdm_messages.h" |
| 10 #include "content/common/media/media_player_messages_android.h" | 10 #include "content/common/media/media_player_messages_android.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 blink::WebFrame* frame) { | 233 blink::WebFrame* frame) { |
| 234 pending_fullscreen_frame_ = frame; | 234 pending_fullscreen_frame_ = frame; |
| 235 Send(new MediaPlayerHostMsg_EnterFullscreen(routing_id(), player_id)); | 235 Send(new MediaPlayerHostMsg_EnterFullscreen(routing_id(), player_id)); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void RendererMediaPlayerManager::ExitFullscreen(int player_id) { | 238 void RendererMediaPlayerManager::ExitFullscreen(int player_id) { |
| 239 pending_fullscreen_frame_ = NULL; | 239 pending_fullscreen_frame_ = NULL; |
| 240 Send(new MediaPlayerHostMsg_ExitFullscreen(routing_id(), player_id)); | 240 Send(new MediaPlayerHostMsg_ExitFullscreen(routing_id(), player_id)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void RendererMediaPlayerManager::SetCdm(int player_id, int cdm_id) { |
| 244 if (cdm_id == kInvalidCdmId) |
| 245 return; |
| 246 Send(new MediaPlayerHostMsg_SetCdm(routing_id(), player_id, cdm_id)); |
| 247 } |
| 248 |
| 243 void RendererMediaPlayerManager::InitializeCdm(int cdm_id, | 249 void RendererMediaPlayerManager::InitializeCdm(int cdm_id, |
| 244 ProxyMediaKeys* media_keys, | 250 ProxyMediaKeys* media_keys, |
| 245 const std::string& key_system, | 251 const std::string& key_system, |
| 246 const GURL& frame_url) { | 252 const GURL& frame_url) { |
| 253 DCHECK_NE(cdm_id, kInvalidCdmId); |
| 247 RegisterMediaKeys(cdm_id, media_keys); | 254 RegisterMediaKeys(cdm_id, media_keys); |
| 248 Send(new CdmHostMsg_InitializeCdm( | 255 Send(new CdmHostMsg_InitializeCdm( |
| 249 routing_id(), cdm_id, key_system, frame_url)); | 256 routing_id(), cdm_id, key_system, frame_url)); |
| 250 } | 257 } |
| 251 | 258 |
| 252 void RendererMediaPlayerManager::CreateSession( | 259 void RendererMediaPlayerManager::CreateSession( |
| 253 int cdm_id, | 260 int cdm_id, |
| 254 uint32 session_id, | 261 uint32 session_id, |
| 255 CdmHostMsg_CreateSession_ContentType content_type, | 262 CdmHostMsg_CreateSession_ContentType content_type, |
| 256 const std::vector<uint8>& init_data) { | 263 const std::vector<uint8>& init_data) { |
| 264 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered."; |
| 257 Send(new CdmHostMsg_CreateSession( | 265 Send(new CdmHostMsg_CreateSession( |
| 258 routing_id(), cdm_id, session_id, content_type, init_data)); | 266 routing_id(), cdm_id, session_id, content_type, init_data)); |
| 259 } | 267 } |
| 260 | 268 |
| 261 void RendererMediaPlayerManager::UpdateSession( | 269 void RendererMediaPlayerManager::UpdateSession( |
| 262 int cdm_id, | 270 int cdm_id, |
| 263 uint32 session_id, | 271 uint32 session_id, |
| 264 const std::vector<uint8>& response) { | 272 const std::vector<uint8>& response) { |
| 273 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered."; |
| 265 Send( | 274 Send( |
| 266 new CdmHostMsg_UpdateSession(routing_id(), cdm_id, session_id, response)); | 275 new CdmHostMsg_UpdateSession(routing_id(), cdm_id, session_id, response)); |
| 267 } | 276 } |
| 268 | 277 |
| 269 void RendererMediaPlayerManager::ReleaseSession(int cdm_id, uint32 session_id) { | 278 void RendererMediaPlayerManager::ReleaseSession(int cdm_id, uint32 session_id) { |
| 279 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered."; |
| 270 Send(new CdmHostMsg_ReleaseSession(routing_id(), cdm_id, session_id)); | 280 Send(new CdmHostMsg_ReleaseSession(routing_id(), cdm_id, session_id)); |
| 271 } | 281 } |
| 272 | 282 |
| 273 void RendererMediaPlayerManager::DestroyCdm(int cdm_id) { | 283 void RendererMediaPlayerManager::DestroyCdm(int cdm_id) { |
| 284 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered."; |
| 274 Send(new CdmHostMsg_DestroyCdm(routing_id(), cdm_id)); | 285 Send(new CdmHostMsg_DestroyCdm(routing_id(), cdm_id)); |
| 275 } | 286 } |
| 276 | 287 |
| 277 void RendererMediaPlayerManager::OnSessionCreated( | 288 void RendererMediaPlayerManager::OnSessionCreated( |
| 278 int cdm_id, | 289 int cdm_id, |
| 279 uint32 session_id, | 290 uint32 session_id, |
| 280 const std::string& web_session_id) { | 291 const std::string& web_session_id) { |
| 281 if (web_session_id.length() > kMaxWebSessionIdLength) { | 292 if (web_session_id.length() > kMaxWebSessionIdLength) { |
| 282 OnSessionError(cdm_id, session_id, media::MediaKeys::kUnknownError, 0); | 293 OnSessionError(cdm_id, session_id, media::MediaKeys::kUnknownError, 0); |
| 283 return; | 294 return; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 439 |
| 429 if (player && player->hasVideo()) { | 440 if (player && player->hasVideo()) { |
| 430 if (player->UpdateBoundaryRectangle()) | 441 if (player->UpdateBoundaryRectangle()) |
| 431 (*changes)[player_it->first] = player->GetBoundaryRectangle(); | 442 (*changes)[player_it->first] = player->GetBoundaryRectangle(); |
| 432 } | 443 } |
| 433 } | 444 } |
| 434 } | 445 } |
| 435 #endif // defined(VIDEO_HOLE) | 446 #endif // defined(VIDEO_HOLE) |
| 436 | 447 |
| 437 } // namespace content | 448 } // namespace content |
| OLD | NEW |