| 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 "mojo/common/common_type_converters.h" | 13 #include "mojo/common/common_type_converters.h" |
| 14 #include "mojo/common/url_type_converters.h" | 14 #include "mojo/common/url_type_converters.h" |
| 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 namespace media { | 17 namespace media { |
| 17 | 18 |
| 18 typedef MojoCdmPromise<> SimpleMojoCdmPromise; | 19 typedef MojoCdmPromise<> SimpleMojoCdmPromise; |
| 19 typedef MojoCdmPromise<std::string> NewSessionMojoCdmPromise; | 20 typedef MojoCdmPromise<std::string> NewSessionMojoCdmPromise; |
| 20 | 21 |
| 21 MojoCdmService::MojoCdmService(const mojo::String& key_system) | 22 MojoCdmService::MojoCdmService(const mojo::String& key_system) |
| 22 : weak_factory_(this) { | 23 : weak_factory_(this) { |
| 23 base::WeakPtr<MojoCdmService> weak_this = weak_factory_.GetWeakPtr(); | 24 base::WeakPtr<MojoCdmService> weak_this = weak_factory_.GetWeakPtr(); |
| 24 | 25 |
| 25 if (CanUseAesDecryptor(key_system)) { | 26 if (CanUseAesDecryptor(key_system)) { |
| 27 // TODO(jrummell): Determine proper origin. |
| 26 cdm_.reset(new AesDecryptor( | 28 cdm_.reset(new AesDecryptor( |
| 29 GURL::EmptyGURL(), |
| 27 base::Bind(&MojoCdmService::OnSessionMessage, weak_this), | 30 base::Bind(&MojoCdmService::OnSessionMessage, weak_this), |
| 28 base::Bind(&MojoCdmService::OnSessionClosed, weak_this), | 31 base::Bind(&MojoCdmService::OnSessionClosed, weak_this), |
| 29 base::Bind(&MojoCdmService::OnSessionKeysChange, weak_this))); | 32 base::Bind(&MojoCdmService::OnSessionKeysChange, weak_this))); |
| 30 } | 33 } |
| 31 | 34 |
| 32 // TODO(xhwang): Check key system support in the app. | 35 // TODO(xhwang): Check key system support in the app. |
| 33 NOTREACHED(); | 36 NOTREACHED(); |
| 34 } | 37 } |
| 35 | 38 |
| 36 MojoCdmService::~MojoCdmService() { | 39 MojoCdmService::~MojoCdmService() { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void MojoCdmService::OnLegacySessionError(const std::string& session_id, | 149 void MojoCdmService::OnLegacySessionError(const std::string& session_id, |
| 147 MediaKeys::Exception exception, | 150 MediaKeys::Exception exception, |
| 148 uint32_t system_code, | 151 uint32_t system_code, |
| 149 const std::string& error_message) { | 152 const std::string& error_message) { |
| 150 client_->OnLegacySessionError(session_id, | 153 client_->OnLegacySessionError(session_id, |
| 151 static_cast<mojo::CdmException>(exception), | 154 static_cast<mojo::CdmException>(exception), |
| 152 system_code, error_message); | 155 system_code, error_message); |
| 153 } | 156 } |
| 154 | 157 |
| 155 } // namespace media | 158 } // namespace media |
| OLD | NEW |