| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 | 519 |
| 520 void BrowserMediaPlayerManager::AddDrmBridge(int media_keys_id, | 520 void BrowserMediaPlayerManager::AddDrmBridge(int media_keys_id, |
| 521 const std::vector<uint8>& uuid) { | 521 const std::vector<uint8>& uuid) { |
| 522 DCHECK(!GetDrmBridge(media_keys_id)); | 522 DCHECK(!GetDrmBridge(media_keys_id)); |
| 523 // TODO(qinmin): Pass the security level to MediaDrmBridge instead of using | 523 // TODO(qinmin): Pass the security level to MediaDrmBridge instead of using |
| 524 // the default L3. | 524 // the default L3. |
| 525 scoped_ptr<MediaDrmBridge> drm_bridge( | 525 scoped_ptr<MediaDrmBridge> drm_bridge( |
| 526 MediaDrmBridge::Create(media_keys_id, uuid, "L3", this)); | 526 MediaDrmBridge::Create(media_keys_id, uuid, "L3", this)); |
| 527 DCHECK(drm_bridge) << "failed to create drm bridge. "; | 527 if (!drm_bridge) { |
| 528 DVLOG(1) << "failed to create drm bridge."; |
| 529 return; |
| 530 } |
| 531 |
| 528 drm_bridges_.push_back(drm_bridge.release()); | 532 drm_bridges_.push_back(drm_bridge.release()); |
| 529 } | 533 } |
| 530 | 534 |
| 531 void BrowserMediaPlayerManager::RemoveDrmBridge(int media_keys_id) { | 535 void BrowserMediaPlayerManager::RemoveDrmBridge(int media_keys_id) { |
| 532 for (ScopedVector<MediaDrmBridge>::iterator it = drm_bridges_.begin(); | 536 for (ScopedVector<MediaDrmBridge>::iterator it = drm_bridges_.begin(); |
| 533 it != drm_bridges_.end(); ++it) { | 537 it != drm_bridges_.end(); ++it) { |
| 534 if ((*it)->media_keys_id() == media_keys_id) { | 538 if ((*it)->media_keys_id() == media_keys_id) { |
| 535 drm_bridges_.erase(it); | 539 drm_bridges_.erase(it); |
| 536 break; | 540 break; |
| 537 } | 541 } |
| 538 } | 542 } |
| 539 } | 543 } |
| 540 | 544 |
| 541 void BrowserMediaPlayerManager::OnSetMediaKeys(int player_id, | 545 void BrowserMediaPlayerManager::OnSetMediaKeys(int player_id, |
| 542 int media_keys_id) { | 546 int media_keys_id) { |
| 543 MediaPlayerAndroid* player = GetPlayer(player_id); | 547 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 544 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); | 548 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); |
| 545 if (!player || !drm_bridge) { | 549 if (!player || !drm_bridge) { |
| 546 NOTREACHED() << "OnSetMediaKeys(): Player and MediaKeys must be present."; | 550 DVLOG(1) << "OnSetMediaKeys(): Player and MediaKeys must be present."; |
| 547 return; | 551 return; |
| 548 } | 552 } |
| 549 // TODO(qinmin): add the logic to decide whether we should create the | 553 // TODO(qinmin): add the logic to decide whether we should create the |
| 550 // fullscreen surface for EME lv1. | 554 // fullscreen surface for EME lv1. |
| 551 player->SetDrmBridge(drm_bridge); | 555 player->SetDrmBridge(drm_bridge); |
| 552 } | 556 } |
| 553 | 557 |
| 554 } // namespace content | 558 } // namespace content |
| OLD | NEW |