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

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

Issue 555223004: Update MediaKeys interface for EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + Android changes 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/webcontentdecryptionmodule_impl.cc
diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc
index 9dcb39ee9ca98931c5f49c05035f805ed883e846..7d0d223b7a0ea9b71fce58a60812830b3ddcaf51 100644
--- a/content/renderer/media/webcontentdecryptionmodule_impl.cc
+++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc
@@ -15,6 +15,7 @@
#include "content/renderer/media/cdm_session_adapter.h"
#include "content/renderer/media/crypto/key_systems.h"
#include "content/renderer/media/webcontentdecryptionmodulesession_impl.h"
+#include "media/base/cdm_promise.h"
#include "media/base/media_keys.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
@@ -78,7 +79,8 @@ WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create(
WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
scoped_refptr<CdmSessionAdapter> adapter)
- : adapter_(adapter) {}
+ : adapter_(adapter), weak_ptr_factory_(this) {
+}
WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() {
}
@@ -97,6 +99,23 @@ WebContentDecryptionModuleImpl::createSession(
return session;
}
+void WebContentDecryptionModuleImpl::setServerCertificate(
+ const uint8* server_certificate,
+ size_t server_certificate_length,
+ blink::WebContentDecryptionModuleResult result) {
+ DCHECK(server_certificate);
+ uint32 result_index = outstanding_results_.AddResult(result);
ddorwin 2014/09/10 22:58:38 The rest of this code is unclear to me.
jrummell 2014/09/11 21:21:55 The code below simply creates a CdmPromise that is
+ scoped_ptr<media::SimpleCdmPromise> promise(new media::SimpleCdmPromise(
+ base::Bind(&WebContentDecryptionModuleImpl::CertificateSet,
+ weak_ptr_factory_.GetWeakPtr(),
+ result_index),
+ base::Bind(&WebContentDecryptionModuleImpl::SessionError,
+ weak_ptr_factory_.GetWeakPtr(),
+ result_index)));
+ adapter_->SetServerCertificate(
+ server_certificate, server_certificate_length, promise.Pass());
+}
+
media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() {
return adapter_->GetDecryptor();
}
@@ -107,4 +126,17 @@ int WebContentDecryptionModuleImpl::GetCdmId() const {
}
#endif // defined(ENABLE_BROWSER_CDMS)
+void WebContentDecryptionModuleImpl::CertificateSet(uint32 result_index) {
+ outstanding_results_.Complete(result_index);
+}
+
+void WebContentDecryptionModuleImpl::SessionError(
+ uint32 result_index,
+ media::MediaKeys::Exception exception_code,
+ uint32 system_code,
+ const std::string& error_message) {
+ outstanding_results_.CompleteWithError(
+ result_index, exception_code, system_code, error_message);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698