| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "media/base/media_keys.h" | 12 #include "media/base/media_keys.h" |
| 13 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 13 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
| 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
| 15 | 15 |
| 16 namespace mojo { |
| 17 class AppRefCount; |
| 18 } |
| 19 |
| 16 namespace media { | 20 namespace media { |
| 17 | 21 |
| 18 class MojoCdmServiceContext; | 22 class MojoCdmServiceContext; |
| 19 | 23 |
| 20 // A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. | 24 // A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. |
| 21 class MojoCdmService : public mojo::ContentDecryptionModule { | 25 class MojoCdmService : public mojo::ContentDecryptionModule { |
| 22 public: | 26 public: |
| 23 // Constructs a MojoCdmService and strongly binds it to the |request|. | 27 // Constructs a MojoCdmService and strongly binds it to the |request|. |
| 24 MojoCdmService(MojoCdmServiceContext* context, | 28 MojoCdmService(mojo::InterfaceRequest<mojo::ContentDecryptionModule> request, |
| 25 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); | 29 MojoCdmServiceContext* context, |
| 30 scoped_ptr<mojo::AppRefCount> parent_app_refcount); |
| 26 | 31 |
| 27 ~MojoCdmService() final; | 32 ~MojoCdmService() final; |
| 28 | 33 |
| 29 // mojo::ContentDecryptionModule implementation. | 34 // mojo::ContentDecryptionModule implementation. |
| 30 void SetClient(mojo::ContentDecryptionModuleClientPtr client) final; | 35 void SetClient(mojo::ContentDecryptionModuleClientPtr client) final; |
| 31 void Initialize( | 36 void Initialize( |
| 32 const mojo::String& key_system, | 37 const mojo::String& key_system, |
| 33 const mojo::String& security_origin, | 38 const mojo::String& security_origin, |
| 34 int32_t cdm_id, | 39 int32_t cdm_id, |
| 35 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; | 40 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const base::Time& new_expiry_time); | 79 const base::Time& new_expiry_time); |
| 75 void OnSessionClosed(const std::string& session_id); | 80 void OnSessionClosed(const std::string& session_id); |
| 76 void OnLegacySessionError(const std::string& session_id, | 81 void OnLegacySessionError(const std::string& session_id, |
| 77 MediaKeys::Exception exception, | 82 MediaKeys::Exception exception, |
| 78 uint32_t system_code, | 83 uint32_t system_code, |
| 79 const std::string& error_message); | 84 const std::string& error_message); |
| 80 | 85 |
| 81 mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; | 86 mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; |
| 82 | 87 |
| 83 MojoCdmServiceContext* context_; | 88 MojoCdmServiceContext* context_; |
| 89 scoped_ptr<mojo::AppRefCount> parent_app_refcount_; |
| 84 scoped_ptr<MediaKeys> cdm_; | 90 scoped_ptr<MediaKeys> cdm_; |
| 85 | 91 |
| 86 // Set to a valid CDM ID if the |cdm_| is successfully created. | 92 // Set to a valid CDM ID if the |cdm_| is successfully created. |
| 87 int cdm_id_; | 93 int cdm_id_; |
| 88 | 94 |
| 89 mojo::ContentDecryptionModuleClientPtr client_; | 95 mojo::ContentDecryptionModuleClientPtr client_; |
| 90 | 96 |
| 91 base::WeakPtr<MojoCdmService> weak_this_; | 97 base::WeakPtr<MojoCdmService> weak_this_; |
| 92 base::WeakPtrFactory<MojoCdmService> weak_factory_; | 98 base::WeakPtrFactory<MojoCdmService> weak_factory_; |
| 93 | 99 |
| 94 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); | 100 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); |
| 95 }; | 101 }; |
| 96 | 102 |
| 97 } // namespace media | 103 } // namespace media |
| 98 | 104 |
| 99 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 105 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
| OLD | NEW |