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

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: base::Time Created 6 years, 2 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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/time/time.h"
ddorwin 2014/09/25 20:54:05 This could be fwd decl'd.
jrummell 2014/09/25 21:25:55 Done.
14 #include "media/base/media_export.h" 15 #include "media/base/media_export.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace media { 18 namespace media {
18 19
19 class Decryptor; 20 class Decryptor;
20 21
21 template <typename T> 22 template <typename T>
22 class CdmPromiseTemplate; 23 class CdmPromiseTemplate;
23 24
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 enum SessionType { 66 enum SessionType {
66 TEMPORARY_SESSION, 67 TEMPORARY_SESSION,
67 PERSISTENT_SESSION 68 PERSISTENT_SESSION
68 }; 69 };
69 70
70 const static uint32 kInvalidSessionId = 0; 71 const static uint32 kInvalidSessionId = 0;
71 72
72 MediaKeys(); 73 MediaKeys();
73 virtual ~MediaKeys(); 74 virtual ~MediaKeys();
74 75
76 // Provides a server certificate to be used to encrypt messages to the
77 // license server.
78 virtual void SetServerCertificate(const uint8* certificate_data,
79 int certificate_data_length,
80 scoped_ptr<SimpleCdmPromise> promise) = 0;
81
75 // Creates a session with the |init_data_type|, |init_data| and |session_type| 82 // Creates a session with the |init_data_type|, |init_data| and |session_type|
76 // provided. 83 // provided.
77 // Note: UpdateSession() and ReleaseSession() should only be called after 84 // Note: UpdateSession() and ReleaseSession() should only be called after
78 // |promise| is resolved. 85 // |promise| is resolved.
79 virtual void CreateSession(const std::string& init_data_type, 86 virtual void CreateSession(const std::string& init_data_type,
80 const uint8* init_data, 87 const uint8* init_data,
81 int init_data_length, 88 int init_data_length,
82 SessionType session_type, 89 SessionType session_type,
83 scoped_ptr<NewSessionCdmPromise> promise) = 0; 90 scoped_ptr<NewSessionCdmPromise> promise) = 0;
84 91
85 // Loads a session with the |web_session_id| provided. 92 // Loads a session with the |web_session_id| provided.
86 // Note: UpdateSession() and ReleaseSession() should only be called after 93 // Note: UpdateSession() and ReleaseSession() should only be called after
87 // |promise| is resolved. 94 // |promise| is resolved.
88 virtual void LoadSession(const std::string& web_session_id, 95 virtual void LoadSession(const std::string& web_session_id,
89 scoped_ptr<NewSessionCdmPromise> promise) = 0; 96 scoped_ptr<NewSessionCdmPromise> promise) = 0;
90 97
91 // Updates a session specified by |web_session_id| with |response|. 98 // Updates a session specified by |web_session_id| with |response|.
92 virtual void UpdateSession(const std::string& web_session_id, 99 virtual void UpdateSession(const std::string& web_session_id,
93 const uint8* response, 100 const uint8* response,
94 int response_length, 101 int response_length,
95 scoped_ptr<SimpleCdmPromise> promise) = 0; 102 scoped_ptr<SimpleCdmPromise> promise) = 0;
96 103
97 // Releases the session specified by |web_session_id|. 104 // Closes the session specified by |web_session_id|.
98 virtual void ReleaseSession(const std::string& web_session_id, 105 virtual void CloseSession(const std::string& web_session_id,
99 scoped_ptr<SimpleCdmPromise> promise) = 0; 106 scoped_ptr<SimpleCdmPromise> promise) = 0;
107
108 // Removes stored session data associated with the session specified by
109 // |web_session_id|.
110 virtual void RemoveSession(const std::string& web_session_id,
111 scoped_ptr<SimpleCdmPromise> promise) = 0;
112
113 // Retrieves the key IDs for keys in the session that the CDM knows are
114 // currently usable to decrypt media data.
115 virtual void GetUsableKeyIds(const std::string& web_session_id,
116 scoped_ptr<KeyIdsPromise> promise) = 0;
100 117
101 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if 118 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if
102 // no Decryptor object is associated. The returned object is only guaranteed 119 // no Decryptor object is associated. The returned object is only guaranteed
103 // to be valid during the MediaKeys' lifetime. 120 // to be valid during the MediaKeys' lifetime.
104 virtual Decryptor* GetDecryptor(); 121 virtual Decryptor* GetDecryptor();
105 122
106 private: 123 private:
107 DISALLOW_COPY_AND_ASSIGN(MediaKeys); 124 DISALLOW_COPY_AND_ASSIGN(MediaKeys);
108 }; 125 };
109 126
110 // Key event callbacks. See the spec for details: 127 // 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 128 // 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, 129 typedef base::Callback<void(const std::string& web_session_id,
113 const std::vector<uint8>& message, 130 const std::vector<uint8>& message,
114 const GURL& destination_url)> SessionMessageCB; 131 const GURL& destination_url)> SessionMessageCB;
115 132
116 typedef base::Callback<void(const std::string& web_session_id)> SessionReadyCB; 133 typedef base::Callback<void(const std::string& web_session_id)> SessionReadyCB;
117 134
118 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB; 135 typedef base::Callback<void(const std::string& web_session_id)> SessionClosedCB;
119 136
120 typedef base::Callback<void(const std::string& web_session_id, 137 typedef base::Callback<void(const std::string& web_session_id,
121 MediaKeys::Exception exception_code, 138 MediaKeys::Exception exception_code,
122 uint32 system_code, 139 uint32 system_code,
123 const std::string& error_message)> SessionErrorCB; 140 const std::string& error_message)> SessionErrorCB;
124 141
142 typedef base::Callback<void(const std::string& web_session_id,
143 bool has_additional_usable_key)>
144 SessionKeysChangeCB;
145
146 typedef base::Callback<void(const std::string& web_session_id,
147 const base::Time& new_expiry_time)>
148 SessionExpirationUpdateCB;
149
125 } // namespace media 150 } // namespace media
126 151
127 #endif // MEDIA_BASE_MEDIA_KEYS_H_ 152 #endif // MEDIA_BASE_MEDIA_KEYS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698