Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3127)

Unified Diff: content/renderer/media/cdm_session_adapter.cc

Issue 555223004: Update MediaKeys interface for EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 de3d162019f87e75aec7ae36ad9030f0e953a717..03f161fc73dc86332fa845725f8ca9458b96ea91 100644
--- a/content/renderer/media/cdm_session_adapter.cc
+++ b/content/renderer/media/cdm_session_adapter.cc
@@ -50,12 +50,22 @@ bool CdmSessionAdapter::Initialize(
base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this),
base::Bind(&CdmSessionAdapter::OnSessionReady, weak_this),
base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this),
- base::Bind(&CdmSessionAdapter::OnSessionError, weak_this));
+ base::Bind(&CdmSessionAdapter::OnSessionError, weak_this),
+ base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this),
+ base::Bind(&CdmSessionAdapter::OnSessionExpirationChange, weak_this));
// Success if |media_keys_| created.
return media_keys_;
}
+void CdmSessionAdapter::SetServerCertificate(
+ const uint8* server_certificate,
+ int server_certificate_length,
+ scoped_ptr<media::SimpleCdmPromise> promise) {
+ media_keys_->SetServerCertificate(
+ server_certificate, server_certificate_length, promise.Pass());
+}
+
WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::CreateSession() {
return new WebContentDecryptionModuleSessionImpl(this);
}
@@ -71,7 +81,7 @@ bool CdmSessionAdapter::RegisterSession(
return true;
}
-void CdmSessionAdapter::RemoveSession(const std::string& web_session_id) {
+void CdmSessionAdapter::UnregisterSession(const std::string& web_session_id) {
DCHECK(ContainsKey(sessions_, web_session_id));
sessions_.erase(web_session_id);
}
@@ -98,10 +108,22 @@ void CdmSessionAdapter::UpdateSession(
web_session_id, response, response_length, promise.Pass());
}
-void CdmSessionAdapter::ReleaseSession(
+void CdmSessionAdapter::CloseSession(
+ const std::string& web_session_id,
+ scoped_ptr<media::SimpleCdmPromise> promise) {
+ media_keys_->CloseSession(web_session_id, promise.Pass());
+}
+
+void CdmSessionAdapter::RemoveSession(
const std::string& web_session_id,
scoped_ptr<media::SimpleCdmPromise> promise) {
- media_keys_->ReleaseSession(web_session_id, promise.Pass());
+ media_keys_->RemoveSession(web_session_id, promise.Pass());
+}
+
+void CdmSessionAdapter::GetUsableKeyIds(
+ const std::string& web_session_id,
+ scoped_ptr<media::KeyIdsPromise> promise) {
+ media_keys_->GetUsableKeyIds(web_session_id, promise.Pass());
}
media::Decryptor* CdmSessionAdapter::GetDecryptor() {
@@ -128,6 +150,25 @@ void CdmSessionAdapter::OnSessionMessage(const std::string& web_session_id,
session->OnSessionMessage(message, destination_url);
}
+void CdmSessionAdapter::OnSessionKeysChange(const std::string& web_session_id,
+ bool has_additional_usable_key) {
+ WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id);
+ DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session "
+ << web_session_id;
+ if (session)
+ session->OnSessionKeysChange(has_additional_usable_key);
+}
+
+void CdmSessionAdapter::OnSessionExpirationChange(
+ const std::string& web_session_id,
+ double new_expiry_time) {
+ WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id);
+ DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session "
+ << web_session_id;
+ if (session)
+ session->OnSessionExpirationChange(new_expiry_time);
+}
+
void CdmSessionAdapter::OnSessionReady(const std::string& web_session_id) {
WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id);
DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session "

Powered by Google App Engine
This is Rietveld 408576698