Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/browser/android/media_player_manager_impl.cc

Issue 17022008: Pass InitializeCDM() call through IPC to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/browser/android/media_player_manager_impl.h" 5 #include "content/browser/android/media_player_manager_impl.h"
6 6
7 #include "content/browser/android/content_view_core_impl.h" 7 #include "content/browser/android/content_view_core_impl.h"
8 #include "content/browser/android/media_resource_getter_impl.h" 8 #include "content/browser/android/media_resource_getter_impl.h"
9 #include "content/browser/web_contents/web_contents_view_android.h" 9 #include "content/browser/web_contents/web_contents_view_android.h"
10 #include "content/common/media/media_player_messages_android.h" 10 #include "content/common/media/media_player_messages_android.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, 68 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers,
69 DestroyAllMediaPlayers) 69 DestroyAllMediaPlayers)
70 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DemuxerReady, 70 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DemuxerReady,
71 OnDemuxerReady) 71 OnDemuxerReady)
72 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_ReadFromDemuxerAck, 72 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_ReadFromDemuxerAck,
73 OnReadFromDemuxerAck) 73 OnReadFromDemuxerAck)
74 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DurationChanged, 74 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DurationChanged,
75 OnDurationChanged) 75 OnDurationChanged)
76 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_MediaSeekRequestAck, 76 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_MediaSeekRequestAck,
77 OnMediaSeekRequestAck) 77 OnMediaSeekRequestAck)
78 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_GenerateKeyRequest, 78 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_InitializeCDM,
79 OnInitializeCDM)
80 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_GenerateKeyRequest,
79 OnGenerateKeyRequest) 81 OnGenerateKeyRequest)
80 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_AddKey, OnAddKey) 82 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_AddKey, OnAddKey)
81 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_CancelKeyRequest, 83 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CancelKeyRequest,
82 OnCancelKeyRequest) 84 OnCancelKeyRequest)
83 #if defined(GOOGLE_TV) 85 #if defined(GOOGLE_TV)
84 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface, 86 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface,
85 OnNotifyExternalSurface) 87 OnNotifyExternalSurface)
86 #endif 88 #endif
87 IPC_MESSAGE_UNHANDLED(handled = false) 89 IPC_MESSAGE_UNHANDLED(handled = false)
88 IPC_END_MESSAGE_MAP() 90 IPC_END_MESSAGE_MAP()
89 return handled; 91 return handled;
90 } 92 }
91 93
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 Send(new MediaPlayerMsg_MediaSeekRequest( 279 Send(new MediaPlayerMsg_MediaSeekRequest(
278 routing_id(), player_id, time_to_seek, seek_request_id)); 280 routing_id(), player_id, time_to_seek, seek_request_id));
279 } 281 }
280 282
281 void MediaPlayerManagerImpl::OnMediaConfigRequest(int player_id) { 283 void MediaPlayerManagerImpl::OnMediaConfigRequest(int player_id) {
282 Send(new MediaPlayerMsg_MediaConfigRequest(routing_id(), player_id)); 284 Send(new MediaPlayerMsg_MediaConfigRequest(routing_id(), player_id));
283 } 285 }
284 286
285 void MediaPlayerManagerImpl::OnKeyAdded(int media_keys_id, 287 void MediaPlayerManagerImpl::OnKeyAdded(int media_keys_id,
286 const std::string& session_id) { 288 const std::string& session_id) {
287 Send(new MediaPlayerMsg_KeyAdded(routing_id(), media_keys_id, session_id)); 289 Send(new MediaKeysMsg_KeyAdded(routing_id(), media_keys_id, session_id));
288 } 290 }
289 291
290 void MediaPlayerManagerImpl::OnKeyError(int media_keys_id, 292 void MediaPlayerManagerImpl::OnKeyError(int media_keys_id,
291 const std::string& session_id, 293 const std::string& session_id,
292 media::MediaKeys::KeyError error_code, 294 media::MediaKeys::KeyError error_code,
293 int system_code) { 295 int system_code) {
294 Send(new MediaPlayerMsg_KeyError(routing_id(), media_keys_id, 296 Send(new MediaKeysMsg_KeyError(routing_id(), media_keys_id,
295 session_id, error_code, system_code)); 297 session_id, error_code, system_code));
296 } 298 }
297 299
298 void MediaPlayerManagerImpl::OnKeyMessage(int media_keys_id, 300 void MediaPlayerManagerImpl::OnKeyMessage(int media_keys_id,
299 const std::string& session_id, 301 const std::string& session_id,
300 const std::string& message, 302 const std::string& message,
301 const std::string& destination_url) { 303 const std::string& destination_url) {
302 Send(new MediaPlayerMsg_KeyMessage(routing_id(), media_keys_id, session_id, 304 Send(new MediaKeysMsg_KeyMessage(routing_id(), media_keys_id, session_id,
303 message, destination_url)); 305 message, destination_url));
304 } 306 }
305 307
306 #if defined(GOOGLE_TV) 308 #if defined(GOOGLE_TV)
307 void MediaPlayerManagerImpl::AttachExternalVideoSurface(int player_id, 309 void MediaPlayerManagerImpl::AttachExternalVideoSurface(int player_id,
308 jobject surface) { 310 jobject surface) {
309 MediaPlayerAndroid* player = GetPlayer(player_id); 311 MediaPlayerAndroid* player = GetPlayer(player_id);
310 if (player) { 312 if (player) {
311 player->SetVideoSurface( 313 player->SetVideoSurface(
312 gfx::ScopedJavaSurface::AcquireExternalSurface(surface)); 314 gfx::ScopedJavaSurface::AcquireExternalSurface(surface));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 player->ReadFromDemuxerAck(params); 430 player->ReadFromDemuxerAck(params);
429 } 431 }
430 432
431 void MediaPlayerManagerImpl::OnMediaSeekRequestAck( 433 void MediaPlayerManagerImpl::OnMediaSeekRequestAck(
432 int player_id, unsigned seek_request_id) { 434 int player_id, unsigned seek_request_id) {
433 MediaPlayerAndroid* player = GetPlayer(player_id); 435 MediaPlayerAndroid* player = GetPlayer(player_id);
434 if (player) 436 if (player)
435 player->OnSeekRequestAck(seek_request_id); 437 player->OnSeekRequestAck(seek_request_id);
436 } 438 }
437 439
440 void MediaPlayerManagerImpl::OnInitializeCDM(int media_keys_id,
441 const std::vector<uint8>& uuid) {
442 // TODO(qinmin/xhwang): Create a MediaDrmBridge.
443 }
444
438 void MediaPlayerManagerImpl::OnGenerateKeyRequest( 445 void MediaPlayerManagerImpl::OnGenerateKeyRequest(
439 int media_keys_id, 446 int media_keys_id,
440 const std::string& type, 447 const std::string& type,
441 const std::vector<uint8>& init_data) { 448 const std::vector<uint8>& init_data) {
442 // TODO(qinmin): add a new MediaDrmBridge if GetDrmBridge() returns NULL.
443 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); 449 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id);
444 if (drm_bridge) { 450 if (drm_bridge) {
445 drm_bridge->GenerateKeyRequest(type, &init_data[0], init_data.size()); 451 drm_bridge->GenerateKeyRequest(type, &init_data[0], init_data.size());
446 } 452 }
447 } 453 }
448 454
449 void MediaPlayerManagerImpl::OnAddKey(int media_keys_id, 455 void MediaPlayerManagerImpl::OnAddKey(int media_keys_id,
450 const std::vector<uint8>& key, 456 const std::vector<uint8>& key,
451 const std::vector<uint8>& init_data, 457 const std::vector<uint8>& init_data,
452 const std::string& session_id) { 458 const std::string& session_id) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 for (ScopedVector<MediaDrmBridge>::iterator it = drm_bridges_.begin(); 496 for (ScopedVector<MediaDrmBridge>::iterator it = drm_bridges_.begin();
491 it != drm_bridges_.end(); ++it) { 497 it != drm_bridges_.end(); ++it) {
492 if ((*it)->media_keys_id() == media_keys_id) { 498 if ((*it)->media_keys_id() == media_keys_id) {
493 drm_bridges_.erase(it); 499 drm_bridges_.erase(it);
494 break; 500 break;
495 } 501 }
496 } 502 }
497 } 503 }
498 504
499 } // namespace content 505 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/media_player_manager_impl.h ('k') | content/common/media/media_player_messages_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698