Chromium Code Reviews| Index: content/renderer/media/webcontentdecryptionmodule_impl.cc |
| diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc |
| index 7b2131b6354349ea5dfa8ec1a2a012d3e0f05bb0..f48522773d1814504cfe4060164aa7c8b5f55b09 100644 |
| --- a/content/renderer/media/webcontentdecryptionmodule_impl.cc |
| +++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc |
| @@ -17,6 +17,8 @@ |
| #if defined(ENABLE_PEPPER_CDMS) |
| #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h" |
| +#elif defined(OS_ANDROID) |
| +#include "content/renderer/media/android/renderer_media_player_manager.h" |
| #endif |
| namespace content { |
| @@ -31,25 +33,36 @@ WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create( |
| } |
| scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); |
| - if (!adapter->Initialize( |
| + |
| +#if defined(OS_ANDROID) |
| + int cdm_id = RendererMediaPlayerManager::kInvalidCdmId; |
| + if (adapter->Initialize(&cdm_id, UTF16ToASCII(key_system))) |
| + return new WebContentDecryptionModuleImpl(adapter, cdm_id); |
| +#else // defined(OS_ANDROID) |
| + if (adapter->Initialize( |
| #if defined(ENABLE_PEPPER_CDMS) |
| // TODO(jrummell): Figure out how to get a WebFrame from Blink (or |
| // something equivalent) so the plugin can actually get created. |
| // http://crbug.com/250049 |
| base::Bind(&PepperCdmWrapperImpl::Create, |
| static_cast<blink::WebFrame*>(NULL)), |
| -#endif |
| +#endif // defined(ENABLE_PEPPER_CDMS) |
| UTF16ToASCII(key_system))) { |
| - return NULL; |
| + return new WebContentDecryptionModuleImpl(adapter); |
| } |
| - |
| - return new WebContentDecryptionModuleImpl(adapter); |
| +#endif // defined(OS_ANDROID) |
| + return NULL; |
| } |
| +#if defined(OS_ANDROID) |
| +WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( |
| + scoped_refptr<CdmSessionAdapter> adapter, int cdm_id) |
| + : adapter_(adapter), cdm_id_(cdm_id) {} |
| +#else |
| WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( |
| scoped_refptr<CdmSessionAdapter> adapter) |
| - : adapter_(adapter) { |
| -} |
| + : adapter_(adapter) {} |
| +#endif |
|
xhwang
2014/03/12 01:20:11
This code (l.37-65) is really messy with #ifdefs.
ddorwin
2014/03/18 22:51:08
How much smaller is the diff if we track this in t
xhwang
2014/03/25 21:49:50
ifdef'ed individual parameters where possible.
|
| WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { |
| } |
| @@ -65,4 +78,10 @@ media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { |
| return adapter_->GetDecryptor(); |
| } |
| +#if defined(OS_ANDROID) |
| +int WebContentDecryptionModuleImpl::GetCdmId() { |
| + return cdm_id_; |
| +} |
| +#endif // defined(OS_ANDROID) |
| + |
| } // namespace content |