Chromium Code Reviews| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 LICENSE_REQUEST, | 82 LICENSE_REQUEST, |
| 83 LICENSE_RENEWAL, | 83 LICENSE_RENEWAL, |
| 84 LICENSE_RELEASE, | 84 LICENSE_RELEASE, |
| 85 MESSAGE_TYPE_MAX = LICENSE_RELEASE | 85 MESSAGE_TYPE_MAX = LICENSE_RELEASE |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 virtual ~MediaKeys(); | 88 virtual ~MediaKeys(); |
| 89 | 89 |
| 90 // Provides a server certificate to be used to encrypt messages to the | 90 // Provides a server certificate to be used to encrypt messages to the |
| 91 // license server. | 91 // license server. |
| 92 virtual void SetServerCertificate(const uint8* certificate_data, | 92 virtual void SetServerCertificate(const std::vector<uint8>& certificate, |
| 93 int certificate_data_length, | |
| 94 scoped_ptr<SimpleCdmPromise> promise) = 0; | 93 scoped_ptr<SimpleCdmPromise> promise) = 0; |
| 95 | 94 |
| 96 // Creates a session with |session_type|. Then generates a request with the | 95 // Creates a session with |session_type|. Then generates a request with the |
| 97 // |init_data_type| and |init_data|. | 96 // |init_data_type| and |init_data|. |
| 98 // Note: | 97 // Note: |
| 99 // 1. The session ID will be provided when the |promise| is resolved. | 98 // 1. The session ID will be provided when the |promise| is resolved. |
| 100 // 2. The generated request should be returned through a SessionMessageCB, | 99 // 2. The generated request should be returned through a SessionMessageCB, |
| 101 // which must be AFTER the |promise| is resolved. Otherwise, the session ID | 100 // which must be AFTER the |promise| is resolved. Otherwise, the session ID |
| 102 // in the callback will not be recognized. | 101 // in the callback will not be recognized. |
| 103 // 3. UpdateSession(), CloseSession() and RemoveSession() should only be | 102 // 3. UpdateSession(), CloseSession() and RemoveSession() should only be |
| 104 // called after the |promise| is resolved. | 103 // called after the |promise| is resolved. |
| 105 virtual void CreateSessionAndGenerateRequest( | 104 virtual void CreateSessionAndGenerateRequest( |
| 106 SessionType session_type, | 105 SessionType session_type, |
| 107 EmeInitDataType init_data_type, | 106 EmeInitDataType init_data_type, |
| 108 const uint8* init_data, | 107 const std::vector<uint8>& init_data, |
| 109 int init_data_length, | |
| 110 scoped_ptr<NewSessionCdmPromise> promise) = 0; | 108 scoped_ptr<NewSessionCdmPromise> promise) = 0; |
| 111 | 109 |
| 112 // Loads a session with the |session_id| provided. | 110 // Loads a session with the |session_id| provided. |
| 113 // Note: UpdateSession(), CloseSession() and RemoveSession() should only be | 111 // Note: UpdateSession(), CloseSession() and RemoveSession() should only be |
| 114 // called after the |promise| is resolved. | 112 // called after the |promise| is resolved. |
| 115 virtual void LoadSession(SessionType session_type, | 113 virtual void LoadSession(SessionType session_type, |
| 116 const std::string& session_id, | 114 const std::string& session_id, |
| 117 scoped_ptr<NewSessionCdmPromise> promise) = 0; | 115 scoped_ptr<NewSessionCdmPromise> promise) = 0; |
| 118 | 116 |
| 119 // Updates a session specified by |session_id| with |response|. | 117 // Updates a session specified by |session_id| with |response|. |
| 120 virtual void UpdateSession(const std::string& session_id, | 118 virtual void UpdateSession(const std::string& session_id, |
| 121 const uint8* response, | 119 const std::vector<uint8>& response, |
| 122 int response_length, | |
| 123 scoped_ptr<SimpleCdmPromise> promise) = 0; | 120 scoped_ptr<SimpleCdmPromise> promise) = 0; |
| 124 | 121 |
| 125 // Closes the session specified by |session_id|. The CDM should resolve or | 122 // Closes the session specified by |session_id|. The CDM should resolve or |
| 126 // reject the |promise| when the call has been processed. This may be before | 123 // reject the |promise| when the call has been processed. This may be before |
| 127 // the session is closed. Once the session is closed, a SessionClosedCB must | 124 // the session is closed. Once the session is closed, a SessionClosedCB must |
| 128 // also be called. | 125 // also be called. |
| 129 virtual void CloseSession(const std::string& session_id, | 126 virtual void CloseSession(const std::string& session_id, |
| 130 scoped_ptr<SimpleCdmPromise> promise) = 0; | 127 scoped_ptr<SimpleCdmPromise> promise) = 0; |
| 131 | 128 |
| 132 // Removes stored session data associated with the session specified by | 129 // Removes stored session data associated with the session specified by |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 144 | 141 |
| 145 private: | 142 private: |
| 146 DISALLOW_COPY_AND_ASSIGN(MediaKeys); | 143 DISALLOW_COPY_AND_ASSIGN(MediaKeys); |
| 147 }; | 144 }; |
| 148 | 145 |
| 149 // Key event callbacks. See the spec for details: | 146 // Key event callbacks. See the spec for details: |
| 150 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary | 147 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary |
| 151 | 148 |
| 152 typedef base::Callback<void(const std::string& session_id, | 149 typedef base::Callback<void(const std::string& session_id, |
| 153 MediaKeys::MessageType message_type, | 150 MediaKeys::MessageType message_type, |
| 154 const std::vector<uint8>& message, | 151 const std::vector<uint8>& message, |
|
xhwang
2015/04/21 04:47:11
use uint8_t here as well
jrummell
2015/04/21 22:59:36
Done.
| |
| 155 const GURL& legacy_destination_url)> | 152 const GURL& legacy_destination_url)> |
| 156 SessionMessageCB; | 153 SessionMessageCB; |
| 157 | 154 |
| 158 // Called when the session specified by |session_id| is closed. Note that the | 155 // Called when the session specified by |session_id| is closed. Note that the |
| 159 // CDM may close a session at any point, such as in response to a CloseSession() | 156 // CDM may close a session at any point, such as in response to a CloseSession() |
| 160 // call, when the session is no longer needed, or when system resources are | 157 // call, when the session is no longer needed, or when system resources are |
| 161 // lost. See for details: http://w3c.github.io/encrypted-media/#session-close | 158 // lost. See for details: http://w3c.github.io/encrypted-media/#session-close |
| 162 typedef base::Callback<void(const std::string& session_id)> SessionClosedCB; | 159 typedef base::Callback<void(const std::string& session_id)> SessionClosedCB; |
| 163 | 160 |
| 164 typedef base::Callback<void(const std::string& session_id, | 161 typedef base::Callback<void(const std::string& session_id, |
| 165 MediaKeys::Exception exception, | 162 MediaKeys::Exception exception, |
| 166 uint32 system_code, | 163 uint32 system_code, |
| 167 const std::string& error_message)> | 164 const std::string& error_message)> |
| 168 LegacySessionErrorCB; | 165 LegacySessionErrorCB; |
| 169 | 166 |
| 170 typedef base::Callback<void(const std::string& session_id, | 167 typedef base::Callback<void(const std::string& session_id, |
| 171 bool has_additional_usable_key, | 168 bool has_additional_usable_key, |
| 172 CdmKeysInfo keys_info)> SessionKeysChangeCB; | 169 CdmKeysInfo keys_info)> SessionKeysChangeCB; |
| 173 | 170 |
| 174 typedef base::Callback<void(const std::string& session_id, | 171 typedef base::Callback<void(const std::string& session_id, |
| 175 const base::Time& new_expiry_time)> | 172 const base::Time& new_expiry_time)> |
| 176 SessionExpirationUpdateCB; | 173 SessionExpirationUpdateCB; |
| 177 | 174 |
| 178 } // namespace media | 175 } // namespace media |
| 179 | 176 |
| 180 #endif // MEDIA_BASE_MEDIA_KEYS_H_ | 177 #endif // MEDIA_BASE_MEDIA_KEYS_H_ |
| OLD | NEW |