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

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: Variadic Templates Created 6 years, 3 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
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..d2f7bf9d74dd482a90753c3581724eee86cbd9be
--- /dev/null
+++ b/media/base/cdm_callback_promise.h
@@ -0,0 +1,45 @@
+// 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(base::Callback<void(const T&...)> resolve_cb,
+ PromiseRejectedCB reject_cb);
xhwang 2014/10/03 07:34:21 pass callback by const-ref
jrummell 2014/10/03 18:58:30 Done.
+ 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:
+ base::Callback<void(const T&...)> resolve_cb_;
+ PromiseRejectedCB reject_cb_;
+
+ DISALLOW_COPY_AND_ASSIGN(CdmCallbackPromise);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_CDM_CALLBACK_PROMISE_H_

Powered by Google App Engine
This is Rietveld 408576698