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