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

Unified Diff: media/mojo/services/mojo_cdm_service.h

Issue 1165633004: media: Add MojoCdmServiceContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 6 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: 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..7142605937cd39f80947d1b00cef51c954090ef7 100644
--- a/media/mojo/services/mojo_cdm_service.h
+++ b/media/mojo/services/mojo_cdm_service.h
@@ -11,15 +11,25 @@
#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 |context| and will be
+ // destructed when OnConnectionError() happens.
ddorwin 2015/06/08 18:33:10 nit: A function can be called but not "happen". A
xhwang 2015/06/08 22:12:33 Done.
+ static MojoCdmService* Create(
+ MojoCdmServiceContext* context,
+ const mojo::String& key_system,
+ mojo::InterfaceRequest<mojo::ContentDecryptionModule> request);
+
~MojoCdmService() final;
// mojo::ContentDecryptionModule implementation.
@@ -47,10 +57,21 @@ class MojoCdmService : public mojo::ContentDecryptionModule {
void RemoveSession(
const mojo::String& session_id,
const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final;
+ // TODO(xhwang): Rename this to GetDecryptor in the mojom interface.
ddorwin 2015/06/08 18:33:10 Is this going to be used for the desktop case only
xhwang 2015/06/08 22:12:33 Yes. I'll fix this TODO in the next CL.
void GetCdmContext(int32_t cdm_id,
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 +88,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_;

Powered by Google App Engine
This is Rietveld 408576698