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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 return true; | 112 return true; |
113 } | 113 } |
114 | 114 |
115 bool ProxyDecryptor::GenerateKeyRequest(const std::string& type, | 115 bool ProxyDecryptor::GenerateKeyRequest(const std::string& type, |
116 const uint8* init_data, | 116 const uint8* init_data, |
117 int init_data_length) { | 117 int init_data_length) { |
118 // Use a unique reference id for this request. | 118 // Use a unique reference id for this request. |
119 uint32 session_id = next_session_id_++; | 119 uint32 session_id = next_session_id_++; |
120 if (!media_keys_->CreateSession( | 120 if (!media_keys_->CreateSession( |
121 session_id, type, init_data, init_data_length)) { | 121 session_id, type, init_data, init_data_length)) { |
122 media_keys_.reset(); | |
123 return false; | 122 return false; |
ddorwin
2014/01/07 19:28:48
Was the removed line just left over from before we
| |
124 } | 123 } |
125 | 124 |
126 return true; | 125 return true; |
127 } | 126 } |
128 | 127 |
129 void ProxyDecryptor::AddKey(const uint8* key, | 128 void ProxyDecryptor::AddKey(const uint8* key, |
130 int key_length, | 129 int key_length, |
131 const uint8* init_data, | 130 const uint8* init_data, |
132 int init_data_length, | 131 int init_data_length, |
133 const std::string& web_session_id) { | 132 const std::string& web_session_id) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 | 260 |
262 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) { | 261 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) { |
263 DCHECK_NE(session_id, kInvalidSessionId); | 262 DCHECK_NE(session_id, kInvalidSessionId); |
264 | 263 |
265 // Session may not exist if error happens during GenerateKeyRequest(). | 264 // Session may not exist if error happens during GenerateKeyRequest(). |
266 SessionIdMap::iterator it = sessions_.find(session_id); | 265 SessionIdMap::iterator it = sessions_.find(session_id); |
267 return (it != sessions_.end()) ? it->second : base::EmptyString(); | 266 return (it != sessions_.end()) ? it->second : base::EmptyString(); |
268 } | 267 } |
269 | 268 |
270 } // namespace content | 269 } // namespace content |
OLD | NEW |