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

Unified Diff: media/blink/new_session_cdm_result_promise.h

Issue 651113002: Move CdmResultPromise to media/blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/blink/media_blink.gyp ('k') | media/blink/new_session_cdm_result_promise.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/new_session_cdm_result_promise.h
diff --git a/media/blink/new_session_cdm_result_promise.h b/media/blink/new_session_cdm_result_promise.h
new file mode 100644
index 0000000000000000000000000000000000000000..79956cc31dd742f53432f8ce96b2407d8c5c4ca9
--- /dev/null
+++ b/media/blink/new_session_cdm_result_promise.h
@@ -0,0 +1,55 @@
+// 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_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_
+#define MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "media/base/cdm_promise.h"
+#include "media/base/media_export.h"
+#include "media/base/media_keys.h"
+#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
+
+namespace media {
+
+typedef base::Callback<blink::WebContentDecryptionModuleResult::SessionStatus(
+ const std::string& web_session_id)> SessionInitializedCB;
+
+// Special class for resolving a new session promise. Resolving a new session
+// promise returns the session ID (as a string), but the blink promise needs
+// to get passed a SessionStatus. This class converts the session id to a
+// SessionStatus by calling |new_session_created_cb|.
+class MEDIA_EXPORT NewSessionCdmResultPromise
+ : public CdmPromiseTemplate<std::string> {
+ public:
+ NewSessionCdmResultPromise(
+ const blink::WebContentDecryptionModuleResult& result,
+ const std::string& uma_name,
+ const SessionInitializedCB& new_session_created_cb);
+ virtual ~NewSessionCdmResultPromise();
+
+ // CdmPromiseTemplate<T> implementation.
+ virtual void resolve(const std::string& web_session_id) override;
+ virtual void reject(MediaKeys::Exception exception_code,
+ uint32 system_code,
+ const std::string& error_message) override;
+
+ private:
+ blink::WebContentDecryptionModuleResult web_cdm_result_;
+
+ // UMA name to report result to.
+ std::string uma_name_;
+
+ // Called on resolve() to convert the session ID into a SessionStatus to
+ // be reported to blink.
+ SessionInitializedCB new_session_created_cb_;
+
+ DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise);
+};
+
+} // namespace media
+
+#endif // MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_
« no previous file with comments | « media/blink/media_blink.gyp ('k') | media/blink/new_session_cdm_result_promise.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698