| 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_CLIENTS_MOJO_CDM_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ |
| 6 #define MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "media/base/cdm_context.h" | 18 #include "media/base/cdm_context.h" |
| 19 #include "media/base/cdm_initialized_promise.h" | 19 #include "media/base/cdm_initialized_promise.h" |
| 20 #include "media/base/cdm_session_tracker.h" | 20 #include "media/base/cdm_session_tracker.h" |
| 21 #include "media/base/media_keys.h" | 21 #include "media/base/content_decryption_module.h" |
| 22 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 22 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
| 23 #include "mojo/public/cpp/bindings/binding.h" | 23 #include "mojo/public/cpp/bindings/binding.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class SingleThreadTaskRunner; | 26 class SingleThreadTaskRunner; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace media { | 29 namespace media { |
| 30 | 30 |
| 31 class MojoDecryptor; | 31 class MojoDecryptor; |
| 32 | 32 |
| 33 // A MediaKeys that proxies to a mojom::ContentDecryptionModule. That | 33 // A ContentDecryptionModule that proxies to a mojom::ContentDecryptionModule. |
| 34 // mojom::ContentDecryptionModule proxies back to the MojoCdm via the | 34 // That mojom::ContentDecryptionModule proxies back to the MojoCdm via the |
| 35 // mojom::ContentDecryptionModuleClient interface. | 35 // mojom::ContentDecryptionModuleClient interface. |
| 36 class MojoCdm : public MediaKeys, | 36 class MojoCdm : public ContentDecryptionModule, |
| 37 public CdmContext, | 37 public CdmContext, |
| 38 public mojom::ContentDecryptionModuleClient { | 38 public mojom::ContentDecryptionModuleClient { |
| 39 public: | 39 public: |
| 40 using MessageType = MediaKeys::MessageType; | 40 using MessageType = ContentDecryptionModule::MessageType; |
| 41 | 41 |
| 42 static void Create( | 42 static void Create( |
| 43 const std::string& key_system, | 43 const std::string& key_system, |
| 44 const GURL& security_origin, | 44 const GURL& security_origin, |
| 45 const CdmConfig& cdm_config, | 45 const CdmConfig& cdm_config, |
| 46 mojom::ContentDecryptionModulePtr remote_cdm, | 46 mojom::ContentDecryptionModulePtr remote_cdm, |
| 47 const SessionMessageCB& session_message_cb, | 47 const SessionMessageCB& session_message_cb, |
| 48 const SessionClosedCB& session_closed_cb, | 48 const SessionClosedCB& session_closed_cb, |
| 49 const SessionKeysChangeCB& session_keys_change_cb, | 49 const SessionKeysChangeCB& session_keys_change_cb, |
| 50 const SessionExpirationUpdateCB& session_expiration_update_cb, | 50 const SessionExpirationUpdateCB& session_expiration_update_cb, |
| 51 const CdmCreatedCB& cdm_created_cb); | 51 const CdmCreatedCB& cdm_created_cb); |
| 52 | 52 |
| 53 // MediaKeys implementation. | 53 // ContentDecryptionModule implementation. |
| 54 void SetServerCertificate(const std::vector<uint8_t>& certificate, | 54 void SetServerCertificate(const std::vector<uint8_t>& certificate, |
| 55 std::unique_ptr<SimpleCdmPromise> promise) final; | 55 std::unique_ptr<SimpleCdmPromise> promise) final; |
| 56 void CreateSessionAndGenerateRequest( | 56 void CreateSessionAndGenerateRequest( |
| 57 SessionType session_type, | 57 SessionType session_type, |
| 58 EmeInitDataType init_data_type, | 58 EmeInitDataType init_data_type, |
| 59 const std::vector<uint8_t>& init_data, | 59 const std::vector<uint8_t>& init_data, |
| 60 std::unique_ptr<NewSessionCdmPromise> promise) final; | 60 std::unique_ptr<NewSessionCdmPromise> promise) final; |
| 61 void LoadSession(SessionType session_type, | 61 void LoadSession(SessionType session_type, |
| 62 const std::string& session_id, | 62 const std::string& session_id, |
| 63 std::unique_ptr<NewSessionCdmPromise> promise) final; | 63 std::unique_ptr<NewSessionCdmPromise> promise) final; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 // This must be the last member. | 160 // This must be the last member. |
| 161 base::WeakPtrFactory<MojoCdm> weak_factory_; | 161 base::WeakPtrFactory<MojoCdm> weak_factory_; |
| 162 | 162 |
| 163 DISALLOW_COPY_AND_ASSIGN(MojoCdm); | 163 DISALLOW_COPY_AND_ASSIGN(MojoCdm); |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 } // namespace media | 166 } // namespace media |
| 167 | 167 |
| 168 #endif // MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ | 168 #endif // MEDIA_MOJO_CLIENTS_MOJO_CDM_H_ |
| OLD | NEW |