Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / media / mojo / services / mojo_cdm_promise.h
blob8492f22fee7745ebbc1ca2351b99d8328f5b0109
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_
8 #include "base/macros.h"
9 #include "media/base/cdm_promise.h"
10 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
11 #include "media/mojo/services/mojo_type_trait.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
14 namespace media {
16 // media::CdmPromiseTemplate implementations backed by mojo::Callbacks.
17 template <typename... T>
18 class MojoCdmPromise : public CdmPromiseTemplate<T...> {
19 public:
20 typedef mojo::Callback<void(interfaces::CdmPromiseResultPtr,
21 typename MojoTypeTrait<T>::MojoType...)>
22 CallbackType;
24 MojoCdmPromise(const CallbackType& callback);
25 ~MojoCdmPromise() final;
27 // CdmPromiseTemplate<> implementation.
28 void resolve(const T&... result) final;
29 void reject(MediaKeys::Exception exception,
30 uint32_t system_code,
31 const std::string& error_message) final;
33 private:
34 using media::CdmPromiseTemplate<T...>::MarkPromiseSettled;
36 CallbackType callback_;
39 } // namespace media
41 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_