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/browser/android/browser_media_player_manager.h" | 5 #include "content/browser/android/browser_media_player_manager.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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); | 467 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); |
468 if (drm_bridge) | 468 if (drm_bridge) |
469 drm_bridge->GenerateKeyRequest(type, &init_data[0], init_data.size()); | 469 drm_bridge->GenerateKeyRequest(type, &init_data[0], init_data.size()); |
470 } | 470 } |
471 | 471 |
472 void BrowserMediaPlayerManager::OnAddKey(int media_keys_id, | 472 void BrowserMediaPlayerManager::OnAddKey(int media_keys_id, |
473 const std::vector<uint8>& key, | 473 const std::vector<uint8>& key, |
474 const std::vector<uint8>& init_data, | 474 const std::vector<uint8>& init_data, |
475 const std::string& session_id) { | 475 const std::string& session_id) { |
476 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); | 476 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); |
477 if (drm_bridge) { | 477 if (!drm_bridge) |
478 drm_bridge->AddKey(&key[0], key.size(), &init_data[0], init_data.size(), | 478 return; |
479 session_id); | 479 |
480 } | 480 drm_bridge->AddKey(&key[0], key.size(), &init_data[0], init_data.size(), |
| 481 session_id); |
| 482 // In EME v0.1b MediaKeys lives in the media element. So the |media_keys_id| |
| 483 // is the same as the |player_id|. |
| 484 // TODO(xhwang): Separate |media_keys_id| and |player_id|. |
| 485 MediaPlayerAndroid* player = GetPlayer(media_keys_id); |
| 486 if (player) |
| 487 player->OnKeyAdded(); |
481 } | 488 } |
482 | 489 |
483 void BrowserMediaPlayerManager::OnCancelKeyRequest( | 490 void BrowserMediaPlayerManager::OnCancelKeyRequest( |
484 int media_keys_id, | 491 int media_keys_id, |
485 const std::string& session_id) { | 492 const std::string& session_id) { |
486 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); | 493 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); |
487 if (drm_bridge) | 494 if (drm_bridge) |
488 drm_bridge->CancelKeyRequest(session_id); | 495 drm_bridge->CancelKeyRequest(session_id); |
489 } | 496 } |
490 | 497 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 if (!player || !drm_bridge) { | 545 if (!player || !drm_bridge) { |
539 NOTREACHED() << "OnSetMediaKeys(): Player and MediaKeys must be present."; | 546 NOTREACHED() << "OnSetMediaKeys(): Player and MediaKeys must be present."; |
540 return; | 547 return; |
541 } | 548 } |
542 // TODO(qinmin): add the logic to decide whether we should create the | 549 // TODO(qinmin): add the logic to decide whether we should create the |
543 // fullscreen surface for EME lv1. | 550 // fullscreen surface for EME lv1. |
544 player->SetDrmBridge(drm_bridge); | 551 player->SetDrmBridge(drm_bridge); |
545 } | 552 } |
546 | 553 |
547 } // namespace content | 554 } // namespace content |
OLD | NEW |