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

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

Issue 555223004: Update MediaKeys interface for EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reorder Created 6 years, 3 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 enum SessionType { 65 enum SessionType {
66 TEMPORARY_SESSION, 66 TEMPORARY_SESSION,
67 PERSISTENT_SESSION 67 PERSISTENT_SESSION
68 }; 68 };
69 69
70 const static uint32 kInvalidSessionId = 0; 70 const static uint32 kInvalidSessionId = 0;
71 71
72 MediaKeys(); 72 MediaKeys();
73 virtual ~MediaKeys(); 73 virtual ~MediaKeys();
74 74
75 // Provide a server certificate to be used to encrypt messages to the
76 // license server.
77 virtual void SetServerCertificate(const uint8* certificate_data,
78 int certificate_data_length,
79 scoped_ptr<SimpleCdmPromise> promise) = 0;
80
75 // Creates a session with the |init_data_type|, |init_data| and |session_type| 81 // Creates a session with the |init_data_type|, |init_data| and |session_type|
76 // provided. 82 // provided.
77 // Note: UpdateSession() and ReleaseSession() should only be called after 83 // Note: UpdateSession() and ReleaseSession() should only be called after
78 // |promise| is resolved. 84 // |promise| is resolved.
79 virtual void CreateSession(const std::string& init_data_type, 85 virtual void CreateSession(const std::string& init_data_type,
80 const uint8* init_data, 86 const uint8* init_data,
81 int init_data_length, 87 int init_data_length,
82 SessionType session_type, 88 SessionType session_type,
83 scoped_ptr<NewSessionCdmPromise> promise) = 0; 89 scoped_ptr<NewSessionCdmPromise> promise) = 0;
84 90
85 // Loads a session with the |web_session_id| provided. 91 // Loads a session with the |web_session_id| provided.
86 // Note: UpdateSession() and ReleaseSession() should only be called after 92 // Note: UpdateSession() and ReleaseSession() should only be called after
87 // |promise| is resolved. 93 // |promise| is resolved.
88 virtual void LoadSession(const std::string& web_session_id, 94 virtual void LoadSession(const std::string& web_session_id,
89 scoped_ptr<NewSessionCdmPromise> promise) = 0; 95 scoped_ptr<NewSessionCdmPromise> promise) = 0;
90 96
91 // Updates a session specified by |web_session_id| with |response|. 97 // Updates a session specified by |web_session_id| with |response|.
92 virtual void UpdateSession(const std::string& web_session_id, 98 virtual void UpdateSession(const std::string& web_session_id,
93 const uint8* response, 99 const uint8* response,
94 int response_length, 100 int response_length,
95 scoped_ptr<SimpleCdmPromise> promise) = 0; 101 scoped_ptr<SimpleCdmPromise> promise) = 0;
96 102
97 // Releases the session specified by |web_session_id|. 103 // Closes the session specified by |web_session_id|.
98 virtual void ReleaseSession(const std::string& web_session_id, 104 virtual void CloseSession(const std::string& web_session_id,
99 scoped_ptr<SimpleCdmPromise> promise) = 0; 105 scoped_ptr<SimpleCdmPromise> promise) = 0;
106
107 // Remove stored session data associated with the session specified by
108 // |web_session_id|.
109 virtual void RemoveSession(const std::string& web_session_id,
110 scoped_ptr<SimpleCdmPromise> promise) = 0;
111
112 // Retrieve the key IDs for keys in the session that the CDM knows are
113 // currently usable to decrypt media data.
114 virtual void GetUsableKeyIds(const std::string& web_session_id,
115 scoped_ptr<KeyIdsPromise> promise) = 0;
100 116
101 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if 117 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if
102 // no Decryptor object is associated. The returned object is only guaranteed 118 // no Decryptor object is associated. The returned object is only guaranteed
103 // to be valid during the MediaKeys' lifetime. 119 // to be valid during the MediaKeys' lifetime.
104 virtual Decryptor* GetDecryptor(); 120 virtual Decryptor* GetDecryptor();
105 121
106 private: 122 private:
107 DISALLOW_COPY_AND_ASSIGN(MediaKeys); 123 DISALLOW_COPY_AND_ASSIGN(MediaKeys);
108 }; 124 };
109 125
110 // Key event callbacks. See the spec for details: 126 // Key event callbacks. See the spec for details:
111 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary 127 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary
112 typedef base::Callback<void(const std::string& web_session_id, 128 typedef base::Callback<void(const std::string& web_session_id,
113 const std::vector<uint8>& message, 129 const std::vector<uint8>& message,
114 const GURL& destination_url)> SessionMessageCB; 130 const GURL& destination_url)> SessionMessageCB;
115 131
116 typedef base::Callback<void(const std::string& web_session_id)> SessionReadyCB; 132 typedef base::Callback<void(const std::string& web_session_id)> SessionReadyCB;
117 133
118 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB; 134 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB;
119 135
120 typedef base::Callback<void(const std::string& web_session_id, 136 typedef base::Callback<void(const std::string& web_session_id,
121 MediaKeys::Exception exception_code, 137 MediaKeys::Exception exception_code,
122 uint32 system_code, 138 uint32 system_code,
123 const std::string& error_message)> SessionErrorCB; 139 const std::string& error_message)> SessionErrorCB;
124 140
141 typedef base::Callback<void(const std::string& web_session_id,
142 bool has_additional_usable_key)>
143 SessionKeysChangeCB;
144
145 typedef base::Callback<void(const std::string& web_session_id,
146 double new_expiry_time)> SessionExpirationChangeCB;
147
125 } // namespace media 148 } // namespace media
126 149
127 #endif // MEDIA_BASE_MEDIA_KEYS_H_ 150 #endif // MEDIA_BASE_MEDIA_KEYS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698