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

Side by Side Diff: content/renderer/media/crypto/proxy_media_keys.cc

Issue 665563002: Add MediaKeys::GetCdmId(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Make GetCdmId() pure virtual. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/renderer/media/crypto/proxy_media_keys.h" 5 #include "content/renderer/media/crypto/proxy_media_keys.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const std::string& web_session_id, 135 const std::string& web_session_id,
136 scoped_ptr<media::SimpleCdmPromise> promise) { 136 scoped_ptr<media::SimpleCdmPromise> promise) {
137 promise->reject(NOT_SUPPORTED_ERROR, 0, "Not yet implemented."); 137 promise->reject(NOT_SUPPORTED_ERROR, 0, "Not yet implemented.");
138 } 138 }
139 139
140 void ProxyMediaKeys::GetUsableKeyIds(const std::string& web_session_id, 140 void ProxyMediaKeys::GetUsableKeyIds(const std::string& web_session_id,
141 scoped_ptr<media::KeyIdsPromise> promise) { 141 scoped_ptr<media::KeyIdsPromise> promise) {
142 promise->reject(NOT_SUPPORTED_ERROR, 0, "Not yet implemented."); 142 promise->reject(NOT_SUPPORTED_ERROR, 0, "Not yet implemented.");
143 } 143 }
144 144
145 int ProxyMediaKeys::GetCdmId() const {
146 return cdm_id_;
147 }
148
145 void ProxyMediaKeys::OnSessionCreated(uint32 session_id, 149 void ProxyMediaKeys::OnSessionCreated(uint32 session_id,
146 const std::string& web_session_id) { 150 const std::string& web_session_id) {
147 AssignWebSessionId(session_id, web_session_id); 151 AssignWebSessionId(session_id, web_session_id);
148 scoped_ptr<media::CdmPromise> promise = TakePromise(session_id); 152 scoped_ptr<media::CdmPromise> promise = TakePromise(session_id);
149 if (promise) { 153 if (promise) {
150 media::NewSessionCdmPromise* session_promise( 154 media::NewSessionCdmPromise* session_promise(
151 static_cast<media::NewSessionCdmPromise*>(promise.get())); 155 static_cast<media::NewSessionCdmPromise*>(promise.get()));
152 session_promise->resolve(web_session_id); 156 session_promise->resolve(web_session_id);
153 } 157 }
154 } 158 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 promise->reject(exception_code, system_code, std::string()); 215 promise->reject(exception_code, system_code, std::string());
212 return; 216 return;
213 } 217 }
214 218
215 // Errors generally happen in response to a request, but it is possible 219 // Errors generally happen in response to a request, but it is possible
216 // for something bad to happen in the CDM and it needs to tell the client. 220 // for something bad to happen in the CDM and it needs to tell the client.
217 session_error_cb_.Run( 221 session_error_cb_.Run(
218 web_session_id, exception_code, system_code, std::string()); 222 web_session_id, exception_code, system_code, std::string());
219 } 223 }
220 224
221 int ProxyMediaKeys::GetCdmId() const {
222 return cdm_id_;
223 }
224
225 ProxyMediaKeys::ProxyMediaKeys( 225 ProxyMediaKeys::ProxyMediaKeys(
226 RendererCdmManager* manager, 226 RendererCdmManager* manager,
227 const media::SessionMessageCB& session_message_cb, 227 const media::SessionMessageCB& session_message_cb,
228 const media::SessionReadyCB& session_ready_cb, 228 const media::SessionReadyCB& session_ready_cb,
229 const media::SessionClosedCB& session_closed_cb, 229 const media::SessionClosedCB& session_closed_cb,
230 const media::SessionErrorCB& session_error_cb) 230 const media::SessionErrorCB& session_error_cb)
231 : manager_(manager), 231 : manager_(manager),
232 session_message_cb_(session_message_cb), 232 session_message_cb_(session_message_cb),
233 session_ready_cb_(session_ready_cb), 233 session_ready_cb_(session_ready_cb),
234 session_closed_cb_(session_closed_cb), 234 session_closed_cb_(session_closed_cb),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) { 287 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) {
288 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id); 288 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id);
289 // May not be a promise associated with this session for asynchronous events. 289 // May not be a promise associated with this session for asynchronous events.
290 if (it == session_id_to_promise_map_.end()) 290 if (it == session_id_to_promise_map_.end())
291 return scoped_ptr<media::CdmPromise>(); 291 return scoped_ptr<media::CdmPromise>();
292 return session_id_to_promise_map_.take_and_erase(it); 292 return session_id_to_promise_map_.take_and_erase(it);
293 } 293 }
294 294
295 } // namespace content 295 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/proxy_media_keys.h ('k') | content/renderer/media/crypto/render_cdm_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698