e62b7af1d84c1d5d2bfa24ff9f505c9f2fcd95ae
[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 namespace WebCore {
35
36 CDMFactoryClearKey::CDMFactoryClearKey() = default;
37 CDMFactoryClearKey::~CDMFactoryClearKey() = default;
38
39 std::unique_ptr<CDMPrivate> CDMFactoryClearKey::createCDM(CDM&)
40 {
41     return std::unique_ptr<CDMPrivate>(new CDMPrivateClearKey);
42 }
43
44 bool CDMFactoryClearKey::supportsKeySystem(const String&)
45 {
46     return false;
47 }
48
49 CDMPrivateClearKey::CDMPrivateClearKey() = default;
50 CDMPrivateClearKey::~CDMPrivateClearKey() = default;
51
52 bool CDMPrivateClearKey::supportsInitDataType(const AtomicString&) const
53 {
54     return false;
55 }
56
57 bool CDMPrivateClearKey::supportsConfiguration(const CDMKeySystemConfiguration&) const
58 {
59     return false;
60 }
61
62 bool CDMPrivateClearKey::supportsConfigurationWithRestrictions(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
63 {
64     return false;
65 }
66
67 bool CDMPrivateClearKey::supportsSessionTypeWithConfiguration(CDMSessionType&, const CDMKeySystemConfiguration&) const
68 {
69     return false;
70 }
71
72 bool CDMPrivateClearKey::supportsRobustness(const String&) const
73 {
74     return false;
75 }
76
77 CDMRequirement CDMPrivateClearKey::distinctiveIdentifiersRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
78 {
79     return CDMRequirement::Optional;
80 }
81
82 CDMRequirement CDMPrivateClearKey::persistentStateRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
83 {
84     return CDMRequirement::Optional;
85 }
86
87 bool CDMPrivateClearKey::distinctiveIdentifiersAreUniquePerOriginAndClearable(const CDMKeySystemConfiguration&) const
88 {
89     return false;
90 }
91
92 RefPtr<CDMInstance> CDMPrivateClearKey::createInstance()
93 {
94     return adoptRef(new CDMInstanceClearKey);
95 }
96
97 void CDMPrivateClearKey::loadAndInitialize()
98 {
99 }
100
101 bool CDMPrivateClearKey::supportsServerCertificates() const
102 {
103     return false;
104 }
105
106 bool CDMPrivateClearKey::supportsSessions() const
107 {
108     return false;
109 }
110
111 bool CDMPrivateClearKey::supportsInitData(const AtomicString&, const SharedBuffer&) const
112 {
113     return false;
114 }
115
116 RefPtr<SharedBuffer> CDMPrivateClearKey::sanitizeResponse(const SharedBuffer&) const
117 {
118     return nullptr;
119 }
120
121 std::optional<String> CDMPrivateClearKey::sanitizeSessionId(const String&) const
122 {
123     return std::nullopt;
124 }
125
126 CDMInstanceClearKey::CDMInstanceClearKey() = default;
127 CDMInstanceClearKey::~CDMInstanceClearKey() = default;
128
129 CDMInstance::SuccessValue CDMInstanceClearKey::initializeWithConfiguration(const CDMKeySystemConfiguration&)
130 {
131     return Failed;
132 }
133
134 CDMInstance::SuccessValue CDMInstanceClearKey::setDistinctiveIdentifiersAllowed(bool)
135 {
136     return Failed;
137 }
138
139 CDMInstance::SuccessValue CDMInstanceClearKey::setPersistentStateAllowed(bool)
140 {
141     return Failed;
142 }
143
144 CDMInstance::SuccessValue CDMInstanceClearKey::setServerCertificate(Ref<SharedBuffer>&&)
145 {
146     return Failed;
147 }
148
149 void CDMInstanceClearKey::requestLicense(LicenseType, const AtomicString&, Ref<SharedBuffer>&&, LicenseCallback)
150 {
151 }
152
153 void CDMInstanceClearKey::updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback)
154 {
155 }
156
157 void CDMInstanceClearKey::loadSession(LicenseType, const String&, const String&, LoadSessionCallback)
158 {
159 }
160
161 void CDMInstanceClearKey::closeSession(const String&, CloseSessionCallback)
162 {
163 }
164
165 void CDMInstanceClearKey::removeSessionData(const String&, LicenseType, RemoveSessionDataCallback)
166 {
167 }
168
169 void CDMInstanceClearKey::storeRecordOfKeyUsage(const String&)
170 {
171 }
172
173 } // namespace WebCore
174
175 #endif // ENABLE(ENCRYPTED_MEDIA)