| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "media/base/media_keys.h" | 17 #include "media/base/media_keys.h" |
| 17 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 18 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
| 18 #include "media/mojo/services/media_mojo_export.h" | 19 #include "media/mojo/services/media_mojo_export.h" |
| 19 #include "media/mojo/services/mojo_cdm_promise.h" | 20 #include "media/mojo/services/mojo_cdm_promise.h" |
| 20 #include "media/mojo/services/mojo_cdm_service_context.h" | 21 #include "media/mojo/services/mojo_cdm_service_context.h" |
| 21 #include "media/mojo/services/mojo_decryptor_service.h" | 22 #include "media/mojo/services/mojo_decryptor_service.h" |
| 22 #include "mojo/public/cpp/bindings/strong_binding.h" | 23 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 23 | 24 |
| 24 namespace media { | 25 namespace media { |
| 25 | 26 |
| 26 class CdmFactory; | 27 class CdmFactory; |
| 27 | 28 |
| 28 // A mojom::ContentDecryptionModule implementation backed by a | 29 // A mojom::ContentDecryptionModule implementation backed by a |
| 29 // media::MediaKeys. | 30 // media::MediaKeys. |
| 30 class MojoCdmService : public mojom::ContentDecryptionModule { | 31 class MEDIA_MOJO_EXPORT MojoCdmService |
| 32 : NON_EXPORTED_BASE(public mojom::ContentDecryptionModule) { |
| 31 public: | 33 public: |
| 32 // Get the CDM associated with |cdm_id|, which is unique per process. | 34 // Get the CDM associated with |cdm_id|, which is unique per process. |
| 33 // Can be called on any thread. The returned CDM is not guaranteed to be | 35 // Can be called on any thread. The returned CDM is not guaranteed to be |
| 34 // thread safe. | 36 // thread safe. |
| 35 // Note: This provides a generic hack to get the CDM in the process where | 37 // Note: This provides a generic hack to get the CDM in the process where |
| 36 // MojoMediaApplication is running, regardless of which render process or | 38 // MojoMediaApplication is running, regardless of which render process or |
| 37 // render frame the caller is associated with. In the future, we should move | 39 // render frame the caller is associated with. In the future, we should move |
| 38 // all out-of-process media players into the MojoMediaApplicaiton so that we | 40 // all out-of-process media players into the MojoMediaApplicaiton so that we |
| 39 // can use MojoCdmServiceContext (per render frame) to get the CDM. | 41 // can use MojoCdmServiceContext (per render frame) to get the CDM. |
| 40 static scoped_refptr<MediaKeys> MEDIA_MOJO_EXPORT LegacyGetCdm(int cdm_id); | 42 static scoped_refptr<MediaKeys> LegacyGetCdm(int cdm_id); |
| 41 | 43 |
| 42 // Constructs a MojoCdmService and strongly binds it to the |request|. | 44 // Constructs a MojoCdmService and strongly binds it to the |request|. |
| 43 MojoCdmService( | 45 MojoCdmService( |
| 44 base::WeakPtr<MojoCdmServiceContext> context, | 46 base::WeakPtr<MojoCdmServiceContext> context, |
| 45 CdmFactory* cdm_factory, | 47 CdmFactory* cdm_factory, |
| 46 mojo::InterfaceRequest<mojom::ContentDecryptionModule> request); | 48 mojo::InterfaceRequest<mojom::ContentDecryptionModule> request); |
| 47 | 49 |
| 48 ~MojoCdmService() final; | 50 ~MojoCdmService() final; |
| 49 | 51 |
| 50 // mojom::ContentDecryptionModule implementation. | 52 // mojom::ContentDecryptionModule implementation. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 127 |
| 126 base::WeakPtr<MojoCdmService> weak_this_; | 128 base::WeakPtr<MojoCdmService> weak_this_; |
| 127 base::WeakPtrFactory<MojoCdmService> weak_factory_; | 129 base::WeakPtrFactory<MojoCdmService> weak_factory_; |
| 128 | 130 |
| 129 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); | 131 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); |
| 130 }; | 132 }; |
| 131 | 133 |
| 132 } // namespace media | 134 } // namespace media |
| 133 | 135 |
| 134 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 136 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
| OLD | NEW |