[M120 Migration][MM][CAPI] Fix the logic for media using capi player.
[platform/framework/web/chromium-efl.git] / media / mojo / services / mojo_cdm_promise.h
1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_
7
8 #include <stdint.h>
9
10 #include "base/functional/callback.h"
11 #include "media/base/cdm_promise.h"
12
13 namespace media {
14
15 // media::CdmPromiseTemplate implementations backed by base::Callbacks.
16 // TODO(xhwang): We need a new type F to solve the issue where parameters in the
17 // callback can be passed in by value or as const-refs. Find a better solution
18 // to handle this.
19 template <typename F, typename... T>
20 class MojoCdmPromise final : public CdmPromiseTemplate<T...> {
21  public:
22   using CallbackType = base::OnceCallback<F>;
23
24   explicit MojoCdmPromise(CallbackType callback);
25   ~MojoCdmPromise() final;
26
27   // CdmPromiseTemplate<> implementation.
28
29   void resolve(const T&... result) final;
30   void reject(CdmPromise::Exception exception,
31               uint32_t system_code,
32               const std::string& error_message) final;
33
34  private:
35   using CdmPromiseTemplate<T...>::IsPromiseSettled;
36   using CdmPromiseTemplate<T...>::MarkPromiseSettled;
37   using CdmPromiseTemplate<T...>::RejectPromiseOnDestruction;
38
39   CallbackType callback_;
40 };
41
42 }  // namespace media
43
44 #endif  // MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_