| 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 "media/blink/webcontentdecryptionmodule_impl.h" | 5 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 // If unique security origin, don't try to create the CDM. | 57 // If unique security origin, don't try to create the CDM. |
| 58 if (security_origin.isUnique() || security_origin.toString() == "null") { | 58 if (security_origin.isUnique() || security_origin.toString() == "null") { |
| 59 result->completeWithError( | 59 result->completeWithError( |
| 60 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, | 60 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
| 61 "EME use is not allowed on unique origins."); | 61 "EME use is not allowed on unique origins."); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 | 64 |
| 65 GURL security_origin_as_gurl(security_origin.toString()); | 65 GURL security_origin_as_gurl(base::string16(security_origin.toString())); |
| 66 | 66 |
| 67 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then | 67 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then |
| 68 // if WebContentDecryptionModuleImpl is successfully created (returned in | 68 // if WebContentDecryptionModuleImpl is successfully created (returned in |
| 69 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will | 69 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will |
| 70 // be destructed. | 70 // be destructed. |
| 71 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); | 71 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); |
| 72 adapter->CreateCdm(cdm_factory, key_system_ascii, security_origin_as_gurl, | 72 adapter->CreateCdm(cdm_factory, key_system_ascii, security_origin_as_gurl, |
| 73 cdm_config, std::move(result)); | 73 cdm_config, std::move(result)); |
| 74 } | 74 } |
| 75 | 75 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 97 server_certificate + server_certificate_length), | 97 server_certificate + server_certificate_length), |
| 98 scoped_ptr<SimpleCdmPromise>( | 98 scoped_ptr<SimpleCdmPromise>( |
| 99 new CdmResultPromise<>(result, std::string()))); | 99 new CdmResultPromise<>(result, std::string()))); |
| 100 } | 100 } |
| 101 | 101 |
| 102 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { | 102 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { |
| 103 return adapter_->GetCdmContext(); | 103 return adapter_->GetCdmContext(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace media | 106 } // namespace media |
| OLD | NEW |