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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // Must be a superset of cdm::MediaKeyException. | 56 // Must be a superset of cdm::MediaKeyException. |
| 57 enum Exception { | 57 enum Exception { |
| 58 NOT_SUPPORTED_ERROR, | 58 NOT_SUPPORTED_ERROR, |
| 59 INVALID_STATE_ERROR, | 59 INVALID_STATE_ERROR, |
| 60 INVALID_ACCESS_ERROR, | 60 INVALID_ACCESS_ERROR, |
| 61 QUOTA_EXCEEDED_ERROR, | 61 QUOTA_EXCEEDED_ERROR, |
| 62 UNKNOWN_ERROR, | 62 UNKNOWN_ERROR, |
| 63 CLIENT_ERROR, | 63 CLIENT_ERROR, |
| 64 OUTPUT_ERROR | 64 OUTPUT_ERROR, |
|
ddorwin
2015/01/14 23:09:21
The name "exception" and inclusion of "output" is
xhwang
2015/01/15 08:13:13
Acknowledged.
| |
| 65 EXCEPTION_MAX = OUTPUT_ERROR | |
|
ddorwin
2015/01/14 23:09:21
This is painful to maintain. :(
We had a conversat
xhwang
2015/01/15 08:13:13
Agreed this is ugly. It seems most enums used in I
| |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 // Type of license required when creating/loading a session. | 68 // Type of license required when creating/loading a session. |
| 68 // Must be consistent with the values specified in the spec: | 69 // Must be consistent with the values specified in the spec: |
| 69 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeySessionType | 70 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeySessionType |
| 70 enum SessionType { | 71 enum SessionType { |
| 71 TEMPORARY_SESSION, | 72 TEMPORARY_SESSION, |
| 72 PERSISTENT_LICENSE_SESSION, | 73 PERSISTENT_LICENSE_SESSION, |
| 73 PERSISTENT_RELEASE_MESSAGE_SESSION | 74 PERSISTENT_RELEASE_MESSAGE_SESSION |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 virtual ~MediaKeys(); | 77 virtual ~MediaKeys(); |
| 77 | 78 |
| 78 // Provides a server certificate to be used to encrypt messages to the | 79 // Provides a server certificate to be used to encrypt messages to the |
| 79 // license server. | 80 // license server. |
| 80 virtual void SetServerCertificate(const uint8* certificate_data, | 81 virtual void SetServerCertificate(const uint8* certificate_data, |
| 81 int certificate_data_length, | 82 int certificate_data_length, |
| 82 scoped_ptr<SimpleCdmPromise> promise) = 0; | 83 scoped_ptr<SimpleCdmPromise> promise) = 0; |
| 83 | 84 |
| 84 // Creates a session with the |init_data_type|, |init_data| and |session_type| | 85 // Creates a session with |session_type|. Then generates a request with the |
| 85 // provided. | 86 // |init_data_type| and |init_data|. |
| 86 // Note: UpdateSession() and ReleaseSession() should only be called after | 87 // Note: |
| 87 // |promise| is resolved. | 88 // 1. The session ID will be provided when the |promise| is resolved. |
| 89 // 2. The generated request should be returned through a SessionMessageCB, | |
| 90 // which must be AFTER the |promise| is resolved. Otherwise, the session ID | |
| 91 // in the callback will not be recognized. | |
| 92 // 3. UpdateSession(), CloseSession() and RemoveSession() should only be | |
| 93 // called after the |promise| is resolved. | |
| 88 virtual void CreateSessionAndGenerateRequest( | 94 virtual void CreateSessionAndGenerateRequest( |
| 89 SessionType session_type, | 95 SessionType session_type, |
| 90 const std::string& init_data_type, | 96 const std::string& init_data_type, |
| 91 const uint8* init_data, | 97 const uint8* init_data, |
| 92 int init_data_length, | 98 int init_data_length, |
| 93 scoped_ptr<NewSessionCdmPromise> promise) = 0; | 99 scoped_ptr<NewSessionCdmPromise> promise) = 0; |
| 94 | 100 |
| 95 // Loads a session with the |web_session_id| provided. | 101 // Loads a session with the |web_session_id| provided. |
| 96 // Note: UpdateSession() and ReleaseSession() should only be called after | 102 // Note: UpdateSession(), CloseSession() and RemoveSession() should only be |
| 97 // |promise| is resolved. | 103 // called after the |promise| is resolved. |
| 98 virtual void LoadSession(SessionType session_type, | 104 virtual void LoadSession(SessionType session_type, |
| 99 const std::string& web_session_id, | 105 const std::string& web_session_id, |
| 100 scoped_ptr<NewSessionCdmPromise> promise) = 0; | 106 scoped_ptr<NewSessionCdmPromise> promise) = 0; |
| 101 | 107 |
| 102 // Updates a session specified by |web_session_id| with |response|. | 108 // Updates a session specified by |web_session_id| with |response|. |
| 103 virtual void UpdateSession(const std::string& web_session_id, | 109 virtual void UpdateSession(const std::string& web_session_id, |
| 104 const uint8* response, | 110 const uint8* response, |
| 105 int response_length, | 111 int response_length, |
| 106 scoped_ptr<SimpleCdmPromise> promise) = 0; | 112 scoped_ptr<SimpleCdmPromise> promise) = 0; |
| 107 | 113 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 128 | 134 |
| 129 // Key event callbacks. See the spec for details: | 135 // Key event callbacks. See the spec for details: |
| 130 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary | 136 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary |
| 131 typedef base::Callback<void(const std::string& web_session_id, | 137 typedef base::Callback<void(const std::string& web_session_id, |
| 132 const std::vector<uint8>& message, | 138 const std::vector<uint8>& message, |
| 133 const GURL& destination_url)> SessionMessageCB; | 139 const GURL& destination_url)> SessionMessageCB; |
| 134 | 140 |
| 135 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB; | 141 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB; |
| 136 | 142 |
| 137 typedef base::Callback<void(const std::string& web_session_id, | 143 typedef base::Callback<void(const std::string& web_session_id, |
| 138 MediaKeys::Exception exception_code, | 144 MediaKeys::Exception exception, |
| 139 uint32 system_code, | 145 uint32 system_code, |
| 140 const std::string& error_message)> SessionErrorCB; | 146 const std::string& error_message)> SessionErrorCB; |
| 141 | 147 |
| 142 typedef base::Callback<void(const std::string& web_session_id, | 148 typedef base::Callback<void(const std::string& web_session_id, |
| 143 bool has_additional_usable_key, | 149 bool has_additional_usable_key, |
| 144 CdmKeysInfo keys_info)> SessionKeysChangeCB; | 150 CdmKeysInfo keys_info)> SessionKeysChangeCB; |
| 145 | 151 |
| 146 typedef base::Callback<void(const std::string& web_session_id, | 152 typedef base::Callback<void(const std::string& web_session_id, |
| 147 const base::Time& new_expiry_time)> | 153 const base::Time& new_expiry_time)> |
| 148 SessionExpirationUpdateCB; | 154 SessionExpirationUpdateCB; |
| 149 | 155 |
| 150 } // namespace media | 156 } // namespace media |
| 151 | 157 |
| 152 #endif // MEDIA_BASE_MEDIA_KEYS_H_ | 158 #endif // MEDIA_BASE_MEDIA_KEYS_H_ |
| OLD | NEW |