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

Side by Side Diff: chrome/browser/extensions/api/platform_keys/verify_trust_api.cc

Issue 1290243007: Shift URLRequestContextStorage over to taking scoped_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Paul_BuilderGrab
Patch Set: Lots of fixes driven by try jobs. Created 5 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/extensions/api/platform_keys/verify_trust_api.h" 5 #include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 reinterpret_cast<const char*>(vector_as_array(&cert_der)), 170 reinterpret_cast<const char*>(vector_as_array(&cert_der)),
171 cert_der.size())); 171 cert_der.size()));
172 } 172 }
173 scoped_refptr<net::X509Certificate> cert_chain( 173 scoped_refptr<net::X509Certificate> cert_chain(
174 net::X509Certificate::CreateFromDERCertChain(der_cert_chain)); 174 net::X509Certificate::CreateFromDERCertChain(der_cert_chain));
175 if (!cert_chain) { 175 if (!cert_chain) {
176 callback.Run(platform_keys::kErrorInvalidX509Cert, 0, 0); 176 callback.Run(platform_keys::kErrorInvalidX509Cert, 0, 0);
177 return; 177 return;
178 } 178 }
179 179
180 net::CertVerifier* verifier = nullptr; 180 if (!ContainsKey(extension_to_verifier_, extension_id)) {
181 if (ContainsKey(extension_to_verifier_, extension_id)) { 181 extension_to_verifier_[extension_id] =
182 verifier = extension_to_verifier_[extension_id].get(); 182 make_linked_ptr(net::CertVerifier::CreateDefault().release());
183 } else {
184 verifier = net::CertVerifier::CreateDefault();
185 extension_to_verifier_[extension_id] = make_linked_ptr(verifier);
186 } 183 }
184 net::CertVerifier* verifier = extension_to_verifier_[extension_id].get();
187 185
188 scoped_ptr<net::CertVerifyResult> verify_result(new net::CertVerifyResult); 186 scoped_ptr<net::CertVerifyResult> verify_result(new net::CertVerifyResult);
189 scoped_ptr<net::BoundNetLog> net_log(new net::BoundNetLog); 187 scoped_ptr<net::BoundNetLog> net_log(new net::BoundNetLog);
190 const int flags = 0; 188 const int flags = 0;
191 189
192 std::string ocsp_response; 190 std::string ocsp_response;
193 net::CertVerifyResult* const verify_result_ptr = verify_result.get(); 191 net::CertVerifyResult* const verify_result_ptr = verify_result.get();
194 192
195 RequestState* request_state = new RequestState(); 193 RequestState* request_state = new RequestState();
196 base::Callback<void(int)> bound_callback( 194 base::Callback<void(int)> bound_callback(
(...skipping 21 matching lines...) Expand all
218 scoped_ptr<net::CertVerifyResult> verify_result, 216 scoped_ptr<net::CertVerifyResult> verify_result,
219 RequestState* request_state, 217 RequestState* request_state,
220 int return_value) { 218 int return_value) {
221 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 219 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
222 220
223 callback.Run(std::string() /* no error message */, return_value, 221 callback.Run(std::string() /* no error message */, return_value,
224 verify_result->cert_status); 222 verify_result->cert_status);
225 } 223 }
226 224
227 } // namespace extensions 225 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698