Chromium Code Reviews| Index: content/renderer/media/cdm_session_adapter.cc |
| diff --git a/content/renderer/media/cdm_session_adapter.cc b/content/renderer/media/cdm_session_adapter.cc |
| index b77cb3805dd58da15d8dd0097ba28b08925ae890..763168dbb377e830a33804a3c42a276030e9389d 100644 |
| --- a/content/renderer/media/cdm_session_adapter.cc |
| +++ b/content/renderer/media/cdm_session_adapter.cc |
| @@ -12,6 +12,10 @@ |
| #include "media/base/media_keys.h" |
| #include "url/gurl.h" |
| +#if defined(OS_ANDROID) |
| +#include "content/renderer/media/android/renderer_media_player_manager.h" |
|
ddorwin
2014/03/25 23:04:00
This is a very odd include in this file. Would it
xhwang
2014/03/26 06:02:04
GetCdmId() should only be called after Initialize(
|
| +#endif |
| + |
| namespace content { |
| const uint32 kStartingSessionId = 1; |
| @@ -19,15 +23,20 @@ uint32 CdmSessionAdapter::next_session_id_ = kStartingSessionId; |
| COMPILE_ASSERT(kStartingSessionId > media::MediaKeys::kInvalidSessionId, |
| invalid_starting_value); |
| -CdmSessionAdapter::CdmSessionAdapter() : weak_ptr_factory_(this) {} |
| +CdmSessionAdapter::CdmSessionAdapter() : |
| +#if defined(OS_ANDROID) |
| + cdm_id_(RendererMediaPlayerManager::kInvalidCdmId), |
| +#endif |
| + weak_ptr_factory_(this) {} |
| CdmSessionAdapter::~CdmSessionAdapter() {} |
| bool CdmSessionAdapter::Initialize( |
| #if defined(ENABLE_PEPPER_CDMS) |
| const CreatePepperCdmCB& create_pepper_cdm_cb, |
| -#endif |
| +#endif // defined(ENABLE_PEPPER_CDMS) |
| const std::string& key_system) { |
| + |
|
ddorwin
2014/03/25 23:04:00
remove
xhwang
2014/03/26 06:02:04
Done.
|
| base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr(); |
| media_keys_ = |
| ContentDecryptionModuleFactory::Create( |
| @@ -37,9 +46,9 @@ bool CdmSessionAdapter::Initialize( |
| #elif defined(OS_ANDROID) |
| // TODO(xhwang): Support Android. |
| NULL, |
| - 0, |
| // TODO(ddorwin): Get the URL for the frame containing the MediaKeys. |
| GURL(), |
| + &cdm_id_, |
| #endif // defined(ENABLE_PEPPER_CDMS) |
| base::Bind(&CdmSessionAdapter::OnSessionCreated, weak_this), |
| base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this), |
| @@ -92,6 +101,12 @@ media::Decryptor* CdmSessionAdapter::GetDecryptor() { |
| return media_keys_->GetDecryptor(); |
| } |
| +#if defined(OS_ANDROID) |
| +int CdmSessionAdapter::GetCdmId() const { |
| + return cdm_id_; |
| +} |
| +#endif // defined(OS_ANDROID) |
| + |
| void CdmSessionAdapter::OnSessionCreated(uint32 session_id, |
| const std::string& web_session_id) { |
| WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |