| 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.h" | 5 #include "media/mojo/services/mojo_cdm.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "media/base/cdm_key_information.h" | 9 #include "media/base/cdm_key_information.h" |
| 10 #include "media/base/cdm_promise.h" | 10 #include "media/base/cdm_promise.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 base::Passed(&promise))); | 115 base::Passed(&promise))); |
| 116 } | 116 } |
| 117 | 117 |
| 118 CdmContext* MojoCdm::GetCdmContext() { | 118 CdmContext* MojoCdm::GetCdmContext() { |
| 119 NOTIMPLEMENTED(); | 119 NOTIMPLEMENTED(); |
| 120 return nullptr; | 120 return nullptr; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void MojoCdm::OnSessionMessage(const mojo::String& session_id, | 123 void MojoCdm::OnSessionMessage(const mojo::String& session_id, |
| 124 mojo::CdmMessageType message_type, | 124 mojo::CdmMessageType message_type, |
| 125 mojo::Array<uint8_t> message) { | 125 mojo::Array<uint8_t> message, |
| 126 const mojo::String& legacy_destination_url) { |
| 127 GURL verified_gurl = GURL(legacy_destination_url); |
| 128 if (!verified_gurl.is_valid() && !verified_gurl.is_empty()) { |
| 129 DLOG(WARNING) << "SessionMessage destination_url is invalid : " |
| 130 << verified_gurl.possibly_invalid_spec(); |
| 131 verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url. |
| 132 } |
| 133 |
| 126 session_message_cb_.Run(session_id, | 134 session_message_cb_.Run(session_id, |
| 127 static_cast<MediaKeys::MessageType>(message_type), | 135 static_cast<MediaKeys::MessageType>(message_type), |
| 128 message.storage()); | 136 message.storage(), verified_gurl); |
| 129 } | 137 } |
| 130 | 138 |
| 131 void MojoCdm::OnSessionClosed(const mojo::String& session_id) { | 139 void MojoCdm::OnSessionClosed(const mojo::String& session_id) { |
| 132 session_closed_cb_.Run(session_id); | 140 session_closed_cb_.Run(session_id); |
| 133 } | 141 } |
| 134 | 142 |
| 135 void MojoCdm::OnSessionError(const mojo::String& session_id, | 143 void MojoCdm::OnSessionError(const mojo::String& session_id, |
| 136 mojo::CdmException exception, | 144 mojo::CdmException exception, |
| 137 uint32_t system_code, | 145 uint32_t system_code, |
| 138 const mojo::String& error_message) { | 146 const mojo::String& error_message) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 165 void MojoCdm::OnPromiseResult(scoped_ptr<CdmPromiseTemplate<T...>> promise, | 173 void MojoCdm::OnPromiseResult(scoped_ptr<CdmPromiseTemplate<T...>> promise, |
| 166 mojo::CdmPromiseResultPtr result, | 174 mojo::CdmPromiseResultPtr result, |
| 167 typename MojoTypeTrait<T>::MojoType... args) { | 175 typename MojoTypeTrait<T>::MojoType... args) { |
| 168 if (result->success) | 176 if (result->success) |
| 169 promise->resolve(args.template To<T>()...); // See ISO C++03 14.2/4. | 177 promise->resolve(args.template To<T>()...); // See ISO C++03 14.2/4. |
| 170 else | 178 else |
| 171 RejectPromise(promise.Pass(), result.Pass()); | 179 RejectPromise(promise.Pass(), result.Pass()); |
| 172 } | 180 } |
| 173 | 181 |
| 174 } // namespace media | 182 } // namespace media |
| OLD | NEW |