| 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 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "media/base/cdm_promise.h" | 11 #include "media/base/cdm_promise.h" |
| 12 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 12 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
| 13 #include "media/mojo/services/mojo_type_trait.h" | 13 #include "media/mojo/services/mojo_type_trait.h" |
| 14 #include "mojo/public/cpp/bindings/callback.h" | 14 #include "mojo/public/cpp/bindings/callback.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 // media::CdmPromiseTemplate implementations backed by mojo::Callbacks. | 18 // media::CdmPromiseTemplate implementations backed by mojo::Callbacks. |
| 19 template <typename... T> | 19 template <typename... T> |
| 20 class MojoCdmPromise : public CdmPromiseTemplate<T...> { | 20 class MojoCdmPromise : public CdmPromiseTemplate<T...> { |
| 21 public: | 21 public: |
| 22 typedef mojo::Callback<void(interfaces::CdmPromiseResultPtr, | 22 typedef mojo::Callback<void(mojom::CdmPromiseResultPtr, |
| 23 typename MojoTypeTrait<T>::MojoType...)> | 23 typename MojoTypeTrait<T>::MojoType...)> |
| 24 CallbackType; | 24 CallbackType; |
| 25 | 25 |
| 26 MojoCdmPromise(const CallbackType& callback); | 26 MojoCdmPromise(const CallbackType& callback); |
| 27 ~MojoCdmPromise() final; | 27 ~MojoCdmPromise() final; |
| 28 | 28 |
| 29 // CdmPromiseTemplate<> implementation. | 29 // CdmPromiseTemplate<> implementation. |
| 30 void resolve(const T&... result) final; | 30 void resolve(const T&... result) final; |
| 31 void reject(MediaKeys::Exception exception, | 31 void reject(MediaKeys::Exception exception, |
| 32 uint32_t system_code, | 32 uint32_t system_code, |
| 33 const std::string& error_message) final; | 33 const std::string& error_message) final; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 using CdmPromiseTemplate<T...>::IsPromiseSettled; | 36 using CdmPromiseTemplate<T...>::IsPromiseSettled; |
| 37 using CdmPromiseTemplate<T...>::MarkPromiseSettled; | 37 using CdmPromiseTemplate<T...>::MarkPromiseSettled; |
| 38 using CdmPromiseTemplate<T...>::RejectPromiseOnDestruction; | 38 using CdmPromiseTemplate<T...>::RejectPromiseOnDestruction; |
| 39 | 39 |
| 40 CallbackType callback_; | 40 CallbackType callback_; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace media | 43 } // namespace media |
| 44 | 44 |
| 45 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_ | 45 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_ |
| OLD | NEW |