// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_BASE_CDM_CALLBACK_PROMISE_H_ #define MEDIA_BASE_CDM_CALLBACK_PROMISE_H_ #include #include #include "base/callback.h" #include "base/macros.h" #include "media/base/cdm_promise.h" // TODO(xhwang): Remove this include after http://crbug.com/656706 is fixed. #include "media/base/content_decryption_module.h" #include "media/base/media_export.h" namespace media { typedef base::Callback PromiseRejectedCB; template class MEDIA_EXPORT CdmCallbackPromise : public CdmPromiseTemplate { public: CdmCallbackPromise(const base::Callback& resolve_cb, const PromiseRejectedCB& reject_cb); virtual ~CdmCallbackPromise(); // CdmPromiseTemplate implementation. virtual void resolve(const T&... result) override; virtual void reject(CdmPromise::Exception exception_code, uint32_t system_code, const std::string& error_message) override; private: using CdmPromiseTemplate::IsPromiseSettled; using CdmPromiseTemplate::MarkPromiseSettled; using CdmPromiseTemplate::RejectPromiseOnDestruction; base::Callback resolve_cb_; PromiseRejectedCB reject_cb_; DISALLOW_COPY_AND_ASSIGN(CdmCallbackPromise); }; } // namespace media #endif // MEDIA_BASE_CDM_CALLBACK_PROMISE_H_