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

Side by Side Diff: media/crypto/aes_decryptor.cc

Issue 16297002: Update media/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « media/base/video_util_unittest.cc ('k') | media/crypto/aes_decryptor_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/crypto/aes_decryptor.h" 5 #include "media/crypto/aes_decryptor.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } else { 246 } else {
247 const std::string& key_id = encrypted->GetDecryptConfig()->key_id(); 247 const std::string& key_id = encrypted->GetDecryptConfig()->key_id();
248 DecryptionKey* key = GetKey(key_id); 248 DecryptionKey* key = GetKey(key_id);
249 if (!key) { 249 if (!key) {
250 DVLOG(1) << "Could not find a matching key for the given key ID."; 250 DVLOG(1) << "Could not find a matching key for the given key ID.";
251 decrypt_cb.Run(kNoKey, NULL); 251 decrypt_cb.Run(kNoKey, NULL);
252 return; 252 return;
253 } 253 }
254 254
255 crypto::SymmetricKey* decryption_key = key->decryption_key(); 255 crypto::SymmetricKey* decryption_key = key->decryption_key();
256 decrypted = DecryptData(*encrypted, decryption_key); 256 decrypted = DecryptData(*encrypted.get(), decryption_key);
257 if (!decrypted) { 257 if (!decrypted.get()) {
258 DVLOG(1) << "Decryption failed."; 258 DVLOG(1) << "Decryption failed.";
259 decrypt_cb.Run(kError, NULL); 259 decrypt_cb.Run(kError, NULL);
260 return; 260 return;
261 } 261 }
262 } 262 }
263 263
264 decrypted->SetTimestamp(encrypted->GetTimestamp()); 264 decrypted->SetTimestamp(encrypted->GetTimestamp());
265 decrypted->SetDuration(encrypted->GetDuration()); 265 decrypted->SetDuration(encrypted->GetDuration());
266 decrypt_cb.Run(kSuccess, decrypted); 266 decrypt_cb.Run(kSuccess, decrypted);
267 } 267 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 bool AesDecryptor::DecryptionKey::Init() { 332 bool AesDecryptor::DecryptionKey::Init() {
333 CHECK(!secret_.empty()); 333 CHECK(!secret_.empty());
334 decryption_key_.reset(crypto::SymmetricKey::Import( 334 decryption_key_.reset(crypto::SymmetricKey::Import(
335 crypto::SymmetricKey::AES, secret_)); 335 crypto::SymmetricKey::AES, secret_));
336 if (!decryption_key_) 336 if (!decryption_key_)
337 return false; 337 return false;
338 return true; 338 return true;
339 } 339 }
340 340
341 } // namespace media 341 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_util_unittest.cc ('k') | media/crypto/aes_decryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698