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