OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_FACTORY_H_ | 5 #ifndef MEDIA_REMOTING_REMOTING_CDM_H_ |
6 #define MEDIA_MOJO_CLIENTS_MOJO_CDM_FACTORY_H_ | 6 #define MEDIA_REMOTING_REMOTING_CDM_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "media/base/cdm_context.h" |
9 #include "media/base/cdm_factory.h" | 9 #include "media/base/cdm_factory.h" |
10 | 10 #include "media/base/media_keys.h" |
11 namespace service_manager { | 11 #include "media/remoting/remoting_cdm_controller.h" |
12 namespace mojom { | |
13 class InterfaceProvider; | |
14 } | |
15 } | |
16 | 12 |
17 namespace media { | 13 namespace media { |
18 | 14 |
19 class MojoCdmFactory : public CdmFactory { | 15 // TODO(xjz): Merge this with Eric's implementation. |
16 class RemotingCdm : public MediaKeys, public CdmContext { | |
20 public: | 17 public: |
21 explicit MojoCdmFactory( | 18 RemotingCdm(const std::string& key_system, |
22 service_manager::mojom::InterfaceProvider* interface_provider); | |
23 ~MojoCdmFactory() final; | |
24 | |
25 // CdmFactory implementation. | |
26 void Create(const std::string& key_system, | |
27 const GURL& security_origin, | 19 const GURL& security_origin, |
28 const CdmConfig& cdm_config, | 20 const CdmConfig& cdm_config, |
29 const SessionMessageCB& session_message_cb, | 21 const SessionMessageCB& session_message_cb, |
30 const SessionClosedCB& session_closed_cb, | 22 const SessionClosedCB& session_closed_cb, |
31 const SessionKeysChangeCB& session_keys_change_cb, | 23 const SessionKeysChangeCB& session_keys_change_cb, |
32 const SessionExpirationUpdateCB& session_expiration_update_cb, | 24 const SessionExpirationUpdateCB& session_expiration_update_cb, |
33 const CdmCreatedCB& cdm_created_cb) final; | 25 const CdmCreatedCB& cdm_created_cb, |
26 std::unique_ptr<RemotingCdmController> remoting_controller); | |
27 | |
28 // If |cdm| is an instance of RemotingCdm, return a type-casted pointer to it. | |
29 // Otherwise, return nullptr. | |
30 static RemotingCdm* From(CdmContext* cdm); | |
31 | |
32 RemotingSourceImpl* GetRemotingSource(); | |
33 | |
34 // MediaKeys implementations. | |
35 void SetServerCertificate(const std::vector<uint8_t>& certificate, | |
36 std::unique_ptr<SimpleCdmPromise> promise) override; | |
37 void CreateSessionAndGenerateRequest( | |
38 SessionType session_type, | |
39 EmeInitDataType init_data_type, | |
40 const std::vector<uint8_t>& init_data, | |
41 std::unique_ptr<NewSessionCdmPromise> promise) override; | |
42 void LoadSession(SessionType session_type, | |
43 const std::string& session_id, | |
44 std::unique_ptr<NewSessionCdmPromise> promise) override; | |
45 void UpdateSession(const std::string& session_id, | |
46 const std::vector<uint8_t>& response, | |
47 std::unique_ptr<SimpleCdmPromise> promise) override; | |
48 void CloseSession(const std::string& session_id, | |
49 std::unique_ptr<SimpleCdmPromise> promise) override; | |
50 void RemoveSession(const std::string& session_id, | |
51 std::unique_ptr<SimpleCdmPromise> promise) override; | |
52 CdmContext* GetCdmContext() override; | |
53 | |
54 // CdmContext implementations. | |
55 Decryptor* GetDecryptor() override; | |
56 int GetCdmId() const override; | |
57 void* GetClassIdentifier() const override; | |
34 | 58 |
35 private: | 59 private: |
36 service_manager::mojom::InterfaceProvider* interface_provider_; | 60 ~RemotingCdm() override; |
61 const std::unique_ptr<RemotingCdmController> remoting_controller_; | |
xjz
2016/10/27 22:45:58
Done.
| |
37 | 62 |
38 DISALLOW_COPY_AND_ASSIGN(MojoCdmFactory); | 63 DISALLOW_COPY_AND_ASSIGN(RemotingCdm); |
39 }; | 64 }; |
40 | 65 |
41 } // namespace media | 66 } // namespace media |
42 | 67 |
43 #endif // MEDIA_MOJO_CLIENTS_MOJO_CDM_FACTORY_H_ | 68 #endif // MEDIA_REMOTING_REMOTING_CDM_H_ |
OLD | NEW |