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_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
10 #include "media/base/media_keys.h" | 12 #include "media/base/media_keys.h" |
11 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 13 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
12 #include "media/mojo/services/mojo_type_trait.h" | 14 #include "media/mojo/services/mojo_type_trait.h" |
13 | 15 |
14 namespace mojo { | 16 namespace mojo { |
15 class ServiceProvider; | 17 class ServiceProvider; |
16 } | 18 } |
17 | 19 |
18 namespace media { | 20 namespace media { |
19 | 21 |
20 // A MediaKeys that proxies to a mojo::ContentDecryptionModule. That | 22 // A MediaKeys that proxies to a mojo::ContentDecryptionModule. That |
21 // mojo::ContentDecryptionModule proxies back to the MojoCdm via the | 23 // mojo::ContentDecryptionModule proxies back to the MojoCdm via the |
22 // mojo::ContentDecryptionModuleClient interface. | 24 // mojo::ContentDecryptionModuleClient interface. |
23 class MojoCdm : public MediaKeys, public mojo::ContentDecryptionModuleClient { | 25 class MojoCdm : public MediaKeys, public mojo::ContentDecryptionModuleClient { |
24 public: | 26 public: |
25 // |media_renderer_provider| is a ServiceProvider from a connected | 27 // |media_renderer_provider| is a ServiceProvider from a connected |
26 // Application that is hosting a mojo::MediaRenderer. | 28 // Application that is hosting a mojo::MediaRenderer. |
27 MojoCdm(mojo::ContentDecryptionModulePtr remote_cdm, | 29 MojoCdm(mojo::ContentDecryptionModulePtr remote_cdm, |
28 const SessionMessageCB& session_message_cb, | 30 const SessionMessageCB& session_message_cb, |
29 const SessionClosedCB& session_closed_cb, | 31 const SessionClosedCB& session_closed_cb, |
30 const LegacySessionErrorCB& legacy_session_error_cb, | 32 const LegacySessionErrorCB& legacy_session_error_cb, |
31 const SessionKeysChangeCB& session_keys_change_cb, | 33 const SessionKeysChangeCB& session_keys_change_cb, |
32 const SessionExpirationUpdateCB& session_expiration_update_cb); | 34 const SessionExpirationUpdateCB& session_expiration_update_cb); |
33 ~MojoCdm() final; | 35 ~MojoCdm() final; |
34 | 36 |
35 // MediaKeys implementation. | 37 // MediaKeys implementation. |
36 void SetServerCertificate(const uint8_t* certificate_data, | 38 void SetServerCertificate(const std::vector<uint8_t>& certificate, |
37 int certificate_data_length, | |
38 scoped_ptr<SimpleCdmPromise> promise) final; | 39 scoped_ptr<SimpleCdmPromise> promise) final; |
39 void CreateSessionAndGenerateRequest( | 40 void CreateSessionAndGenerateRequest( |
40 SessionType session_type, | 41 SessionType session_type, |
41 EmeInitDataType init_data_type, | 42 EmeInitDataType init_data_type, |
42 const uint8_t* init_data, | 43 const std::vector<uint8_t>& init_data, |
43 int init_data_length, | |
44 scoped_ptr<NewSessionCdmPromise> promise) final; | 44 scoped_ptr<NewSessionCdmPromise> promise) final; |
45 void LoadSession(SessionType session_type, | 45 void LoadSession(SessionType session_type, |
46 const std::string& session_id, | 46 const std::string& session_id, |
47 scoped_ptr<NewSessionCdmPromise> promise) final; | 47 scoped_ptr<NewSessionCdmPromise> promise) final; |
48 void UpdateSession(const std::string& session_id, | 48 void UpdateSession(const std::string& session_id, |
49 const uint8_t* response, | 49 const std::vector<uint8_t>& response, |
50 int response_length, | |
51 scoped_ptr<SimpleCdmPromise> promise) final; | 50 scoped_ptr<SimpleCdmPromise> promise) final; |
52 void CloseSession(const std::string& session_id, | 51 void CloseSession(const std::string& session_id, |
53 scoped_ptr<SimpleCdmPromise> promise) final; | 52 scoped_ptr<SimpleCdmPromise> promise) final; |
54 void RemoveSession(const std::string& session_id, | 53 void RemoveSession(const std::string& session_id, |
55 scoped_ptr<SimpleCdmPromise> promise) final; | 54 scoped_ptr<SimpleCdmPromise> promise) final; |
56 CdmContext* GetCdmContext() final; | 55 CdmContext* GetCdmContext() final; |
57 | 56 |
58 private: | 57 private: |
59 // mojo::ContentDecryptionModuleClient implementation. | 58 // mojo::ContentDecryptionModuleClient implementation. |
60 void OnSessionMessage(const mojo::String& session_id, | 59 void OnSessionMessage(const mojo::String& session_id, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 SessionExpirationUpdateCB session_expiration_update_cb_; | 97 SessionExpirationUpdateCB session_expiration_update_cb_; |
99 | 98 |
100 base::WeakPtrFactory<MojoCdm> weak_factory_; | 99 base::WeakPtrFactory<MojoCdm> weak_factory_; |
101 | 100 |
102 DISALLOW_COPY_AND_ASSIGN(MojoCdm); | 101 DISALLOW_COPY_AND_ASSIGN(MojoCdm); |
103 }; | 102 }; |
104 | 103 |
105 } // namespace media | 104 } // namespace media |
106 | 105 |
107 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_H_ | 106 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_H_ |
OLD | NEW |