Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: media/base/media_keys.h

Issue 850183002: media: Support unprefixed EME API on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
65 EXCEPTION_MAX = OUTPUT_ERROR
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 // Type of message being sent to the application. 77 // Type of message being sent to the application.
77 // Must be consistent with the values specified in the spec: 78 // Must be consistent with the values specified in the spec:
78 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType 79 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType
79 enum MessageType { 80 enum MessageType {
80 LICENSE_REQUEST, 81 LICENSE_REQUEST,
81 LICENSE_RENEWAL, 82 LICENSE_RENEWAL,
82 LICENSE_RELEASE 83 LICENSE_RELEASE,
84 MESSAGE_TYPE_MAX = LICENSE_RELEASE
83 }; 85 };
84 86
85 virtual ~MediaKeys(); 87 virtual ~MediaKeys();
86 88
87 // Provides a server certificate to be used to encrypt messages to the 89 // Provides a server certificate to be used to encrypt messages to the
88 // license server. 90 // license server.
89 virtual void SetServerCertificate(const uint8* certificate_data, 91 virtual void SetServerCertificate(const uint8* certificate_data,
90 int certificate_data_length, 92 int certificate_data_length,
91 scoped_ptr<SimpleCdmPromise> promise) = 0; 93 scoped_ptr<SimpleCdmPromise> promise) = 0;
92 94
93 // Creates a session with the |init_data_type|, |init_data| and |session_type| 95 // Creates a session with |session_type|. Then generates a request with the
94 // provided. 96 // |init_data_type| and |init_data|.
95 // Note: UpdateSession() and ReleaseSession() should only be called after 97 // Note:
96 // |promise| is resolved. 98 // 1. The session ID will be provided when the |promise| is resolved.
99 // 2. The generated request should be returned through a SessionMessageCB,
100 // which must be AFTER the |promise| is resolved. Otherwise, the session ID
101 // in the callback will not be recognized.
102 // 3. UpdateSession(), CloseSession() and RemoveSession() should only be
103 // called after the |promise| is resolved.
97 virtual void CreateSessionAndGenerateRequest( 104 virtual void CreateSessionAndGenerateRequest(
98 SessionType session_type, 105 SessionType session_type,
99 const std::string& init_data_type, 106 const std::string& init_data_type,
100 const uint8* init_data, 107 const uint8* init_data,
101 int init_data_length, 108 int init_data_length,
102 scoped_ptr<NewSessionCdmPromise> promise) = 0; 109 scoped_ptr<NewSessionCdmPromise> promise) = 0;
103 110
104 // Loads a session with the |web_session_id| provided. 111 // Loads a session with the |web_session_id| provided.
105 // Note: UpdateSession() and ReleaseSession() should only be called after 112 // Note: UpdateSession(), CloseSession() and RemoveSession() should only be
106 // |promise| is resolved. 113 // called after the |promise| is resolved.
107 virtual void LoadSession(SessionType session_type, 114 virtual void LoadSession(SessionType session_type,
108 const std::string& web_session_id, 115 const std::string& web_session_id,
109 scoped_ptr<NewSessionCdmPromise> promise) = 0; 116 scoped_ptr<NewSessionCdmPromise> promise) = 0;
110 117
111 // Updates a session specified by |web_session_id| with |response|. 118 // Updates a session specified by |web_session_id| with |response|.
112 virtual void UpdateSession(const std::string& web_session_id, 119 virtual void UpdateSession(const std::string& web_session_id,
113 const uint8* response, 120 const uint8* response,
114 int response_length, 121 int response_length,
115 scoped_ptr<SimpleCdmPromise> promise) = 0; 122 scoped_ptr<SimpleCdmPromise> promise) = 0;
116 123
(...skipping 22 matching lines...) Expand all
139 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary 146 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary
140 typedef base::Callback<void(const std::string& web_session_id, 147 typedef base::Callback<void(const std::string& web_session_id,
141 MediaKeys::MessageType message_type, 148 MediaKeys::MessageType message_type,
142 const std::vector<uint8>& message, 149 const std::vector<uint8>& message,
143 const GURL& legacy_destination_url)> 150 const GURL& legacy_destination_url)>
144 SessionMessageCB; 151 SessionMessageCB;
145 152
146 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB; 153 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB;
147 154
148 typedef base::Callback<void(const std::string& web_session_id, 155 typedef base::Callback<void(const std::string& web_session_id,
149 MediaKeys::Exception exception_code, 156 MediaKeys::Exception exception,
150 uint32 system_code, 157 uint32 system_code,
151 const std::string& error_message)> SessionErrorCB; 158 const std::string& error_message)> SessionErrorCB;
152 159
153 typedef base::Callback<void(const std::string& web_session_id, 160 typedef base::Callback<void(const std::string& web_session_id,
154 bool has_additional_usable_key, 161 bool has_additional_usable_key,
155 CdmKeysInfo keys_info)> SessionKeysChangeCB; 162 CdmKeysInfo keys_info)> SessionKeysChangeCB;
156 163
157 typedef base::Callback<void(const std::string& web_session_id, 164 typedef base::Callback<void(const std::string& web_session_id,
158 const base::Time& new_expiry_time)> 165 const base::Time& new_expiry_time)>
159 SessionExpirationUpdateCB; 166 SessionExpirationUpdateCB;
160 167
161 } // namespace media 168 } // namespace media
162 169
163 #endif // MEDIA_BASE_MEDIA_KEYS_H_ 170 #endif // MEDIA_BASE_MEDIA_KEYS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698