[EME] Push CDMFactory into the platform layer
[WebKit-https.git] / Source / WebCore / platform / encryptedmedia / clearkey / CDMClearKey.cpp
1 /*
2  * Copyright (C) 2016 Metrological Group B.V.
3  * Copyright (C) 2016 Igalia S.L.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above
12  *    copyright notice, this list of conditions and the following
13  *    disclaimer in the documentation and/or other materials provided
14  *    with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #include "config.h"
30 #include "CDMClearKey.h"
31
32 #if ENABLE(ENCRYPTED_MEDIA)
33
34 #include "SharedBuffer.h"
35
36 namespace WebCore {
37
38 CDMFactoryClearKey::CDMFactoryClearKey() = default;
39 CDMFactoryClearKey::~CDMFactoryClearKey() = default;
40
41 std::unique_ptr<CDMPrivate> CDMFactoryClearKey::createCDM()
42 {
43     return std::unique_ptr<CDMPrivate>(new CDMPrivateClearKey);
44 }
45
46 bool CDMFactoryClearKey::supportsKeySystem(const String&)
47 {
48     return false;
49 }
50
51 CDMPrivateClearKey::CDMPrivateClearKey() = default;
52 CDMPrivateClearKey::~CDMPrivateClearKey() = default;
53
54 bool CDMPrivateClearKey::supportsInitDataType(const AtomicString&) const
55 {
56     return false;
57 }
58
59 bool CDMPrivateClearKey::supportsConfiguration(const CDMKeySystemConfiguration&) const
60 {
61     return false;
62 }
63
64 bool CDMPrivateClearKey::supportsConfigurationWithRestrictions(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
65 {
66     return false;
67 }
68
69 bool CDMPrivateClearKey::supportsSessionTypeWithConfiguration(CDMSessionType&, const CDMKeySystemConfiguration&) const
70 {
71     return false;
72 }
73
74 bool CDMPrivateClearKey::supportsRobustness(const String&) const
75 {
76     return false;
77 }
78
79 CDMRequirement CDMPrivateClearKey::distinctiveIdentifiersRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
80 {
81     return CDMRequirement::Optional;
82 }
83
84 CDMRequirement CDMPrivateClearKey::persistentStateRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
85 {
86     return CDMRequirement::Optional;
87 }
88
89 bool CDMPrivateClearKey::distinctiveIdentifiersAreUniquePerOriginAndClearable(const CDMKeySystemConfiguration&) const
90 {
91     return false;
92 }
93
94 RefPtr<CDMInstance> CDMPrivateClearKey::createInstance()
95 {
96     return adoptRef(new CDMInstanceClearKey);
97 }
98
99 void CDMPrivateClearKey::loadAndInitialize()
100 {
101 }
102
103 bool CDMPrivateClearKey::supportsServerCertificates() const
104 {
105     return false;
106 }
107
108 bool CDMPrivateClearKey::supportsSessions() const
109 {
110     return false;
111 }
112
113 bool CDMPrivateClearKey::supportsInitData(const AtomicString&, const SharedBuffer&) const
114 {
115     return false;
116 }
117
118 RefPtr<SharedBuffer> CDMPrivateClearKey::sanitizeResponse(const SharedBuffer&) const
119 {
120     return nullptr;
121 }
122
123 std::optional<String> CDMPrivateClearKey::sanitizeSessionId(const String&) const
124 {
125     return std::nullopt;
126 }
127
128 CDMInstanceClearKey::CDMInstanceClearKey() = default;
129 CDMInstanceClearKey::~CDMInstanceClearKey() = default;
130
131 CDMInstance::SuccessValue CDMInstanceClearKey::initializeWithConfiguration(const CDMKeySystemConfiguration&)
132 {
133     return Failed;
134 }
135
136 CDMInstance::SuccessValue CDMInstanceClearKey::setDistinctiveIdentifiersAllowed(bool)
137 {
138     return Failed;
139 }
140
141 CDMInstance::SuccessValue CDMInstanceClearKey::setPersistentStateAllowed(bool)
142 {
143     return Failed;
144 }
145
146 CDMInstance::SuccessValue CDMInstanceClearKey::setServerCertificate(Ref<SharedBuffer>&&)
147 {
148     return Failed;
149 }
150
151 void CDMInstanceClearKey::requestLicense(LicenseType, const AtomicString&, Ref<SharedBuffer>&&, LicenseCallback)
152 {
153 }
154
155 void CDMInstanceClearKey::updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback)
156 {
157 }
158
159 void CDMInstanceClearKey::loadSession(LicenseType, const String&, const String&, LoadSessionCallback)
160 {
161 }
162
163 void CDMInstanceClearKey::closeSession(const String&, CloseSessionCallback)
164 {
165 }
166
167 void CDMInstanceClearKey::removeSessionData(const String&, LicenseType, RemoveSessionDataCallback)
168 {
169 }
170
171 void CDMInstanceClearKey::storeRecordOfKeyUsage(const String&)
172 {
173 }
174
175 } // namespace WebCore
176
177 #endif // ENABLE(ENCRYPTED_MEDIA)