Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: media/base/cdm_callback_promise.h

Issue 604283003: Refactor CdmPromise and related classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + override Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/BUILD.gn ('k') | media/base/cdm_callback_promise.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/cdm_callback_promise.h
diff --git a/media/base/cdm_callback_promise.h b/media/base/cdm_callback_promise.h
new file mode 100644
index 0000000000000000000000000000000000000000..e08d95f35cad06d06ac2c20ac20bcb90dd6b6c94
--- /dev/null
+++ b/media/base/cdm_callback_promise.h
@@ -0,0 +1,47 @@
+// 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 <string>
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "media/base/cdm_promise.h"
+#include "media/base/media_export.h"
+#include "media/base/media_keys.h"
+
+namespace media {
+
+typedef base::Callback<void(MediaKeys::Exception exception_code,
+ uint32 system_code,
+ const std::string& error_message)>
+ PromiseRejectedCB;
+
+template <typename... T>
+class MEDIA_EXPORT CdmCallbackPromise : public CdmPromiseTemplate<T...> {
+ public:
+ CdmCallbackPromise(const base::Callback<void(const T&...)>& resolve_cb,
+ const PromiseRejectedCB& reject_cb);
+ virtual ~CdmCallbackPromise();
+
+ // CdmPromiseTemplate<T> implementation.
+ virtual void resolve(const T&... result) override;
+ virtual void reject(MediaKeys::Exception exception_code,
+ uint32 system_code,
+ const std::string& error_message) override;
+
+ private:
+ using media::CdmPromiseTemplate<T...>::MarkPromiseSettled;
+
+ base::Callback<void(const T&...)> resolve_cb_;
+ PromiseRejectedCB reject_cb_;
+
+ DISALLOW_COPY_AND_ASSIGN(CdmCallbackPromise);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_CDM_CALLBACK_PROMISE_H_
« no previous file with comments | « media/base/BUILD.gn ('k') | media/base/cdm_callback_promise.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698