Chromium Code Reviews| 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" |
|
jrummell
2015/10/29 21:05:17
#include "base/memory/ref_counted.h"?
xhwang
2015/10/30 16:20:59
Done.
| |
| 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 "media/mojo/services/mojo_cdm_promise.h" | 14 #include "media/mojo/services/mojo_cdm_promise.h" |
| 15 #include "media/mojo/services/mojo_cdm_service_context.h" | 15 #include "media/mojo/services/mojo_cdm_service_context.h" |
| 16 #include "mojo/application/public/interfaces/service_provider.mojom.h" | 16 #include "mojo/application/public/interfaces/service_provider.mojom.h" |
| 17 #include "mojo/public/cpp/bindings/strong_binding.h" | 17 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 | 20 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 void GetDecryptor( | 71 void GetDecryptor( |
| 72 mojo::InterfaceRequest<interfaces::Decryptor> decryptor) final; | 72 mojo::InterfaceRequest<interfaces::Decryptor> decryptor) final; |
| 73 | 73 |
| 74 // Get CdmContext to be used by the media pipeline. | 74 // Get CdmContext to be used by the media pipeline. |
| 75 CdmContext* GetCdmContext(); | 75 CdmContext* GetCdmContext(); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 // Callback for CdmFactory::Create(). | 78 // Callback for CdmFactory::Create(). |
| 79 void OnCdmCreated(int cdm_id, | 79 void OnCdmCreated(int cdm_id, |
| 80 scoped_ptr<MojoCdmPromise<>> promise, | 80 scoped_ptr<MojoCdmPromise<>> promise, |
| 81 scoped_ptr<MediaKeys> cdm, | 81 const scoped_refptr<MediaKeys>& cdm, |
| 82 const std::string& error_message); | 82 const std::string& error_message); |
| 83 | 83 |
| 84 // Callbacks for firing session events. | 84 // Callbacks for firing session events. |
| 85 void OnSessionMessage(const std::string& session_id, | 85 void OnSessionMessage(const std::string& session_id, |
| 86 MediaKeys::MessageType message_type, | 86 MediaKeys::MessageType message_type, |
| 87 const std::vector<uint8_t>& message, | 87 const std::vector<uint8_t>& message, |
| 88 const GURL& legacy_destination_url); | 88 const GURL& legacy_destination_url); |
| 89 void OnSessionKeysChange(const std::string& session_id, | 89 void OnSessionKeysChange(const std::string& session_id, |
| 90 bool has_additional_usable_key, | 90 bool has_additional_usable_key, |
| 91 CdmKeysInfo keys_info); | 91 CdmKeysInfo keys_info); |
| 92 void OnSessionExpirationUpdate(const std::string& session_id, | 92 void OnSessionExpirationUpdate(const std::string& session_id, |
| 93 const base::Time& new_expiry_time); | 93 const base::Time& new_expiry_time); |
| 94 void OnSessionClosed(const std::string& session_id); | 94 void OnSessionClosed(const std::string& session_id); |
| 95 void OnLegacySessionError(const std::string& session_id, | 95 void OnLegacySessionError(const std::string& session_id, |
| 96 MediaKeys::Exception exception, | 96 MediaKeys::Exception exception, |
| 97 uint32_t system_code, | 97 uint32_t system_code, |
| 98 const std::string& error_message); | 98 const std::string& error_message); |
| 99 | 99 |
| 100 mojo::StrongBinding<interfaces::ContentDecryptionModule> binding_; | 100 mojo::StrongBinding<interfaces::ContentDecryptionModule> binding_; |
| 101 base::WeakPtr<MojoCdmServiceContext> context_; | 101 base::WeakPtr<MojoCdmServiceContext> context_; |
| 102 | 102 |
| 103 mojo::ServiceProvider* service_provider_; | 103 mojo::ServiceProvider* service_provider_; |
| 104 CdmFactory* cdm_factory_; | 104 CdmFactory* cdm_factory_; |
| 105 scoped_ptr<MediaKeys> cdm_; | 105 scoped_refptr<MediaKeys> cdm_; |
| 106 | 106 |
| 107 // Set to a valid CDM ID if the |cdm_| is successfully created. | 107 // Set to a valid CDM ID if the |cdm_| is successfully created. |
| 108 int cdm_id_; | 108 int cdm_id_; |
| 109 | 109 |
| 110 interfaces::ContentDecryptionModuleClientPtr client_; | 110 interfaces::ContentDecryptionModuleClientPtr client_; |
| 111 | 111 |
| 112 base::WeakPtr<MojoCdmService> weak_this_; | 112 base::WeakPtr<MojoCdmService> weak_this_; |
| 113 base::WeakPtrFactory<MojoCdmService> weak_factory_; | 113 base::WeakPtrFactory<MojoCdmService> weak_factory_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); | 115 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace media | 118 } // namespace media |
| 119 | 119 |
| 120 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | 120 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
| OLD | NEW |