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

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

Powered by Google App Engine
This is Rietveld 408576698