OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media/cdm/browser_cdm_manager.h" | 5 #include "content/browser/media/cdm/browser_cdm_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "media/base/cdm_promise.h" | 24 #include "media/base/cdm_promise.h" |
25 #include "media/base/limits.h" | 25 #include "media/base/limits.h" |
26 | 26 |
27 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) |
28 #include "content/public/common/renderer_preferences.h" | 28 #include "content/public/common/renderer_preferences.h" |
29 #endif | 29 #endif |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 using media::BrowserCdm; | 33 using media::BrowserCdm; |
| 34 using media::BrowserCdmPtr; |
34 using media::MediaKeys; | 35 using media::MediaKeys; |
35 | 36 |
36 namespace { | 37 namespace { |
37 | 38 |
38 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
39 // Android only supports 128-bit key IDs. | 40 // Android only supports 128-bit key IDs. |
40 const size_t kAndroidKeyIdBytes = 128 / 8; | 41 const size_t kAndroidKeyIdBytes = 128 / 8; |
41 #endif | 42 #endif |
42 | 43 |
43 // The ID used in this class is a concatenation of |render_frame_id| and | 44 // The ID used in this class is a concatenation of |render_frame_id| and |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 uint32_t promise_id, | 535 uint32_t promise_id, |
535 const std::string& key_system, | 536 const std::string& key_system, |
536 const GURL& security_origin, | 537 const GURL& security_origin, |
537 bool use_hw_secure_codecs) { | 538 bool use_hw_secure_codecs) { |
538 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 539 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
539 DCHECK(!GetCdm(render_frame_id, cdm_id)); | 540 DCHECK(!GetCdm(render_frame_id, cdm_id)); |
540 | 541 |
541 scoped_ptr<SimplePromise> promise(new SimplePromise( | 542 scoped_ptr<SimplePromise> promise(new SimplePromise( |
542 weak_ptr_factory_.GetWeakPtr(), render_frame_id, cdm_id, promise_id)); | 543 weak_ptr_factory_.GetWeakPtr(), render_frame_id, cdm_id, promise_id)); |
543 | 544 |
544 scoped_ptr<BrowserCdm> cdm(media::CreateBrowserCdm( | 545 BrowserCdmPtr cdm(media::CreateBrowserCdm( |
545 key_system, use_hw_secure_codecs, | 546 key_system, use_hw_secure_codecs, |
546 BROWSER_CDM_MANAGER_CB(OnSessionMessage), | 547 BROWSER_CDM_MANAGER_CB(OnSessionMessage), |
547 BROWSER_CDM_MANAGER_CB(OnSessionClosed), | 548 BROWSER_CDM_MANAGER_CB(OnSessionClosed), |
548 BROWSER_CDM_MANAGER_CB(OnLegacySessionError), | 549 BROWSER_CDM_MANAGER_CB(OnLegacySessionError), |
549 BROWSER_CDM_MANAGER_CB(OnSessionKeysChange), | 550 BROWSER_CDM_MANAGER_CB(OnSessionKeysChange), |
550 BROWSER_CDM_MANAGER_CB(OnSessionExpirationUpdate))); | 551 BROWSER_CDM_MANAGER_CB(OnSessionExpirationUpdate))); |
551 | 552 |
552 if (!cdm) { | 553 if (!cdm) { |
553 DVLOG(1) << "failed to create CDM."; | 554 DVLOG(1) << "failed to create CDM."; |
554 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "Failed to create CDM."); | 555 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "Failed to create CDM."); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); | 681 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); |
681 if (!cdm) { | 682 if (!cdm) { |
682 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); | 683 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); |
683 return; | 684 return; |
684 } | 685 } |
685 | 686 |
686 cdm->LoadSession(session_type, session_id, promise.Pass()); | 687 cdm->LoadSession(session_type, session_id, promise.Pass()); |
687 } | 688 } |
688 | 689 |
689 } // namespace content | 690 } // namespace content |
OLD | NEW |