Index: media/mojo/services/mojo_cdm_service.h |
diff --git a/media/mojo/services/mojo_cdm_service.h b/media/mojo/services/mojo_cdm_service.h |
index 8e1198afb1c92e17fdf8ff2ae6938cfeb03341f3..7eb3de5a3932225c6844a58110f650398e8a4c99 100644 |
--- a/media/mojo/services/mojo_cdm_service.h |
+++ b/media/mojo/services/mojo_cdm_service.h |
@@ -11,15 +11,24 @@ |
#include "base/memory/weak_ptr.h" |
#include "media/base/media_keys.h" |
#include "media/mojo/interfaces/content_decryption_module.mojom.h" |
-#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
+#include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" |
namespace media { |
+class MojoCdmServiceContext; |
+ |
// A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. |
-class MojoCdmService : public mojo::ContentDecryptionModule { |
+class MojoCdmService : public mojo::ContentDecryptionModule, |
+ public mojo::ErrorHandler { |
public: |
- MojoCdmService(const mojo::String& key_system, |
- mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); |
+ // Creates MojoCdmService for |key_system|. Returns nullptr if |key_system| is |
+ // not supported. The returned object is owned by the caller. |
+ static MojoCdmService* Create( |
+ MojoCdmServiceContext* context, |
+ const mojo::String& key_system, |
+ mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); |
+ |
~MojoCdmService() final; |
// mojo::ContentDecryptionModule implementation. |
@@ -47,10 +56,19 @@ class MojoCdmService : public mojo::ContentDecryptionModule { |
void RemoveSession( |
const mojo::String& session_id, |
const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; |
- void GetCdmContext(int32_t cdm_id, |
- mojo::InterfaceRequest<mojo::Decryptor> decryptor) final; |
+ void GetDecryptor(mojo::InterfaceRequest<mojo::Decryptor> decryptor) final; |
+ |
+ // Get CdmContext to be used by the media pipeline. |
+ CdmContext* GetCdmContext(); |
private: |
+ MojoCdmService(MojoCdmServiceContext* context, |
+ const mojo::String& key_system, |
+ mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); |
+ |
+ // mojo::ErrorHandler implementation. |
+ void OnConnectionError() override; |
+ |
// Callbacks for firing session events. |
void OnSessionMessage(const std::string& session_id, |
MediaKeys::MessageType message_type, |
@@ -67,8 +85,9 @@ class MojoCdmService : public mojo::ContentDecryptionModule { |
uint32_t system_code, |
const std::string& error_message); |
- mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; |
+ mojo::Binding<mojo::ContentDecryptionModule> binding_; |
+ MojoCdmServiceContext* context_; |
scoped_ptr<MediaKeys> cdm_; |
mojo::ContentDecryptionModuleClientPtr client_; |