| 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" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 weak_ptr_factory_.GetWeakPtr(), session_id), | 188 weak_ptr_factory_.GetWeakPtr(), session_id), |
| 189 base::Bind(&ProxyDecryptor::OnSessionError, | 189 base::Bind(&ProxyDecryptor::OnSessionError, |
| 190 weak_ptr_factory_.GetWeakPtr(), session_id))); | 190 weak_ptr_factory_.GetWeakPtr(), session_id))); |
| 191 media_keys_->RemoveSession(session_id, promise.Pass()); | 191 media_keys_->RemoveSession(session_id, promise.Pass()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 scoped_ptr<MediaKeys> ProxyDecryptor::CreateMediaKeys( | 194 scoped_ptr<MediaKeys> ProxyDecryptor::CreateMediaKeys( |
| 195 CdmFactory* cdm_factory, | 195 CdmFactory* cdm_factory, |
| 196 const std::string& key_system, | 196 const std::string& key_system, |
| 197 const GURL& security_origin) { | 197 const GURL& security_origin) { |
| 198 // TODO(sandersd): Trigger permissions check here and use it to determine |
| 199 // distinctive identifier support, instead of always requiring the |
| 200 // permission. http://crbug.com/455271 |
| 201 bool allow_distinctive_identifier = true; |
| 202 bool allow_persistent_state = true; |
| 198 base::WeakPtr<ProxyDecryptor> weak_this = weak_ptr_factory_.GetWeakPtr(); | 203 base::WeakPtr<ProxyDecryptor> weak_this = weak_ptr_factory_.GetWeakPtr(); |
| 199 return cdm_factory->Create( | 204 return cdm_factory->Create( |
| 200 key_system, | 205 key_system, |
| 206 allow_distinctive_identifier, |
| 207 allow_persistent_state, |
| 201 security_origin, | 208 security_origin, |
| 202 base::Bind(&ProxyDecryptor::OnSessionMessage, weak_this), | 209 base::Bind(&ProxyDecryptor::OnSessionMessage, weak_this), |
| 203 base::Bind(&ProxyDecryptor::OnSessionClosed, weak_this), | 210 base::Bind(&ProxyDecryptor::OnSessionClosed, weak_this), |
| 204 base::Bind(&ProxyDecryptor::OnSessionError, weak_this), | 211 base::Bind(&ProxyDecryptor::OnSessionError, weak_this), |
| 205 base::Bind(&ProxyDecryptor::OnSessionKeysChange, weak_this), | 212 base::Bind(&ProxyDecryptor::OnSessionKeysChange, weak_this), |
| 206 base::Bind(&ProxyDecryptor::OnSessionExpirationUpdate, weak_this)); | 213 base::Bind(&ProxyDecryptor::OnSessionExpirationUpdate, weak_this)); |
| 207 } | 214 } |
| 208 | 215 |
| 209 void ProxyDecryptor::OnSessionMessage(const std::string& session_id, | 216 void ProxyDecryptor::OnSessionMessage(const std::string& session_id, |
| 210 MediaKeys::MessageType message_type, | 217 MediaKeys::MessageType message_type, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 bool is_persistent = | 303 bool is_persistent = |
| 297 session_type == PersistentSession || session_type == LoadSession; | 304 session_type == PersistentSession || session_type == LoadSession; |
| 298 active_sessions_.insert(std::make_pair(session_id, is_persistent)); | 305 active_sessions_.insert(std::make_pair(session_id, is_persistent)); |
| 299 | 306 |
| 300 // For LoadSession(), generate the KeyAdded event. | 307 // For LoadSession(), generate the KeyAdded event. |
| 301 if (session_type == LoadSession) | 308 if (session_type == LoadSession) |
| 302 GenerateKeyAdded(session_id); | 309 GenerateKeyAdded(session_id); |
| 303 } | 310 } |
| 304 | 311 |
| 305 } // namespace media | 312 } // namespace media |
| OLD | NEW |