Chromium Code Reviews| 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/renderer/media/webcontentdecryptionmodule_impl.h" | 5 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "content/renderer/media/cdm_session_adapter.h" | 15 #include "content/renderer/media/cdm_session_adapter.h" |
| 16 #include "content/renderer/media/crypto/key_systems.h" | 16 #include "content/renderer/media/crypto/key_systems.h" |
| 17 #include "content/renderer/media/webcontentdecryptionmoduleresult_helper.h" | |
| 17 #include "content/renderer/media/webcontentdecryptionmodulesession_impl.h" | 18 #include "content/renderer/media/webcontentdecryptionmodulesession_impl.h" |
| 19 #include "media/base/cdm_promise.h" | |
| 18 #include "media/base/media_keys.h" | 20 #include "media/base/media_keys.h" |
| 19 #include "third_party/WebKit/public/platform/WebString.h" | 21 #include "third_party/WebKit/public/platform/WebString.h" |
| 20 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 22 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 21 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 22 | 24 |
| 23 #if defined(ENABLE_PEPPER_CDMS) | 25 #if defined(ENABLE_PEPPER_CDMS) |
| 24 #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h" | 26 #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h" |
| 25 #endif | 27 #endif |
| 26 | 28 |
| 27 namespace content { | 29 namespace content { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 key_system_ascii, | 73 key_system_ascii, |
| 72 security_origin_as_gurl)) { | 74 security_origin_as_gurl)) { |
| 73 return NULL; | 75 return NULL; |
| 74 } | 76 } |
| 75 | 77 |
| 76 return new WebContentDecryptionModuleImpl(adapter); | 78 return new WebContentDecryptionModuleImpl(adapter); |
| 77 } | 79 } |
| 78 | 80 |
| 79 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( | 81 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( |
| 80 scoped_refptr<CdmSessionAdapter> adapter) | 82 scoped_refptr<CdmSessionAdapter> adapter) |
| 81 : adapter_(adapter) {} | 83 : adapter_(adapter), weak_ptr_factory_(this) { |
|
ddorwin
2014/09/23 18:57:31
weak_ptr_factory_ is no longer used.
jrummell
2014/09/23 22:36:35
Done.
| |
| 84 } | |
| 82 | 85 |
| 83 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { | 86 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { |
| 84 } | 87 } |
| 85 | 88 |
| 86 // The caller owns the created session. | 89 // The caller owns the created session. |
| 87 blink::WebContentDecryptionModuleSession* | 90 blink::WebContentDecryptionModuleSession* |
| 88 WebContentDecryptionModuleImpl::createSession() { | 91 WebContentDecryptionModuleImpl::createSession() { |
| 89 return adapter_->CreateSession(); | 92 return adapter_->CreateSession(); |
| 90 } | 93 } |
| 91 | 94 |
| 92 blink::WebContentDecryptionModuleSession* | 95 blink::WebContentDecryptionModuleSession* |
| 93 WebContentDecryptionModuleImpl::createSession( | 96 WebContentDecryptionModuleImpl::createSession( |
| 94 blink::WebContentDecryptionModuleSession::Client* client) { | 97 blink::WebContentDecryptionModuleSession::Client* client) { |
| 95 WebContentDecryptionModuleSessionImpl* session = adapter_->CreateSession(); | 98 WebContentDecryptionModuleSessionImpl* session = adapter_->CreateSession(); |
| 96 session->setClientInterface(client); | 99 session->setClientInterface(client); |
| 97 return session; | 100 return session; |
| 98 } | 101 } |
| 99 | 102 |
| 103 void WebContentDecryptionModuleImpl::setServerCertificate( | |
| 104 const uint8* server_certificate, | |
| 105 size_t server_certificate_length, | |
| 106 blink::WebContentDecryptionModuleResult result) { | |
| 107 DCHECK(server_certificate); | |
| 108 scoped_ptr<media::SimpleCdmPromise> promise = | |
| 109 WebContentDecryptionModuleResultHelper::CreateSimpleCdmPromise(result); | |
| 110 adapter_->SetServerCertificate( | |
| 111 server_certificate, server_certificate_length, promise.Pass()); | |
| 112 } | |
| 113 | |
| 100 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { | 114 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { |
| 101 return adapter_->GetDecryptor(); | 115 return adapter_->GetDecryptor(); |
| 102 } | 116 } |
| 103 | 117 |
| 104 #if defined(ENABLE_BROWSER_CDMS) | 118 #if defined(ENABLE_BROWSER_CDMS) |
| 105 int WebContentDecryptionModuleImpl::GetCdmId() const { | 119 int WebContentDecryptionModuleImpl::GetCdmId() const { |
| 106 return adapter_->GetCdmId(); | 120 return adapter_->GetCdmId(); |
| 107 } | 121 } |
| 108 #endif // defined(ENABLE_BROWSER_CDMS) | 122 #endif // defined(ENABLE_BROWSER_CDMS) |
| 109 | 123 |
| 110 } // namespace content | 124 } // namespace content |
| OLD | NEW |