| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cdm/renderer_cdm_manager.h" | 5 #include "content/renderer/media/cdm/renderer_cdm_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 10 #include "content/common/media/cdm_messages.h" | 11 #include "content/common/media/cdm_messages.h" |
| 11 #include "content/renderer/media/cdm/proxy_media_keys.h" | 12 #include "content/renderer/media/cdm/proxy_media_keys.h" |
| 12 #include "media/base/cdm_context.h" | 13 #include "media/base/cdm_context.h" |
| 13 #include "media/base/limits.h" | 14 #include "media/base/limits.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 using media::MediaKeys; | 18 using media::MediaKeys; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 ProxyMediaKeys* media_keys = GetMediaKeys(cdm_id); | 174 ProxyMediaKeys* media_keys = GetMediaKeys(cdm_id); |
| 174 if (!media_keys) | 175 if (!media_keys) |
| 175 return; | 176 return; |
| 176 | 177 |
| 177 media::CdmKeysInfo keys_info; | 178 media::CdmKeysInfo keys_info; |
| 178 keys_info.reserve(key_info_vector.size()); | 179 keys_info.reserve(key_info_vector.size()); |
| 179 for (const auto& key_info : key_info_vector) | 180 for (const auto& key_info : key_info_vector) |
| 180 keys_info.push_back(new media::CdmKeyInformation(key_info)); | 181 keys_info.push_back(new media::CdmKeyInformation(key_info)); |
| 181 | 182 |
| 182 media_keys->OnSessionKeysChange(session_id, has_additional_usable_key, | 183 media_keys->OnSessionKeysChange(session_id, has_additional_usable_key, |
| 183 keys_info.Pass()); | 184 std::move(keys_info)); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void RendererCdmManager::OnSessionExpirationUpdate( | 187 void RendererCdmManager::OnSessionExpirationUpdate( |
| 187 int cdm_id, | 188 int cdm_id, |
| 188 const std::string& session_id, | 189 const std::string& session_id, |
| 189 const base::Time& new_expiry_time) { | 190 const base::Time& new_expiry_time) { |
| 190 ProxyMediaKeys* media_keys = GetMediaKeys(cdm_id); | 191 ProxyMediaKeys* media_keys = GetMediaKeys(cdm_id); |
| 191 if (media_keys) | 192 if (media_keys) |
| 192 media_keys->OnSessionExpirationUpdate(session_id, new_expiry_time); | 193 media_keys->OnSessionExpirationUpdate(session_id, new_expiry_time); |
| 193 } | 194 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 proxy_media_keys_map_.erase(cdm_id); | 239 proxy_media_keys_map_.erase(cdm_id); |
| 239 } | 240 } |
| 240 | 241 |
| 241 ProxyMediaKeys* RendererCdmManager::GetMediaKeys(int cdm_id) { | 242 ProxyMediaKeys* RendererCdmManager::GetMediaKeys(int cdm_id) { |
| 242 std::map<int, ProxyMediaKeys*>::iterator iter = | 243 std::map<int, ProxyMediaKeys*>::iterator iter = |
| 243 proxy_media_keys_map_.find(cdm_id); | 244 proxy_media_keys_map_.find(cdm_id); |
| 244 return (iter != proxy_media_keys_map_.end()) ? iter->second : NULL; | 245 return (iter != proxy_media_keys_map_.end()) ? iter->second : NULL; |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace content | 248 } // namespace content |
| OLD | NEW |