| 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/proxy_decryptor.h" | 5 #include "media/cdm/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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "media/base/cdm_callback_promise.h" | 13 #include "media/base/cdm_callback_promise.h" |
| 14 #include "media/base/cdm_factory.h" | 14 #include "media/base/cdm_factory.h" |
| 15 #include "media/base/cdm_key_information.h" |
| 15 #include "media/base/key_systems.h" | 16 #include "media/base/key_systems.h" |
| 16 #include "media/cdm/json_web_key.h" | 17 #include "media/cdm/json_web_key.h" |
| 17 #include "media/cdm/key_system_names.h" | 18 #include "media/cdm/key_system_names.h" |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 | 21 |
| 21 // Special system code to signal a closed persistent session in a SessionError() | 22 // Special system code to signal a closed persistent session in a SessionError() |
| 22 // call. This is needed because there is no SessionClosed() call in the prefixed | 23 // call. This is needed because there is no SessionClosed() call in the prefixed |
| 23 // EME API. | 24 // EME API. |
| 24 const int kSessionClosedSystemCode = 29127; | 25 const int kSessionClosedSystemCode = 29127; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 std::vector<uint8> key; | 221 std::vector<uint8> key; |
| 221 if (ExtractFirstKeyIdFromLicenseRequest(message, &key)) { | 222 if (ExtractFirstKeyIdFromLicenseRequest(message, &key)) { |
| 222 key_message_cb_.Run(web_session_id, key, destination_url); | 223 key_message_cb_.Run(web_session_id, key, destination_url); |
| 223 return; | 224 return; |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 key_message_cb_.Run(web_session_id, message, destination_url); | 228 key_message_cb_.Run(web_session_id, message, destination_url); |
| 228 } | 229 } |
| 229 | 230 |
| 230 void ProxyDecryptor::OnSessionKeysChange(const std::string& web_session_id, | 231 void ProxyDecryptor::OnSessionKeysChange( |
| 231 bool has_additional_usable_key) { | 232 const std::string& web_session_id, |
| 233 bool has_additional_usable_key, |
| 234 const CdmKeyInformationVector& key_information) { |
| 232 // EME v0.1b doesn't support this event. | 235 // EME v0.1b doesn't support this event. |
| 233 } | 236 } |
| 234 | 237 |
| 235 void ProxyDecryptor::OnSessionExpirationUpdate( | 238 void ProxyDecryptor::OnSessionExpirationUpdate( |
| 236 const std::string& web_session_id, | 239 const std::string& web_session_id, |
| 237 const base::Time& new_expiry_time) { | 240 const base::Time& new_expiry_time) { |
| 238 // EME v0.1b doesn't support this event. | 241 // EME v0.1b doesn't support this event. |
| 239 } | 242 } |
| 240 | 243 |
| 241 void ProxyDecryptor::GenerateKeyAdded(const std::string& web_session_id) { | 244 void ProxyDecryptor::GenerateKeyAdded(const std::string& web_session_id) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 bool is_persistent = | 300 bool is_persistent = |
| 298 session_type == PersistentSession || session_type == LoadSession; | 301 session_type == PersistentSession || session_type == LoadSession; |
| 299 active_sessions_.insert(std::make_pair(web_session_id, is_persistent)); | 302 active_sessions_.insert(std::make_pair(web_session_id, is_persistent)); |
| 300 | 303 |
| 301 // For LoadSession(), generate the KeyAdded event. | 304 // For LoadSession(), generate the KeyAdded event. |
| 302 if (session_type == LoadSession) | 305 if (session_type == LoadSession) |
| 303 GenerateKeyAdded(web_session_id); | 306 GenerateKeyAdded(web_session_id); |
| 304 } | 307 } |
| 305 | 308 |
| 306 } // namespace media | 309 } // namespace media |
| OLD | NEW |