| 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 "webcontentdecryptionmodule_impl.h" | 5 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 6 |
| 7 #include <utility> |
| 6 | 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
| 10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "media/base/cdm_promise.h" | 14 #include "media/base/cdm_promise.h" |
| 13 #include "media/base/key_systems.h" | 15 #include "media/base/key_systems.h" |
| 14 #include "media/base/media_keys.h" | 16 #include "media/base/media_keys.h" |
| 15 #include "media/blink/cdm_result_promise.h" | 17 #include "media/blink/cdm_result_promise.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 63 } |
| 62 | 64 |
| 63 GURL security_origin_as_gurl(security_origin.toString()); | 65 GURL security_origin_as_gurl(security_origin.toString()); |
| 64 | 66 |
| 65 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then | 67 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then |
| 66 // if WebContentDecryptionModuleImpl is successfully created (returned in | 68 // if WebContentDecryptionModuleImpl is successfully created (returned in |
| 67 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will | 69 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will |
| 68 // be destructed. | 70 // be destructed. |
| 69 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); | 71 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); |
| 70 adapter->CreateCdm(cdm_factory, key_system_ascii, security_origin_as_gurl, | 72 adapter->CreateCdm(cdm_factory, key_system_ascii, security_origin_as_gurl, |
| 71 cdm_config, result.Pass()); | 73 cdm_config, std::move(result)); |
| 72 } | 74 } |
| 73 | 75 |
| 74 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( | 76 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( |
| 75 scoped_refptr<CdmSessionAdapter> adapter) | 77 scoped_refptr<CdmSessionAdapter> adapter) |
| 76 : adapter_(adapter) { | 78 : adapter_(adapter) { |
| 77 } | 79 } |
| 78 | 80 |
| 79 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { | 81 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { |
| 80 } | 82 } |
| 81 | 83 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 95 server_certificate + server_certificate_length), | 97 server_certificate + server_certificate_length), |
| 96 scoped_ptr<SimpleCdmPromise>( | 98 scoped_ptr<SimpleCdmPromise>( |
| 97 new CdmResultPromise<>(result, std::string()))); | 99 new CdmResultPromise<>(result, std::string()))); |
| 98 } | 100 } |
| 99 | 101 |
| 100 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { | 102 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { |
| 101 return adapter_->GetCdmContext(); | 103 return adapter_->GetCdmContext(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 } // namespace media | 106 } // namespace media |
| OLD | NEW |