OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_MEDIA_KEYS_H_ | 5 #ifndef MEDIA_BASE_MEDIA_KEYS_H_ |
6 #define MEDIA_BASE_MEDIA_KEYS_H_ | 6 #define MEDIA_BASE_MEDIA_KEYS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // that thread. For example, if the CDM supports a Decryptor interface, the | 59 // that thread. For example, if the CDM supports a Decryptor interface, the |
60 // Decryptor methods could be called on a different thread. The CDM | 60 // Decryptor methods could be called on a different thread. The CDM |
61 // implementation should make sure it's thread safe for these situations. | 61 // implementation should make sure it's thread safe for these situations. |
62 // | 62 // |
63 // TODO(xhwang): Rename MediaKeys to ContentDecryptionModule. See | 63 // TODO(xhwang): Rename MediaKeys to ContentDecryptionModule. See |
64 // http://crbug.com/309237 | 64 // http://crbug.com/309237 |
65 | 65 |
66 class MEDIA_EXPORT MediaKeys | 66 class MEDIA_EXPORT MediaKeys |
67 : public base::RefCountedThreadSafe<MediaKeys, MediaKeysTraits> { | 67 : public base::RefCountedThreadSafe<MediaKeys, MediaKeysTraits> { |
68 public: | 68 public: |
69 // Reported to UMA, so never reuse a value! | 69 // TODO(xhwang): Remove after prefixed EME support is removed. See |
70 // Must be kept in sync with blink::WebMediaPlayerClient::MediaKeyErrorCode | 70 // http://crbug.com/249976 |
71 // (enforced in webmediaplayer_impl.cc). | |
72 // TODO(jrummell): Can this be moved to proxy_decryptor as it should only be | |
73 // used by the prefixed EME code? | |
74 enum KeyError { | |
75 kUnknownError = 1, | |
76 kClientError, | |
77 // The commented v0.1b values below have never been used. | |
78 // kServiceError, | |
79 kOutputError = 4, | |
80 // kHardwareChangeError, | |
81 // kDomainError, | |
82 kMaxKeyError // Must be last and greater than any legit value. | |
83 }; | |
84 | |
85 // Must be a superset of cdm::MediaKeyException. | 71 // Must be a superset of cdm::MediaKeyException. |
86 enum Exception { | 72 enum Exception { |
87 NOT_SUPPORTED_ERROR, | 73 NOT_SUPPORTED_ERROR, |
88 INVALID_STATE_ERROR, | 74 INVALID_STATE_ERROR, |
89 INVALID_ACCESS_ERROR, | 75 INVALID_ACCESS_ERROR, |
90 QUOTA_EXCEEDED_ERROR, | 76 QUOTA_EXCEEDED_ERROR, |
91 UNKNOWN_ERROR, | 77 UNKNOWN_ERROR, |
92 CLIENT_ERROR, | 78 CLIENT_ERROR, |
93 OUTPUT_ERROR, | 79 OUTPUT_ERROR, |
94 EXCEPTION_MAX = OUTPUT_ERROR | 80 EXCEPTION_MAX = OUTPUT_ERROR |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 static void Destruct(const MediaKeys* media_keys); | 172 static void Destruct(const MediaKeys* media_keys); |
187 }; | 173 }; |
188 | 174 |
189 // CDM session event callbacks. | 175 // CDM session event callbacks. |
190 | 176 |
191 // Called when the CDM needs to queue a message event to the session object. | 177 // Called when the CDM needs to queue a message event to the session object. |
192 // See http://w3c.github.io/encrypted-media/#dom-evt-message | 178 // See http://w3c.github.io/encrypted-media/#dom-evt-message |
193 typedef base::Callback<void(const std::string& session_id, | 179 typedef base::Callback<void(const std::string& session_id, |
194 MediaKeys::MessageType message_type, | 180 MediaKeys::MessageType message_type, |
195 const std::vector<uint8_t>& message, | 181 const std::vector<uint8_t>& message, |
| 182 // TODO(ddorwin): Remove. https://crbug.com/249976 |
196 const GURL& legacy_destination_url)> | 183 const GURL& legacy_destination_url)> |
197 SessionMessageCB; | 184 SessionMessageCB; |
198 | 185 |
199 // Called when the session specified by |session_id| is closed. Note that the | 186 // Called when the session specified by |session_id| is closed. Note that the |
200 // CDM may close a session at any point, such as in response to a CloseSession() | 187 // CDM may close a session at any point, such as in response to a CloseSession() |
201 // call, when the session is no longer needed, or when system resources are | 188 // call, when the session is no longer needed, or when system resources are |
202 // lost. See http://w3c.github.io/encrypted-media/#session-close | 189 // lost. See http://w3c.github.io/encrypted-media/#session-close |
203 typedef base::Callback<void(const std::string& session_id)> SessionClosedCB; | 190 typedef base::Callback<void(const std::string& session_id)> SessionClosedCB; |
204 | 191 |
205 // TODO(xhwang): Remove after prefixed EME support is removed. See | 192 // TODO(xhwang): Remove after prefixed EME support is removed. See |
(...skipping 12 matching lines...) Expand all Loading... |
218 | 205 |
219 // Called when the CDM changes the expiration time of a session. | 206 // Called when the CDM changes the expiration time of a session. |
220 // See http://w3c.github.io/encrypted-media/#update-expiration | 207 // See http://w3c.github.io/encrypted-media/#update-expiration |
221 typedef base::Callback<void(const std::string& session_id, | 208 typedef base::Callback<void(const std::string& session_id, |
222 const base::Time& new_expiry_time)> | 209 const base::Time& new_expiry_time)> |
223 SessionExpirationUpdateCB; | 210 SessionExpirationUpdateCB; |
224 | 211 |
225 } // namespace media | 212 } // namespace media |
226 | 213 |
227 #endif // MEDIA_BASE_MEDIA_KEYS_H_ | 214 #endif // MEDIA_BASE_MEDIA_KEYS_H_ |
OLD | NEW |