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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 media_keys_->RemoveSession(web_session_id, promise.Pass()); | 121 media_keys_->RemoveSession(web_session_id, promise.Pass()); |
122 } | 122 } |
123 | 123 |
124 void CdmSessionAdapter::GetUsableKeyIds( | 124 void CdmSessionAdapter::GetUsableKeyIds( |
125 const std::string& web_session_id, | 125 const std::string& web_session_id, |
126 scoped_ptr<KeyIdsPromise> promise) { | 126 scoped_ptr<KeyIdsPromise> promise) { |
127 media_keys_->GetUsableKeyIds(web_session_id, promise.Pass()); | 127 media_keys_->GetUsableKeyIds(web_session_id, promise.Pass()); |
128 } | 128 } |
129 | 129 |
130 Decryptor* CdmSessionAdapter::GetDecryptor() { | 130 Decryptor* CdmSessionAdapter::GetDecryptor() { |
131 return media_keys_->GetDecryptor(); | 131 return media_keys_->GetCdmContext()->GetDecryptor(); |
132 } | 132 } |
133 | 133 |
134 const std::string& CdmSessionAdapter::GetKeySystemUMAPrefix() const { | 134 const std::string& CdmSessionAdapter::GetKeySystemUMAPrefix() const { |
135 return key_system_uma_prefix_; | 135 return key_system_uma_prefix_; |
136 } | 136 } |
137 | 137 |
138 #if defined(ENABLE_BROWSER_CDMS) | 138 #if defined(ENABLE_BROWSER_CDMS) |
139 int CdmSessionAdapter::GetCdmId() const { | 139 int CdmSessionAdapter::GetCdmId() const { |
140 return media_keys_->GetCdmId(); | 140 return media_keys_->GetCdmContext()->GetCdmId(); |
141 } | 141 } |
142 #endif // defined(ENABLE_BROWSER_CDMS) | 142 #endif // defined(ENABLE_BROWSER_CDMS) |
143 | 143 |
144 void CdmSessionAdapter::OnSessionMessage(const std::string& web_session_id, | 144 void CdmSessionAdapter::OnSessionMessage(const std::string& web_session_id, |
145 const std::vector<uint8>& message, | 145 const std::vector<uint8>& message, |
146 const GURL& destination_url) { | 146 const GURL& destination_url) { |
147 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); | 147 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); |
148 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 148 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
149 << web_session_id; | 149 << web_session_id; |
150 if (session) | 150 if (session) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 195 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
196 const std::string& web_session_id) { | 196 const std::string& web_session_id) { |
197 // Since session objects may get garbage collected, it is possible that there | 197 // Since session objects may get garbage collected, it is possible that there |
198 // are events coming back from the CDM and the session has been unregistered. | 198 // are events coming back from the CDM and the session has been unregistered. |
199 // We can not tell if the CDM is firing events at sessions that never existed. | 199 // We can not tell if the CDM is firing events at sessions that never existed. |
200 SessionMap::iterator session = sessions_.find(web_session_id); | 200 SessionMap::iterator session = sessions_.find(web_session_id); |
201 return (session != sessions_.end()) ? session->second.get() : NULL; | 201 return (session != sessions_.end()) ? session->second.get() : NULL; |
202 } | 202 } |
203 | 203 |
204 } // namespace media | 204 } // namespace media |
OLD | NEW |