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

Unified Diff: media/mojo/services/mojo_cdm_promise.h

Issue 763883006: Add Mojo CDM Service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More updates. Created 6 years 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/mojo/services/mojo_cdm_promise.h
diff --git a/media/mojo/services/mojo_cdm_promise.h b/media/mojo/services/mojo_cdm_promise.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f36d1f30f31feac0dfaa5ab3e4416da686ff8c4
--- /dev/null
+++ b/media/mojo/services/mojo_cdm_promise.h
@@ -0,0 +1,44 @@
+// 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_MOJO_SERVICES_MOJO_CDM_PROMISE_H_
+#define MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "media/base/cdm_promise.h"
+#include "media/mojo/interfaces/content_decryption_module.mojom.h"
+#include "media/mojo/services/mojo_type_trait.h"
+#include "mojo/public/cpp/bindings/array.h"
ddorwin 2014/12/12 19:25:13 Not used?
xhwang 2014/12/12 23:15:44 Done.
+#include "mojo/public/cpp/bindings/callback.h"
+#include "mojo/public/cpp/bindings/interface_impl.h"
+#include "mojo/public/cpp/bindings/string.h"
ddorwin 2014/12/12 19:25:13 Is it correct to use this for std::string?
xhwang 2014/12/12 23:15:44 Done.
+
+namespace media {
+
+// media::CdmPromiseTemplate implementations backed by mojo::Callbacks.
+template <typename... T>
+class MojoCdmPromise : public CdmPromiseTemplate<T...> {
+ public:
+ typedef mojo::Callback<void(mojo::CdmPromiseResultPtr,
+ typename MojoTypeTrait<T>::MojoType...)>
+ CallbackType;
+
+ MojoCdmPromise(const CallbackType& callback);
+ ~MojoCdmPromise() final;
+
+ // CdmPromiseTemplate<> implementation.
+ void resolve(const T&... result) final;
+ void reject(MediaKeys::Exception exception,
+ uint32 system_code,
+ const std::string& error_message) final;
+
+ private:
+ CallbackType callback_;
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_SERVICES_MOJO_CDM_PROMISE_H_

Powered by Google App Engine
This is Rietveld 408576698