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

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

Issue 427993002: Implement ClearKey message format as JSON. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 4 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 | « no previous file | media/cdm/aes_decryptor.cc » ('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 #include "content/renderer/media/crypto/proxy_decryptor.h" 5 #include "content/renderer/media/crypto/proxy_decryptor.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 base::Bind(&ProxyDecryptor::OnSessionClosed, 240 base::Bind(&ProxyDecryptor::OnSessionClosed,
241 weak_ptr_factory_.GetWeakPtr()), 241 weak_ptr_factory_.GetWeakPtr()),
242 base::Bind(&ProxyDecryptor::OnSessionError, 242 base::Bind(&ProxyDecryptor::OnSessionError,
243 weak_ptr_factory_.GetWeakPtr())); 243 weak_ptr_factory_.GetWeakPtr()));
244 } 244 }
245 245
246 void ProxyDecryptor::OnSessionMessage(const std::string& web_session_id, 246 void ProxyDecryptor::OnSessionMessage(const std::string& web_session_id,
247 const std::vector<uint8>& message, 247 const std::vector<uint8>& message,
248 const GURL& destination_url) { 248 const GURL& destination_url) {
249 // Assumes that OnSessionCreated() has been called before this. 249 // Assumes that OnSessionCreated() has been called before this.
250
251 // For ClearKey, convert the message from JSON into just passing the key
252 // as the message. If unable to extract the key, return the message unchanged.
253 if (is_clear_key_) {
254 std::vector<uint8> key;
255 if (media::ExtractFirstKeyIdFromLicenseRequest(message, &key)) {
256 key_message_cb_.Run(web_session_id, key, destination_url);
257 return;
258 }
259 }
260
250 key_message_cb_.Run(web_session_id, message, destination_url); 261 key_message_cb_.Run(web_session_id, message, destination_url);
251 } 262 }
252 263
253 void ProxyDecryptor::OnSessionReady(const std::string& web_session_id) { 264 void ProxyDecryptor::OnSessionReady(const std::string& web_session_id) {
254 key_added_cb_.Run(web_session_id); 265 key_added_cb_.Run(web_session_id);
255 } 266 }
256 267
257 void ProxyDecryptor::OnSessionClosed(const std::string& web_session_id) { 268 void ProxyDecryptor::OnSessionClosed(const std::string& web_session_id) {
258 base::hash_map<std::string, bool>::iterator it = 269 base::hash_map<std::string, bool>::iterator it =
259 active_sessions_.find(web_session_id); 270 active_sessions_.find(web_session_id);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 bool is_persistent = 320 bool is_persistent =
310 session_type == PersistentSession || session_type == LoadSession; 321 session_type == PersistentSession || session_type == LoadSession;
311 active_sessions_.insert(std::make_pair(web_session_id, is_persistent)); 322 active_sessions_.insert(std::make_pair(web_session_id, is_persistent));
312 323
313 // For LoadSession(), generate the SessionReady event. 324 // For LoadSession(), generate the SessionReady event.
314 if (session_type == LoadSession) 325 if (session_type == LoadSession)
315 OnSessionReady(web_session_id); 326 OnSessionReady(web_session_id);
316 } 327 }
317 328
318 } // namespace content 329 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/cdm/aes_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698