| 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_config.h" | 8 #include "media/base/cdm_config.h" |
| 9 #include "media/base/cdm_context.h" | 9 #include "media/base/cdm_context.h" |
| 10 #include "media/base/cdm_factory.h" | 10 #include "media/base/cdm_factory.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void MojoCdmService::GetDecryptor( | 133 void MojoCdmService::GetDecryptor( |
| 134 mojo::InterfaceRequest<interfaces::Decryptor> decryptor) { | 134 mojo::InterfaceRequest<interfaces::Decryptor> decryptor) { |
| 135 NOTIMPLEMENTED(); | 135 NOTIMPLEMENTED(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 CdmContext* MojoCdmService::GetCdmContext() { | 138 CdmContext* MojoCdmService::GetCdmContext() { |
| 139 return cdm_->GetCdmContext(); | 139 return cdm_->GetCdmContext(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void MojoCdmService::OnCdmCreated(scoped_ptr<CdmIdMojoCdmPromise> promise, | 142 void MojoCdmService::OnCdmCreated(scoped_ptr<CdmIdMojoCdmPromise> promise, |
| 143 scoped_ptr<MediaKeys> cdm, | 143 const scoped_refptr<MediaKeys>& cdm, |
| 144 const std::string& error_message) { | 144 const std::string& error_message) { |
| 145 // TODO(xhwang): This should not happen when KeySystemInfo is properly | 145 // TODO(xhwang): This should not happen when KeySystemInfo is properly |
| 146 // populated. See http://crbug.com/469366 | 146 // populated. See http://crbug.com/469366 |
| 147 if (!cdm || !context_) { | 147 if (!cdm || !context_) { |
| 148 promise->reject(MediaKeys::NOT_SUPPORTED_ERROR, 0, error_message); | 148 promise->reject(MediaKeys::NOT_SUPPORTED_ERROR, 0, error_message); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 | 151 |
| 152 cdm_ = cdm.Pass(); | 152 cdm_ = cdm; |
| 153 cdm_id_ = next_cdm_id_++; | 153 cdm_id_ = next_cdm_id_++; |
| 154 context_->RegisterCdm(cdm_id_, this); | 154 context_->RegisterCdm(cdm_id_, this); |
| 155 promise->resolve(cdm_id_); | 155 promise->resolve(cdm_id_); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void MojoCdmService::OnSessionMessage(const std::string& session_id, | 158 void MojoCdmService::OnSessionMessage(const std::string& session_id, |
| 159 MediaKeys::MessageType message_type, | 159 MediaKeys::MessageType message_type, |
| 160 const std::vector<uint8_t>& message, | 160 const std::vector<uint8_t>& message, |
| 161 const GURL& legacy_destination_url) { | 161 const GURL& legacy_destination_url) { |
| 162 DVLOG(2) << __FUNCTION__; | 162 DVLOG(2) << __FUNCTION__; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 MediaKeys::Exception exception, | 194 MediaKeys::Exception exception, |
| 195 uint32_t system_code, | 195 uint32_t system_code, |
| 196 const std::string& error_message) { | 196 const std::string& error_message) { |
| 197 DVLOG(2) << __FUNCTION__; | 197 DVLOG(2) << __FUNCTION__; |
| 198 client_->OnLegacySessionError( | 198 client_->OnLegacySessionError( |
| 199 session_id, static_cast<interfaces::CdmException>(exception), system_code, | 199 session_id, static_cast<interfaces::CdmException>(exception), system_code, |
| 200 error_message); | 200 error_message); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace media | 203 } // namespace media |
| OLD | NEW |