| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 CdmContext* CdmSessionAdapter::GetCdmContext() { | 112 CdmContext* CdmSessionAdapter::GetCdmContext() { |
| 113 return media_keys_->GetCdmContext(); | 113 return media_keys_->GetCdmContext(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 const std::string& CdmSessionAdapter::GetKeySystemUMAPrefix() const { | 116 const std::string& CdmSessionAdapter::GetKeySystemUMAPrefix() const { |
| 117 return key_system_uma_prefix_; | 117 return key_system_uma_prefix_; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void CdmSessionAdapter::OnSessionMessage(const std::string& web_session_id, | 120 void CdmSessionAdapter::OnSessionMessage( |
| 121 MediaKeys::MessageType message_type, | 121 const std::string& web_session_id, |
| 122 const std::vector<uint8>& message) { | 122 MediaKeys::MessageType message_type, |
| 123 const std::vector<uint8>& message, |
| 124 const GURL& /* legacy_destination_url */) { |
| 123 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); | 125 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); |
| 124 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 126 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
| 125 << web_session_id; | 127 << web_session_id; |
| 126 if (session) | 128 if (session) |
| 127 session->OnSessionMessage(message_type, message); | 129 session->OnSessionMessage(message_type, message); |
| 128 } | 130 } |
| 129 | 131 |
| 130 void CdmSessionAdapter::OnSessionKeysChange(const std::string& web_session_id, | 132 void CdmSessionAdapter::OnSessionKeysChange(const std::string& web_session_id, |
| 131 bool has_additional_usable_key, | 133 bool has_additional_usable_key, |
| 132 CdmKeysInfo keys_info) { | 134 CdmKeysInfo keys_info) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 170 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
| 169 const std::string& web_session_id) { | 171 const std::string& web_session_id) { |
| 170 // 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 |
| 171 // 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. |
| 172 // 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. |
| 173 SessionMap::iterator session = sessions_.find(web_session_id); | 175 SessionMap::iterator session = sessions_.find(web_session_id); |
| 174 return (session != sessions_.end()) ? session->second.get() : NULL; | 176 return (session != sessions_.end()) ? session->second.get() : NULL; |
| 175 } | 177 } |
| 176 | 178 |
| 177 } // namespace media | 179 } // namespace media |
| OLD | NEW |