| 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 "content/renderer/media/crypto/proxy_decryptor.h" | 5 #include "content/renderer/media/crypto/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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 ProxyDecryptor::~ProxyDecryptor() { | 69 ProxyDecryptor::~ProxyDecryptor() { |
| 70 // Destroy the decryptor explicitly before destroying the plugin. | 70 // Destroy the decryptor explicitly before destroying the plugin. |
| 71 media_keys_.reset(); | 71 media_keys_.reset(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 media::Decryptor* ProxyDecryptor::GetDecryptor() { | 74 media::Decryptor* ProxyDecryptor::GetDecryptor() { |
| 75 return media_keys_ ? media_keys_->GetDecryptor() : NULL; | 75 return media_keys_ ? media_keys_->GetDecryptor() : NULL; |
| 76 } | 76 } |
| 77 | 77 |
| 78 int ProxyDecryptor::GetCdmId() { |
| 79 return media_keys_ ? media_keys_->GetCdmId() |
| 80 : media::MediaKeys::kInvalidCdmId; |
| 81 } |
| 82 |
| 78 bool ProxyDecryptor::InitializeCDM(const std::string& key_system, | 83 bool ProxyDecryptor::InitializeCDM(const std::string& key_system, |
| 79 const GURL& frame_url) { | 84 const GURL& frame_url) { |
| 80 DVLOG(1) << "InitializeCDM: key_system = " << key_system; | 85 DVLOG(1) << "InitializeCDM: key_system = " << key_system; |
| 81 | 86 |
| 82 DCHECK(!media_keys_); | 87 DCHECK(!media_keys_); |
| 83 media_keys_ = CreateMediaKeys(key_system, frame_url); | 88 media_keys_ = CreateMediaKeys(key_system, frame_url); |
| 84 if (!media_keys_) | 89 if (!media_keys_) |
| 85 return false; | 90 return false; |
| 86 | 91 |
| 87 is_clear_key_ = | 92 is_clear_key_ = |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 267 |
| 263 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { | 268 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { |
| 264 DCHECK_NE(session_id, kInvalidSessionId); | 269 DCHECK_NE(session_id, kInvalidSessionId); |
| 265 | 270 |
| 266 // Session may not exist if error happens during GenerateKeyRequest(). | 271 // Session may not exist if error happens during GenerateKeyRequest(). |
| 267 SessionIdMap::const_iterator it = sessions_.find(session_id); | 272 SessionIdMap::const_iterator it = sessions_.find(session_id); |
| 268 return (it != sessions_.end()) ? it->second : base::EmptyString(); | 273 return (it != sessions_.end()) ? it->second : base::EmptyString(); |
| 269 } | 274 } |
| 270 | 275 |
| 271 } // namespace content | 276 } // namespace content |
| OLD | NEW |