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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 }; | 64 }; |
65 | 65 |
66 // Type of license required when creating/loading a session. | 66 // Type of license required when creating/loading a session. |
67 // Must be consistent with the values specified in the spec: | 67 // Must be consistent with the values specified in the spec: |
68 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypte
d-media.html#extensions | 68 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypte
d-media.html#extensions |
69 enum SessionType { | 69 enum SessionType { |
70 TEMPORARY_SESSION, | 70 TEMPORARY_SESSION, |
71 PERSISTENT_SESSION | 71 PERSISTENT_SESSION |
72 }; | 72 }; |
73 | 73 |
74 const static uint32 kInvalidSessionId = 0; | 74 static const uint32 kInvalidSessionId = 0; |
| 75 #if defined(ENABLE_BROWSER_CDMS) |
| 76 static const int kInvalidCdmId = 0; |
| 77 #endif |
75 | 78 |
76 MediaKeys(); | 79 MediaKeys(); |
77 virtual ~MediaKeys(); | 80 virtual ~MediaKeys(); |
78 | 81 |
79 // Provides a server certificate to be used to encrypt messages to the | 82 // Provides a server certificate to be used to encrypt messages to the |
80 // license server. | 83 // license server. |
81 virtual void SetServerCertificate(const uint8* certificate_data, | 84 virtual void SetServerCertificate(const uint8* certificate_data, |
82 int certificate_data_length, | 85 int certificate_data_length, |
83 scoped_ptr<SimpleCdmPromise> promise) = 0; | 86 scoped_ptr<SimpleCdmPromise> promise) = 0; |
84 | 87 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Retrieves the key IDs for keys in the session that the CDM knows are | 119 // Retrieves the key IDs for keys in the session that the CDM knows are |
117 // currently usable to decrypt media data. | 120 // currently usable to decrypt media data. |
118 virtual void GetUsableKeyIds(const std::string& web_session_id, | 121 virtual void GetUsableKeyIds(const std::string& web_session_id, |
119 scoped_ptr<KeyIdsPromise> promise) = 0; | 122 scoped_ptr<KeyIdsPromise> promise) = 0; |
120 | 123 |
121 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if | 124 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if |
122 // no Decryptor object is associated. The returned object is only guaranteed | 125 // no Decryptor object is associated. The returned object is only guaranteed |
123 // to be valid during the MediaKeys' lifetime. | 126 // to be valid during the MediaKeys' lifetime. |
124 virtual Decryptor* GetDecryptor(); | 127 virtual Decryptor* GetDecryptor(); |
125 | 128 |
| 129 #if defined(ENABLE_BROWSER_CDMS) |
| 130 // Returns the CDM ID associated with |this|. May be kInvalidCdmId if no CDM |
| 131 // ID is associated. |
| 132 virtual int GetCdmId() const = 0; |
| 133 #endif |
| 134 |
126 private: | 135 private: |
127 DISALLOW_COPY_AND_ASSIGN(MediaKeys); | 136 DISALLOW_COPY_AND_ASSIGN(MediaKeys); |
128 }; | 137 }; |
129 | 138 |
130 // Key event callbacks. See the spec for details: | 139 // Key event callbacks. See the spec for details: |
131 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-
media.html#event-summary | 140 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-
media.html#event-summary |
132 typedef base::Callback<void(const std::string& web_session_id, | 141 typedef base::Callback<void(const std::string& web_session_id, |
133 const std::vector<uint8>& message, | 142 const std::vector<uint8>& message, |
134 const GURL& destination_url)> SessionMessageCB; | 143 const GURL& destination_url)> SessionMessageCB; |
135 | 144 |
(...skipping 10 matching lines...) Expand all Loading... |
146 bool has_additional_usable_key)> | 155 bool has_additional_usable_key)> |
147 SessionKeysChangeCB; | 156 SessionKeysChangeCB; |
148 | 157 |
149 typedef base::Callback<void(const std::string& web_session_id, | 158 typedef base::Callback<void(const std::string& web_session_id, |
150 const base::Time& new_expiry_time)> | 159 const base::Time& new_expiry_time)> |
151 SessionExpirationUpdateCB; | 160 SessionExpirationUpdateCB; |
152 | 161 |
153 } // namespace media | 162 } // namespace media |
154 | 163 |
155 #endif // MEDIA_BASE_MEDIA_KEYS_H_ | 164 #endif // MEDIA_BASE_MEDIA_KEYS_H_ |
OLD | NEW |