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

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

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: android Created 4 years, 7 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 | « media/base/media_file_checker.cc ('k') | media/base/media_log.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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "media/base/eme_constants.h" 18 #include "media/base/eme_constants.h"
19 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 namespace base { 22 namespace base {
23 class Time; 23 class Time;
24 } 24 }
25 25
26 namespace media { 26 namespace media {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType 95 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType
96 enum MessageType { 96 enum MessageType {
97 LICENSE_REQUEST, 97 LICENSE_REQUEST,
98 LICENSE_RENEWAL, 98 LICENSE_RENEWAL,
99 LICENSE_RELEASE, 99 LICENSE_RELEASE,
100 MESSAGE_TYPE_MAX = LICENSE_RELEASE 100 MESSAGE_TYPE_MAX = LICENSE_RELEASE
101 }; 101 };
102 102
103 // Provides a server certificate to be used to encrypt messages to the 103 // Provides a server certificate to be used to encrypt messages to the
104 // license server. 104 // license server.
105 virtual void SetServerCertificate(const std::vector<uint8_t>& certificate, 105 virtual void SetServerCertificate(
106 scoped_ptr<SimpleCdmPromise> promise) = 0; 106 const std::vector<uint8_t>& certificate,
107 std::unique_ptr<SimpleCdmPromise> promise) = 0;
107 108
108 // Creates a session with |session_type|. Then generates a request with the 109 // Creates a session with |session_type|. Then generates a request with the
109 // |init_data_type| and |init_data|. 110 // |init_data_type| and |init_data|.
110 // Note: 111 // Note:
111 // 1. The session ID will be provided when the |promise| is resolved. 112 // 1. The session ID will be provided when the |promise| is resolved.
112 // 2. The generated request should be returned through a SessionMessageCB, 113 // 2. The generated request should be returned through a SessionMessageCB,
113 // which must be AFTER the |promise| is resolved. Otherwise, the session ID 114 // which must be AFTER the |promise| is resolved. Otherwise, the session ID
114 // in the callback will not be recognized. 115 // in the callback will not be recognized.
115 // 3. UpdateSession(), CloseSession() and RemoveSession() should only be 116 // 3. UpdateSession(), CloseSession() and RemoveSession() should only be
116 // called after the |promise| is resolved. 117 // called after the |promise| is resolved.
117 virtual void CreateSessionAndGenerateRequest( 118 virtual void CreateSessionAndGenerateRequest(
118 SessionType session_type, 119 SessionType session_type,
119 EmeInitDataType init_data_type, 120 EmeInitDataType init_data_type,
120 const std::vector<uint8_t>& init_data, 121 const std::vector<uint8_t>& init_data,
121 scoped_ptr<NewSessionCdmPromise> promise) = 0; 122 std::unique_ptr<NewSessionCdmPromise> promise) = 0;
122 123
123 // Loads a session with the |session_id| provided. 124 // Loads a session with the |session_id| provided.
124 // Note: UpdateSession(), CloseSession() and RemoveSession() should only be 125 // Note: UpdateSession(), CloseSession() and RemoveSession() should only be
125 // called after the |promise| is resolved. 126 // called after the |promise| is resolved.
126 virtual void LoadSession(SessionType session_type, 127 virtual void LoadSession(SessionType session_type,
127 const std::string& session_id, 128 const std::string& session_id,
128 scoped_ptr<NewSessionCdmPromise> promise) = 0; 129 std::unique_ptr<NewSessionCdmPromise> promise) = 0;
129 130
130 // Updates a session specified by |session_id| with |response|. 131 // Updates a session specified by |session_id| with |response|.
131 virtual void UpdateSession(const std::string& session_id, 132 virtual void UpdateSession(const std::string& session_id,
132 const std::vector<uint8_t>& response, 133 const std::vector<uint8_t>& response,
133 scoped_ptr<SimpleCdmPromise> promise) = 0; 134 std::unique_ptr<SimpleCdmPromise> promise) = 0;
134 135
135 // Closes the session specified by |session_id|. The CDM should resolve or 136 // Closes the session specified by |session_id|. The CDM should resolve or
136 // reject the |promise| when the call has been processed. This may be before 137 // reject the |promise| when the call has been processed. This may be before
137 // the session is closed. Once the session is closed, a SessionClosedCB must 138 // the session is closed. Once the session is closed, a SessionClosedCB must
138 // also be called. 139 // also be called.
139 virtual void CloseSession(const std::string& session_id, 140 virtual void CloseSession(const std::string& session_id,
140 scoped_ptr<SimpleCdmPromise> promise) = 0; 141 std::unique_ptr<SimpleCdmPromise> promise) = 0;
141 142
142 // Removes stored session data associated with the session specified by 143 // Removes stored session data associated with the session specified by
143 // |session_id|. 144 // |session_id|.
144 virtual void RemoveSession(const std::string& session_id, 145 virtual void RemoveSession(const std::string& session_id,
145 scoped_ptr<SimpleCdmPromise> promise) = 0; 146 std::unique_ptr<SimpleCdmPromise> promise) = 0;
146 147
147 // Returns the CdmContext associated with |this|. The returned CdmContext is 148 // Returns the CdmContext associated with |this|. The returned CdmContext is
148 // owned by |this| and the caller needs to make sure it is not used after 149 // owned by |this| and the caller needs to make sure it is not used after
149 // |this| is destructed. 150 // |this| is destructed.
150 // Returns null if CdmContext is not supported. Instead the media player may 151 // Returns null if CdmContext is not supported. Instead the media player may
151 // use the CDM via some platform specific method. 152 // use the CDM via some platform specific method.
152 // By default this method returns null. 153 // By default this method returns null.
153 // TODO(xhwang): Convert all SetCdm() implementations to use CdmContext so 154 // TODO(xhwang): Convert all SetCdm() implementations to use CdmContext so
154 // that this function should never return nullptr. 155 // that this function should never return nullptr.
155 virtual CdmContext* GetCdmContext(); 156 virtual CdmContext* GetCdmContext();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 208
208 // Called when the CDM changes the expiration time of a session. 209 // Called when the CDM changes the expiration time of a session.
209 // See http://w3c.github.io/encrypted-media/#update-expiration 210 // See http://w3c.github.io/encrypted-media/#update-expiration
210 typedef base::Callback<void(const std::string& session_id, 211 typedef base::Callback<void(const std::string& session_id,
211 const base::Time& new_expiry_time)> 212 const base::Time& new_expiry_time)>
212 SessionExpirationUpdateCB; 213 SessionExpirationUpdateCB;
213 214
214 } // namespace media 215 } // namespace media
215 216
216 #endif // MEDIA_BASE_MEDIA_KEYS_H_ 217 #endif // MEDIA_BASE_MEDIA_KEYS_H_
OLDNEW
« no previous file with comments | « media/base/media_file_checker.cc ('k') | media/base/media_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698