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/strong_binding.h" | 14 #include "mojo/application/public/interfaces/service_provider.mojom.h" |
| 15 #include "mojo/public/cpp/bindings/strong_binding.h" |
15 | 16 |
16 namespace media { | 17 namespace media { |
17 | 18 |
18 class MojoCdmServiceContext; | 19 class MojoCdmServiceContext; |
19 | 20 |
20 // A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. | 21 // A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. |
21 class MojoCdmService : public mojo::ContentDecryptionModule { | 22 class MojoCdmService : public mojo::ContentDecryptionModule { |
22 public: | 23 public: |
23 // Constructs a MojoCdmService and strongly binds it to the |request|. | 24 // Constructs a MojoCdmService and strongly binds it to the |request|. |
24 MojoCdmService(MojoCdmServiceContext* context, | 25 MojoCdmService(MojoCdmServiceContext* context, |
| 26 mojo::ServiceProvider* service_provider, |
25 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); | 27 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request); |
26 | 28 |
27 ~MojoCdmService() final; | 29 ~MojoCdmService() final; |
28 | 30 |
29 // mojo::ContentDecryptionModule implementation. | 31 // mojo::ContentDecryptionModule implementation. |
30 void SetClient(mojo::ContentDecryptionModuleClientPtr client) final; | 32 void SetClient(mojo::ContentDecryptionModuleClientPtr client) final; |
31 void Initialize( | 33 void Initialize( |
32 const mojo::String& key_system, | 34 const mojo::String& key_system, |
33 const mojo::String& security_origin, | 35 const mojo::String& security_origin, |
34 int32_t cdm_id, | 36 int32_t cdm_id, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 CdmKeysInfo keys_info); | 74 CdmKeysInfo keys_info); |
73 void OnSessionExpirationUpdate(const std::string& session_id, | 75 void OnSessionExpirationUpdate(const std::string& session_id, |
74 const base::Time& new_expiry_time); | 76 const base::Time& new_expiry_time); |
75 void OnSessionClosed(const std::string& session_id); | 77 void OnSessionClosed(const std::string& session_id); |
76 void OnLegacySessionError(const std::string& session_id, | 78 void OnLegacySessionError(const std::string& session_id, |
77 MediaKeys::Exception exception, | 79 MediaKeys::Exception exception, |
78 uint32_t system_code, | 80 uint32_t system_code, |
79 const std::string& error_message); | 81 const std::string& error_message); |
80 | 82 |
81 mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; | 83 mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; |
82 | |
83 MojoCdmServiceContext* context_; | 84 MojoCdmServiceContext* context_; |
| 85 mojo::ServiceProvider* service_provider_; |
84 scoped_ptr<MediaKeys> cdm_; | 86 scoped_ptr<MediaKeys> cdm_; |
85 | 87 |
86 // Set to a valid CDM ID if the |cdm_| is successfully created. | 88 // Set to a valid CDM ID if the |cdm_| is successfully created. |
87 int cdm_id_; | 89 int cdm_id_; |
88 | 90 |
89 mojo::ContentDecryptionModuleClientPtr client_; | 91 mojo::ContentDecryptionModuleClientPtr client_; |
90 | 92 |
91 base::WeakPtr<MojoCdmService> weak_this_; | 93 base::WeakPtr<MojoCdmService> weak_this_; |
92 base::WeakPtrFactory<MojoCdmService> weak_factory_; | 94 base::WeakPtrFactory<MojoCdmService> weak_factory_; |
93 | 95 |
94 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); | 96 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); |
95 }; | 97 }; |
96 | 98 |
97 } // namespace media | 99 } // namespace media |
98 | 100 |
99 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 101 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
OLD | NEW |