| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 session_keys_change_cb_.Run(session_id, has_additional_usable_key, | 162 session_keys_change_cb_.Run(session_id, has_additional_usable_key, |
| 163 key_data.Pass()); | 163 key_data.Pass()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void MojoCdm::OnSessionExpirationUpdate(const mojo::String& session_id, | 166 void MojoCdm::OnSessionExpirationUpdate(const mojo::String& session_id, |
| 167 int64_t new_expiry_time_usec) { | 167 int64_t new_expiry_time_usec) { |
| 168 session_expiration_update_cb_.Run( | 168 session_expiration_update_cb_.Run( |
| 169 session_id, base::Time::FromInternalValue(new_expiry_time_usec)); | 169 session_id, base::Time::FromInternalValue(new_expiry_time_usec)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 template <typename... T> | |
| 173 void MojoCdm::OnPromiseResult(scoped_ptr<CdmPromiseTemplate<T...>> promise, | |
| 174 mojo::CdmPromiseResultPtr result, | |
| 175 typename MojoTypeTrait<T>::MojoType... args) { | |
| 176 if (result->success) | |
| 177 promise->resolve(args.template To<T>()...); // See ISO C++03 14.2/4. | |
| 178 else | |
| 179 RejectPromise(promise.Pass(), result.Pass()); | |
| 180 } | |
| 181 | |
| 182 } // namespace media | 172 } // namespace media |
| OLD | NEW |