Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: content/renderer/media/crypto/proxy_decryptor.cc

Issue 297703002: Using GURL in place of std::string for destination_url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments, adding checks Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Due to heartbeat messages, OnSessionCreated() can get called multiple 216 // Due to heartbeat messages, OnSessionCreated() can get called multiple
217 // times. 217 // times.
218 SessionIdMap::iterator it = sessions_.find(session_id); 218 SessionIdMap::iterator it = sessions_.find(session_id);
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 std::string& 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(LookupWebSessionId(session_id), message, destination_url); 228 key_message_cb_.Run(
229 LookupWebSessionId(session_id), message, destination_url.spec());
229 } 230 }
230 231
231 void ProxyDecryptor::OnSessionReady(uint32 session_id) { 232 void ProxyDecryptor::OnSessionReady(uint32 session_id) {
232 // Assumes that OnSessionCreated() has been called before this. 233 // Assumes that OnSessionCreated() has been called before this.
233 key_added_cb_.Run(LookupWebSessionId(session_id)); 234 key_added_cb_.Run(LookupWebSessionId(session_id));
234 } 235 }
235 236
236 void ProxyDecryptor::OnSessionClosed(uint32 session_id) { 237 void ProxyDecryptor::OnSessionClosed(uint32 session_id) {
237 std::set<uint32>::iterator it = persistent_sessions_.find(session_id); 238 std::set<uint32>::iterator it = persistent_sessions_.find(session_id);
238 if (it != persistent_sessions_.end()) { 239 if (it != persistent_sessions_.end()) {
(...skipping 29 matching lines...) Expand all
268 269
269 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { 270 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const {
270 DCHECK_NE(session_id, kInvalidSessionId); 271 DCHECK_NE(session_id, kInvalidSessionId);
271 272
272 // Session may not exist if error happens during GenerateKeyRequest(). 273 // Session may not exist if error happens during GenerateKeyRequest().
273 SessionIdMap::const_iterator it = sessions_.find(session_id); 274 SessionIdMap::const_iterator it = sessions_.find(session_id);
274 return (it != sessions_.end()) ? it->second : base::EmptyString(); 275 return (it != sessions_.end()) ? it->second : base::EmptyString();
275 } 276 }
276 277
277 } // namespace content 278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698