OLD | NEW |
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 "media/cdm/aes_decryptor.h" | 5 #include "media/cdm/aes_decryptor.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 DCHECK_EQ(decrypted_text.size(), encrypted_text.size()); | 217 DCHECK_EQ(decrypted_text.size(), encrypted_text.size()); |
218 | 218 |
219 scoped_refptr<DecoderBuffer> output = DecoderBuffer::CopyFrom( | 219 scoped_refptr<DecoderBuffer> output = DecoderBuffer::CopyFrom( |
220 reinterpret_cast<const uint8*>(sample), sample_size); | 220 reinterpret_cast<const uint8*>(sample), sample_size); |
221 CopySubsamples(subsamples, kDstContainsClearBytes, | 221 CopySubsamples(subsamples, kDstContainsClearBytes, |
222 reinterpret_cast<const uint8*>(decrypted_text.data()), | 222 reinterpret_cast<const uint8*>(decrypted_text.data()), |
223 output->writable_data()); | 223 output->writable_data()); |
224 return output; | 224 return output; |
225 } | 225 } |
226 | 226 |
227 AesDecryptor::AesDecryptor(const SessionMessageCB& session_message_cb, | 227 AesDecryptor::AesDecryptor(const GURL& /* security_origin */, |
| 228 const SessionMessageCB& session_message_cb, |
228 const SessionClosedCB& session_closed_cb, | 229 const SessionClosedCB& session_closed_cb, |
229 const SessionKeysChangeCB& session_keys_change_cb) | 230 const SessionKeysChangeCB& session_keys_change_cb) |
230 : session_message_cb_(session_message_cb), | 231 : session_message_cb_(session_message_cb), |
231 session_closed_cb_(session_closed_cb), | 232 session_closed_cb_(session_closed_cb), |
232 session_keys_change_cb_(session_keys_change_cb) { | 233 session_keys_change_cb_(session_keys_change_cb) { |
| 234 // AesDecryptor doesn't keep any persistent data, so no need to do anything |
| 235 // with |security_origin|. |
233 DCHECK(!session_message_cb_.is_null()); | 236 DCHECK(!session_message_cb_.is_null()); |
234 DCHECK(!session_closed_cb_.is_null()); | 237 DCHECK(!session_closed_cb_.is_null()); |
235 DCHECK(!session_keys_change_cb_.is_null()); | 238 DCHECK(!session_keys_change_cb_.is_null()); |
236 } | 239 } |
237 | 240 |
238 AesDecryptor::~AesDecryptor() { | 241 AesDecryptor::~AesDecryptor() { |
239 key_map_.clear(); | 242 key_map_.clear(); |
240 } | 243 } |
241 | 244 |
242 void AesDecryptor::SetServerCertificate(const uint8* certificate_data, | 245 void AesDecryptor::SetServerCertificate(const uint8* certificate_data, |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 bool AesDecryptor::DecryptionKey::Init() { | 600 bool AesDecryptor::DecryptionKey::Init() { |
598 CHECK(!secret_.empty()); | 601 CHECK(!secret_.empty()); |
599 decryption_key_.reset(crypto::SymmetricKey::Import( | 602 decryption_key_.reset(crypto::SymmetricKey::Import( |
600 crypto::SymmetricKey::AES, secret_)); | 603 crypto::SymmetricKey::AES, secret_)); |
601 if (!decryption_key_) | 604 if (!decryption_key_) |
602 return false; | 605 return false; |
603 return true; | 606 return true; |
604 } | 607 } |
605 | 608 |
606 } // namespace media | 609 } // namespace media |
OLD | NEW |