| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 240 |
| 241 std::string web_session_id_string(base::UintToString(next_web_session_id_++)); | 241 std::string web_session_id_string(base::UintToString(next_web_session_id_++)); |
| 242 | 242 |
| 243 // For now, the AesDecryptor does not care about |content_type|; | 243 // For now, the AesDecryptor does not care about |content_type|; |
| 244 // just fire the event with the |init_data| as the request. | 244 // just fire the event with the |init_data| as the request. |
| 245 std::vector<uint8> message; | 245 std::vector<uint8> message; |
| 246 if (init_data && init_data_length) | 246 if (init_data && init_data_length) |
| 247 message.assign(init_data, init_data + init_data_length); | 247 message.assign(init_data, init_data + init_data_length); |
| 248 | 248 |
| 249 session_created_cb_.Run(session_id, web_session_id_string); | 249 session_created_cb_.Run(session_id, web_session_id_string); |
| 250 session_message_cb_.Run(session_id, message, std::string()); | 250 session_message_cb_.Run(session_id, message, GURL()); |
| 251 return true; | 251 return true; |
| 252 } | 252 } |
| 253 | 253 |
| 254 void AesDecryptor::LoadSession(uint32 session_id, | 254 void AesDecryptor::LoadSession(uint32 session_id, |
| 255 const std::string& web_session_id) { | 255 const std::string& web_session_id) { |
| 256 // TODO(xhwang): Change this to NOTREACHED() when blink checks for key systems | 256 // TODO(xhwang): Change this to NOTREACHED() when blink checks for key systems |
| 257 // that do not support loadSession. See http://crbug.com/342481 | 257 // that do not support loadSession. See http://crbug.com/342481 |
| 258 session_error_cb_.Run(session_id, MediaKeys::kUnknownError, 0); | 258 session_error_cb_.Run(session_id, MediaKeys::kUnknownError, 0); |
| 259 } | 259 } |
| 260 | 260 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 bool AesDecryptor::DecryptionKey::Init() { | 473 bool AesDecryptor::DecryptionKey::Init() { |
| 474 CHECK(!secret_.empty()); | 474 CHECK(!secret_.empty()); |
| 475 decryption_key_.reset(crypto::SymmetricKey::Import( | 475 decryption_key_.reset(crypto::SymmetricKey::Import( |
| 476 crypto::SymmetricKey::AES, secret_)); | 476 crypto::SymmetricKey::AES, secret_)); |
| 477 if (!decryption_key_) | 477 if (!decryption_key_) |
| 478 return false; | 478 return false; |
| 479 return true; | 479 return true; |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace media | 482 } // namespace media |
| OLD | NEW |