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

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

Issue 179123009: Encrypted Media: Use uint32 for systemCode in SessionError. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 persistent_sessions_.erase(it); 233 persistent_sessions_.erase(it);
234 OnSessionError( 234 OnSessionError(
235 session_id, media::MediaKeys::kUnknownError, kSessionClosedSystemCode); 235 session_id, media::MediaKeys::kUnknownError, kSessionClosedSystemCode);
236 } 236 }
237 237
238 sessions_.erase(session_id); 238 sessions_.erase(session_id);
239 } 239 }
240 240
241 void ProxyDecryptor::OnSessionError(uint32 session_id, 241 void ProxyDecryptor::OnSessionError(uint32 session_id,
242 media::MediaKeys::KeyError error_code, 242 media::MediaKeys::KeyError error_code,
243 int system_code) { 243 uint32 system_code) {
244 // Assumes that OnSessionCreated() has been called before this. 244 // Assumes that OnSessionCreated() has been called before this.
245 key_error_cb_.Run(LookupWebSessionId(session_id), error_code, system_code); 245 key_error_cb_.Run(LookupWebSessionId(session_id), error_code, system_code);
246 } 246 }
247 247
248 uint32 ProxyDecryptor::LookupSessionId(const std::string& session_id) const { 248 uint32 ProxyDecryptor::LookupSessionId(const std::string& session_id) const {
249 for (SessionIdMap::const_iterator it = sessions_.begin(); 249 for (SessionIdMap::const_iterator it = sessions_.begin();
250 it != sessions_.end(); 250 it != sessions_.end();
251 ++it) { 251 ++it) {
252 if (it->second == session_id) 252 if (it->second == session_id)
253 return it->first; 253 return it->first;
254 } 254 }
255 255
256 // If |session_id| is null, then use the single reference id. 256 // If |session_id| is null, then use the single reference id.
257 if (session_id.empty() && sessions_.size() == 1) 257 if (session_id.empty() && sessions_.size() == 1)
258 return sessions_.begin()->first; 258 return sessions_.begin()->first;
259 259
260 return kInvalidSessionId; 260 return kInvalidSessionId;
261 } 261 }
262 262
263 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { 263 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const {
264 DCHECK_NE(session_id, kInvalidSessionId); 264 DCHECK_NE(session_id, kInvalidSessionId);
265 265
266 // Session may not exist if error happens during GenerateKeyRequest(). 266 // Session may not exist if error happens during GenerateKeyRequest().
267 SessionIdMap::const_iterator it = sessions_.find(session_id); 267 SessionIdMap::const_iterator it = sessions_.find(session_id);
268 return (it != sessions_.end()) ? it->second : base::EmptyString(); 268 return (it != sessions_.end()) ? it->second : base::EmptyString();
269 } 269 }
270 270
271 } // namespace content 271 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698