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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "media/base/media_keys.h" | 12 #include "media/base/media_keys.h" |
13 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 13 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
14 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" | 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 // A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. | 18 // A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. |
19 class MojoCdmService | 19 class MojoCdmService : public mojo::ContentDecryptionModule { |
20 : public mojo::InterfaceImpl<mojo::ContentDecryptionModule> { | |
21 public: | 20 public: |
22 MojoCdmService(const mojo::String& key_system); | 21 MojoCdmService(const mojo::String& key_system, |
| 22 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); |
23 ~MojoCdmService() final; | 23 ~MojoCdmService() final; |
24 | 24 |
25 // mojo::ContentDecryptionModule implementation. | 25 // mojo::ContentDecryptionModule implementation. |
26 void SetClient(mojo::ContentDecryptionModuleClientPtr client) final; | 26 void SetClient(mojo::ContentDecryptionModuleClientPtr client) final; |
27 void SetServerCertificate( | 27 void SetServerCertificate( |
28 mojo::Array<uint8_t> certificate_data, | 28 mojo::Array<uint8_t> certificate_data, |
29 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; | 29 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; |
30 void CreateSessionAndGenerateRequest( | 30 void CreateSessionAndGenerateRequest( |
31 mojo::ContentDecryptionModule::SessionType session_type, | 31 mojo::ContentDecryptionModule::SessionType session_type, |
32 mojo::ContentDecryptionModule::InitDataType init_data_type, | 32 mojo::ContentDecryptionModule::InitDataType init_data_type, |
(...skipping 27 matching lines...) Expand all Loading... |
60 bool has_additional_usable_key, | 60 bool has_additional_usable_key, |
61 CdmKeysInfo keys_info); | 61 CdmKeysInfo keys_info); |
62 void OnSessionExpirationUpdate(const std::string& session_id, | 62 void OnSessionExpirationUpdate(const std::string& session_id, |
63 const base::Time& new_expiry_time); | 63 const base::Time& new_expiry_time); |
64 void OnSessionClosed(const std::string& session_id); | 64 void OnSessionClosed(const std::string& session_id); |
65 void OnLegacySessionError(const std::string& session_id, | 65 void OnLegacySessionError(const std::string& session_id, |
66 MediaKeys::Exception exception, | 66 MediaKeys::Exception exception, |
67 uint32_t system_code, | 67 uint32_t system_code, |
68 const std::string& error_message); | 68 const std::string& error_message); |
69 | 69 |
| 70 mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; |
| 71 |
70 scoped_ptr<MediaKeys> cdm_; | 72 scoped_ptr<MediaKeys> cdm_; |
71 | 73 |
72 mojo::ContentDecryptionModuleClientPtr client_; | 74 mojo::ContentDecryptionModuleClientPtr client_; |
73 | 75 |
74 base::WeakPtr<MojoCdmService> weak_this_; | 76 base::WeakPtr<MojoCdmService> weak_this_; |
75 base::WeakPtrFactory<MojoCdmService> weak_factory_; | 77 base::WeakPtrFactory<MojoCdmService> weak_factory_; |
76 | 78 |
77 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); | 79 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); |
78 }; | 80 }; |
79 | 81 |
80 } // namespace media | 82 } // namespace media |
81 | 83 |
82 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 84 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
OLD | NEW |