| 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/stl_util.h" | |
| 13 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 14 #include "media/base/cdm_callback_promise.h" | 13 #include "media/base/cdm_callback_promise.h" |
| 15 #include "media/base/cdm_config.h" | 14 #include "media/base/cdm_config.h" |
| 16 #include "media/base/cdm_factory.h" | 15 #include "media/base/cdm_factory.h" |
| 17 #include "media/base/cdm_key_information.h" | 16 #include "media/base/cdm_key_information.h" |
| 18 #include "media/base/key_systems.h" | 17 #include "media/base/key_systems.h" |
| 19 #include "media/base/media_permission.h" | 18 #include "media/base/media_permission.h" |
| 20 #include "media/cdm/json_web_key.h" | 19 #include "media/cdm/json_web_key.h" |
| 21 #include "media/cdm/key_system_names.h" | 20 #include "media/cdm/key_system_names.h" |
| 22 | 21 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 scoped_ptr<NewSessionCdmPromise> promise(new CdmCallbackPromise<std::string>( | 172 scoped_ptr<NewSessionCdmPromise> promise(new CdmCallbackPromise<std::string>( |
| 174 base::Bind(&ProxyDecryptor::SetSessionId, weak_ptr_factory_.GetWeakPtr(), | 173 base::Bind(&ProxyDecryptor::SetSessionId, weak_ptr_factory_.GetWeakPtr(), |
| 175 session_creation_type), | 174 session_creation_type), |
| 176 base::Bind(&ProxyDecryptor::OnLegacySessionError, | 175 base::Bind(&ProxyDecryptor::OnLegacySessionError, |
| 177 weak_ptr_factory_.GetWeakPtr(), | 176 weak_ptr_factory_.GetWeakPtr(), |
| 178 std::string()))); // No session id until created. | 177 std::string()))); // No session id until created. |
| 179 | 178 |
| 180 if (session_creation_type == LoadSession) { | 179 if (session_creation_type == LoadSession) { |
| 181 media_keys_->LoadSession( | 180 media_keys_->LoadSession( |
| 182 MediaKeys::PERSISTENT_LICENSE_SESSION, | 181 MediaKeys::PERSISTENT_LICENSE_SESSION, |
| 183 std::string( | 182 std::string(reinterpret_cast<const char*>(stripped_init_data.data()), |
| 184 reinterpret_cast<const char*>(vector_as_array(&stripped_init_data)), | 183 stripped_init_data.size()), |
| 185 stripped_init_data.size()), | |
| 186 promise.Pass()); | 184 promise.Pass()); |
| 187 return; | 185 return; |
| 188 } | 186 } |
| 189 | 187 |
| 190 MediaKeys::SessionType session_type = | 188 MediaKeys::SessionType session_type = |
| 191 session_creation_type == PersistentSession | 189 session_creation_type == PersistentSession |
| 192 ? MediaKeys::PERSISTENT_LICENSE_SESSION | 190 ? MediaKeys::PERSISTENT_LICENSE_SESSION |
| 193 : MediaKeys::TEMPORARY_SESSION; | 191 : MediaKeys::TEMPORARY_SESSION; |
| 194 | 192 |
| 195 // No permission required when AesDecryptor is used or when the key system is | 193 // No permission required when AesDecryptor is used or when the key system is |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 bool is_persistent = | 402 bool is_persistent = |
| 405 session_type == PersistentSession || session_type == LoadSession; | 403 session_type == PersistentSession || session_type == LoadSession; |
| 406 active_sessions_.insert(std::make_pair(session_id, is_persistent)); | 404 active_sessions_.insert(std::make_pair(session_id, is_persistent)); |
| 407 | 405 |
| 408 // For LoadSession(), generate the KeyAdded event. | 406 // For LoadSession(), generate the KeyAdded event. |
| 409 if (session_type == LoadSession) | 407 if (session_type == LoadSession) |
| 410 GenerateKeyAdded(session_id); | 408 GenerateKeyAdded(session_id); |
| 411 } | 409 } |
| 412 | 410 |
| 413 } // namespace media | 411 } // namespace media |
| OLD | NEW |