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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 CdmKeysInfo keys_info); | 76 CdmKeysInfo keys_info); |
75 void OnSessionExpirationUpdate(const std::string& session_id, | 77 void OnSessionExpirationUpdate(const std::string& session_id, |
76 const base::Time& new_expiry_time); | 78 const base::Time& new_expiry_time); |
77 void OnSessionClosed(const std::string& session_id); | 79 void OnSessionClosed(const std::string& session_id); |
78 void OnLegacySessionError(const std::string& session_id, | 80 void OnLegacySessionError(const std::string& session_id, |
79 MediaKeys::Exception exception, | 81 MediaKeys::Exception exception, |
80 uint32_t system_code, | 82 uint32_t system_code, |
81 const std::string& error_message); | 83 const std::string& error_message); |
82 | 84 |
83 mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; | 85 mojo::StrongBinding<mojo::ContentDecryptionModule> binding_; |
84 | |
85 MojoCdmServiceContext* context_; | 86 MojoCdmServiceContext* context_; |
| 87 mojo::ServiceProvider* service_provider_; |
86 scoped_ptr<MediaKeys> cdm_; | 88 scoped_ptr<MediaKeys> cdm_; |
87 | 89 |
88 // Set to a valid CDM ID if the |cdm_| is successfully created. | 90 // Set to a valid CDM ID if the |cdm_| is successfully created. |
89 int cdm_id_; | 91 int cdm_id_; |
90 | 92 |
91 mojo::ContentDecryptionModuleClientPtr client_; | 93 mojo::ContentDecryptionModuleClientPtr client_; |
92 | 94 |
93 base::WeakPtr<MojoCdmService> weak_this_; | 95 base::WeakPtr<MojoCdmService> weak_this_; |
94 base::WeakPtrFactory<MojoCdmService> weak_factory_; | 96 base::WeakPtrFactory<MojoCdmService> weak_factory_; |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); | 98 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); |
97 }; | 99 }; |
98 | 100 |
99 } // namespace media | 101 } // namespace media |
100 | 102 |
101 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 103 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
OLD | NEW |