summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/media/web_content_decryption_module_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/media/web_content_decryption_module_impl.h')
-rw-r--r--chromium/third_party/blink/renderer/platform/media/web_content_decryption_module_impl.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/platform/media/web_content_decryption_module_impl.h b/chromium/third_party/blink/renderer/platform/media/web_content_decryption_module_impl.h
new file mode 100644
index 00000000000..3d53d9f54a8
--- /dev/null
+++ b/chromium/third_party/blink/renderer/platform/media/web_content_decryption_module_impl.h
@@ -0,0 +1,82 @@
+// Copyright 2013 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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_MEDIA_WEB_CONTENT_DECRYPTION_MODULE_IMPL_H_
+#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MEDIA_WEB_CONTENT_DECRYPTION_MODULE_IMPL_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "media/base/cdm_config.h"
+#include "third_party/blink/public/platform/web_content_decryption_module.h"
+#include "third_party/blink/renderer/platform/platform_export.h"
+
+namespace media {
+class CdmContextRef;
+class CdmFactory;
+struct CdmConfig;
+} // namespace media
+
+namespace blink {
+class CdmSessionAdapter;
+class WebSecurityOrigin;
+
+using WebCdmCreatedCB =
+ base::OnceCallback<void(WebContentDecryptionModule* cdm,
+ const std::string& error_message)>;
+
+class PLATFORM_EXPORT WebContentDecryptionModuleImpl
+ : public WebContentDecryptionModule {
+ public:
+ static void Create(media::CdmFactory* cdm_factory,
+ const std::u16string& key_system,
+ const WebSecurityOrigin& security_origin,
+ const media::CdmConfig& cdm_config,
+ WebCdmCreatedCB web_cdm_created_cb);
+
+ WebContentDecryptionModuleImpl(const WebContentDecryptionModuleImpl&) =
+ delete;
+ WebContentDecryptionModuleImpl& operator=(
+ const WebContentDecryptionModuleImpl&) = delete;
+ ~WebContentDecryptionModuleImpl() override;
+
+ // WebContentDecryptionModule implementation.
+ std::unique_ptr<WebContentDecryptionModuleSession> CreateSession(
+ WebEncryptedMediaSessionType session_type) override;
+ void SetServerCertificate(const uint8_t* server_certificate,
+ size_t server_certificate_length,
+ WebContentDecryptionModuleResult result) override;
+ void GetStatusForPolicy(const WebString& min_hdcp_version_string,
+ WebContentDecryptionModuleResult result) override;
+
+ std::unique_ptr<media::CdmContextRef> GetCdmContextRef();
+
+ std::string GetKeySystem() const;
+
+ media::CdmConfig GetCdmConfig() const;
+
+ private:
+ friend CdmSessionAdapter;
+
+ // Takes reference to |adapter|.
+ WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter);
+
+ scoped_refptr<CdmSessionAdapter> adapter_;
+};
+
+// Allow typecasting from blink type as this is the only implementation.
+PLATFORM_EXPORT
+inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl(
+ WebContentDecryptionModule* cdm) {
+ return static_cast<WebContentDecryptionModuleImpl*>(cdm);
+}
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_MEDIA_WEB_CONTENT_DECRYPTION_MODULE_IMPL_H_