| 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 #include "media/mojo/services/mojo_cdm_service.h" | 5 #include "media/mojo/services/mojo_cdm_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "media/base/cdm_key_information.h" | 8 #include "media/base/cdm_key_information.h" |
| 9 #include "media/base/key_systems.h" | 9 #include "media/base/key_systems.h" |
| 10 #include "media/cdm/aes_decryptor.h" | 10 #include "media/cdm/aes_decryptor.h" |
| 11 #include "media/mojo/services/media_type_converters.h" | 11 #include "media/mojo/services/media_type_converters.h" |
| 12 #include "media/mojo/services/mojo_cdm_promise.h" | 12 #include "media/mojo/services/mojo_cdm_promise.h" |
| 13 #include "media/mojo/services/mojo_cdm_service_context.h" | 13 #include "media/mojo/services/mojo_cdm_service_context.h" |
| 14 #include "mojo/common/common_type_converters.h" | 14 #include "mojo/common/common_type_converters.h" |
| 15 #include "mojo/common/url_type_converters.h" | 15 #include "mojo/common/url_type_converters.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 namespace media { | 18 namespace media { |
| 19 | 19 |
| 20 typedef MojoCdmPromise<> SimpleMojoCdmPromise; | 20 typedef MojoCdmPromise<> SimpleMojoCdmPromise; |
| 21 typedef MojoCdmPromise<std::string> NewSessionMojoCdmPromise; | 21 typedef MojoCdmPromise<std::string> NewSessionMojoCdmPromise; |
| 22 | 22 |
| 23 MojoCdmService::MojoCdmService( | 23 MojoCdmService::MojoCdmService( |
| 24 MojoCdmServiceContext* context, | 24 MojoCdmServiceContext* context, |
| 25 mojo::ServiceProvider* service_provider, |
| 25 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request) | 26 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request) |
| 26 : binding_(this, request.Pass()), | 27 : binding_(this, request.Pass()), |
| 27 context_(context), | 28 context_(context), |
| 29 service_provider_(service_provider), |
| 28 cdm_id_(CdmContext::kInvalidCdmId), | 30 cdm_id_(CdmContext::kInvalidCdmId), |
| 29 weak_factory_(this) { | 31 weak_factory_(this) { |
| 30 } | 32 } |
| 31 | 33 |
| 32 MojoCdmService::~MojoCdmService() { | 34 MojoCdmService::~MojoCdmService() { |
| 33 if (cdm_id_ != CdmContext::kInvalidCdmId) | 35 if (cdm_id_ != CdmContext::kInvalidCdmId) |
| 34 context_->UnregisterCdm(cdm_id_); | 36 context_->UnregisterCdm(cdm_id_); |
| 35 } | 37 } |
| 36 | 38 |
| 37 void MojoCdmService::SetClient(mojo::ContentDecryptionModuleClientPtr client) { | 39 void MojoCdmService::SetClient(mojo::ContentDecryptionModuleClientPtr client) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 MediaKeys::Exception exception, | 179 MediaKeys::Exception exception, |
| 178 uint32_t system_code, | 180 uint32_t system_code, |
| 179 const std::string& error_message) { | 181 const std::string& error_message) { |
| 180 DVLOG(2) << __FUNCTION__; | 182 DVLOG(2) << __FUNCTION__; |
| 181 client_->OnLegacySessionError(session_id, | 183 client_->OnLegacySessionError(session_id, |
| 182 static_cast<mojo::CdmException>(exception), | 184 static_cast<mojo::CdmException>(exception), |
| 183 system_code, error_message); | 185 system_code, error_message); |
| 184 } | 186 } |
| 185 | 187 |
| 186 } // namespace media | 188 } // namespace media |
| OLD | NEW |