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

Unified Diff: content/renderer/media/webcontentdecryptionmoduleresult_helper.h

Issue 555223004: Update MediaKeys interface for EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + Android changes 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: content/renderer/media/webcontentdecryptionmoduleresult_helper.h
diff --git a/content/renderer/media/webcontentdecryptionmoduleresult_helper.h b/content/renderer/media/webcontentdecryptionmoduleresult_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..158a6bf38950cdd606de59d25aef5167f6149a8b
--- /dev/null
+++ b/content/renderer/media/webcontentdecryptionmoduleresult_helper.h
@@ -0,0 +1,73 @@
+// 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 CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_
+#define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_
+
+#include <map>
+
+#include "base/basictypes.h"
+#include "media/base/media_keys.h"
+#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
+
+namespace content {
+
+// Keep track of a WebContentDecryptionModuleResults as they need to be kept
+// around until the corresponding operation completes.
+class WebContentDecryptionModuleResultHelper {
+ public:
+ WebContentDecryptionModuleResultHelper();
+ virtual ~WebContentDecryptionModuleResultHelper();
+
+ // Take a copy of |result| and keep it around until needed. Returns an
+ // index that is passed to the other methods to complete the
+ // WebContentDecryptionModuleResult.
+ uint32 AddResult(blink::WebContentDecryptionModuleResult result);
+
+ // Locate the corresponding WebContentDecryptionModuleResult for
+ // |result_index|, and call complete() on it. WebContentDecryptionModuleResult
+ // is destroyed afterwards. Does nothing if |result_index| does not map to
+ // a previously saved (and unused) WebContentDecryptionModuleResult object.
+ void Complete(uint32 result_index);
+
+ // Locate the corresponding WebContentDecryptionModuleResult for
+ // |result_index|, and call completeWithSession() on it.
+ // WebContentDecryptionModuleResult is destroyed afterwards. Does nothing if
+ // |result_index| does not map to a previously saved (and unused)
+ // WebContentDecryptionModuleResult object.
+ void CompleteWithSession(
+ uint32 result_index,
+ blink::WebContentDecryptionModuleResult::SessionStatus status);
+
+ // Locate the corresponding WebContentDecryptionModuleResult for
+ // |result_index|, and call completeWithKeyIds() on it.
+ // WebContentDecryptionModuleResult is destroyed afterwards. Does nothing if
+ // |result_index| does not map to a previously saved (and unused)
+ // WebContentDecryptionModuleResult object.
+ void CompleteWithKeyIds(uint32 result_index,
+ const media::KeyIdsVector& key_ids);
+
+ // Locate the corresponding WebContentDecryptionModuleResult for
+ // |result_index|, and call completeWithError() on it.
+ // WebContentDecryptionModuleResult is destroyed afterwards. Does nothing if
+ // |result_index| does not map to a previously saved (and unused)
+ // WebContentDecryptionModuleResult object.
+ void CompleteWithError(uint32 result_index,
+ media::MediaKeys::Exception exception_code,
+ uint32 system_code,
+ const std::string& error_message);
+
+ private:
+ typedef std::map<uint32, blink::WebContentDecryptionModuleResult> ResultMap;
+
+ // Keep track of all the outstanding WebContentDecryptionModuleResult objects.
+ uint32 next_available_result_index_;
+ ResultMap outstanding_results_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleResultHelper);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698