| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 DCHECK(it == sessions_.end() || it->second == web_session_id); | 219 DCHECK(it == sessions_.end() || it->second == web_session_id); |
| 220 if (it == sessions_.end()) | 220 if (it == sessions_.end()) |
| 221 sessions_[session_id] = web_session_id; | 221 sessions_[session_id] = web_session_id; |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ProxyDecryptor::OnSessionMessage(uint32 session_id, | 224 void ProxyDecryptor::OnSessionMessage(uint32 session_id, |
| 225 const std::vector<uint8>& message, | 225 const std::vector<uint8>& message, |
| 226 const GURL& destination_url) { | 226 const GURL& destination_url) { |
| 227 // Assumes that OnSessionCreated() has been called before this. | 227 // Assumes that OnSessionCreated() has been called before this. |
| 228 key_message_cb_.Run( | 228 key_message_cb_.Run( |
| 229 LookupWebSessionId(session_id), message, destination_url.spec()); | 229 LookupWebSessionId(session_id), message, destination_url); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void ProxyDecryptor::OnSessionReady(uint32 session_id) { | 232 void ProxyDecryptor::OnSessionReady(uint32 session_id) { |
| 233 // Assumes that OnSessionCreated() has been called before this. | 233 // Assumes that OnSessionCreated() has been called before this. |
| 234 key_added_cb_.Run(LookupWebSessionId(session_id)); | 234 key_added_cb_.Run(LookupWebSessionId(session_id)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void ProxyDecryptor::OnSessionClosed(uint32 session_id) { | 237 void ProxyDecryptor::OnSessionClosed(uint32 session_id) { |
| 238 std::set<uint32>::iterator it = persistent_sessions_.find(session_id); | 238 std::set<uint32>::iterator it = persistent_sessions_.find(session_id); |
| 239 if (it != persistent_sessions_.end()) { | 239 if (it != persistent_sessions_.end()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 269 | 269 |
| 270 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { | 270 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { |
| 271 DCHECK_NE(session_id, kInvalidSessionId); | 271 DCHECK_NE(session_id, kInvalidSessionId); |
| 272 | 272 |
| 273 // Session may not exist if error happens during GenerateKeyRequest(). | 273 // Session may not exist if error happens during GenerateKeyRequest(). |
| 274 SessionIdMap::const_iterator it = sessions_.find(session_id); | 274 SessionIdMap::const_iterator it = sessions_.find(session_id); |
| 275 return (it != sessions_.end()) ? it->second : base::EmptyString(); | 275 return (it != sessions_.end()) ? it->second : base::EmptyString(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace content | 278 } // namespace content |
| OLD | NEW |