| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 DCHECK(!key_system.empty()); | 37 DCHECK(!key_system.empty()); |
| 38 | 38 |
| 39 // TODO(ddorwin): Guard against this in supported types check and remove this. | 39 // TODO(ddorwin): Guard against this in supported types check and remove this. |
| 40 // Chromium only supports ASCII key systems. | 40 // Chromium only supports ASCII key systems. |
| 41 if (!IsStringASCII(key_system)) { | 41 if (!IsStringASCII(key_system)) { |
| 42 NOTREACHED(); | 42 NOTREACHED(); |
| 43 return NULL; | 43 return NULL; |
| 44 } | 44 } |
| 45 | 45 |
| 46 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); | 46 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); |
| 47 |
| 47 if (!adapter->Initialize( | 48 if (!adapter->Initialize( |
| 48 #if defined(ENABLE_PEPPER_CDMS) | 49 #if defined(ENABLE_PEPPER_CDMS) |
| 49 base::Bind(&PepperCdmWrapperImpl::Create, frame), | 50 base::Bind(&PepperCdmWrapperImpl::Create, frame), |
| 50 #endif | 51 #endif |
| 51 base::UTF16ToASCII(key_system))) { | 52 base::UTF16ToASCII(key_system))) { |
| 52 return NULL; | 53 return NULL; |
| 53 } | 54 } |
| 54 | 55 |
| 55 return new WebContentDecryptionModuleImpl(adapter); | 56 return new WebContentDecryptionModuleImpl(adapter); |
| 56 } | 57 } |
| 57 | 58 |
| 58 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( | 59 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( |
| 59 scoped_refptr<CdmSessionAdapter> adapter) | 60 scoped_refptr<CdmSessionAdapter> adapter) |
| 60 : adapter_(adapter) { | 61 : adapter_(adapter) {} |
| 61 } | |
| 62 | 62 |
| 63 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { | 63 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { |
| 64 } | 64 } |
| 65 | 65 |
| 66 // The caller owns the created session. | 66 // The caller owns the created session. |
| 67 blink::WebContentDecryptionModuleSession* | 67 blink::WebContentDecryptionModuleSession* |
| 68 WebContentDecryptionModuleImpl::createSession( | 68 WebContentDecryptionModuleImpl::createSession( |
| 69 blink::WebContentDecryptionModuleSession::Client* client) { | 69 blink::WebContentDecryptionModuleSession::Client* client) { |
| 70 return adapter_->CreateSession(client); | 70 return adapter_->CreateSession(client); |
| 71 } | 71 } |
| 72 | 72 |
| 73 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { | 73 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { |
| 74 return adapter_->GetDecryptor(); | 74 return adapter_->GetDecryptor(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 #if defined(OS_ANDROID) |
| 78 int WebContentDecryptionModuleImpl::GetCdmId() const { |
| 79 return adapter_->GetCdmId(); |
| 80 } |
| 81 #endif // defined(OS_ANDROID) |
| 82 |
| 77 } // namespace content | 83 } // namespace content |
| OLD | NEW |