| 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 "media/blink/cdm_session_adapter.h" | 5 #include "media/blink/cdm_session_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 void CdmSessionAdapter::OnSessionKeysChange(const std::string& web_session_id, | 132 void CdmSessionAdapter::OnSessionKeysChange(const std::string& web_session_id, |
| 133 bool has_additional_usable_key, | 133 bool has_additional_usable_key, |
| 134 CdmKeysInfo keys_info) { | 134 CdmKeysInfo keys_info) { |
| 135 // TODO(jrummell): Pass |keys_info| on. | 135 // TODO(jrummell): Pass |keys_info| on. |
| 136 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); | 136 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); |
| 137 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 137 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
| 138 << web_session_id; | 138 << web_session_id; |
| 139 if (session) | 139 if (session) |
| 140 session->OnSessionKeysChange(has_additional_usable_key); | 140 session->OnSessionKeysChange(has_additional_usable_key, keys_info.Pass()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void CdmSessionAdapter::OnSessionExpirationUpdate( | 143 void CdmSessionAdapter::OnSessionExpirationUpdate( |
| 144 const std::string& web_session_id, | 144 const std::string& web_session_id, |
| 145 const base::Time& new_expiry_time) { | 145 const base::Time& new_expiry_time) { |
| 146 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); | 146 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); |
| 147 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 147 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
| 148 << web_session_id; | 148 << web_session_id; |
| 149 if (session) | 149 if (session) |
| 150 session->OnSessionExpirationUpdate(new_expiry_time); | 150 session->OnSessionExpirationUpdate(new_expiry_time); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 170 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 170 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
| 171 const std::string& web_session_id) { | 171 const std::string& web_session_id) { |
| 172 // Since session objects may get garbage collected, it is possible that there | 172 // Since session objects may get garbage collected, it is possible that there |
| 173 // are events coming back from the CDM and the session has been unregistered. | 173 // are events coming back from the CDM and the session has been unregistered. |
| 174 // We can not tell if the CDM is firing events at sessions that never existed. | 174 // We can not tell if the CDM is firing events at sessions that never existed. |
| 175 SessionMap::iterator session = sessions_.find(web_session_id); | 175 SessionMap::iterator session = sessions_.find(web_session_id); |
| 176 return (session != sessions_.end()) ? session->second.get() : NULL; | 176 return (session != sessions_.end()) ? session->second.get() : NULL; |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace media | 179 } // namespace media |
| OLD | NEW |