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

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: Sync'd to revision p349162. Created 5 years, 3 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 reinterpret_cast<const char*>(vector_as_array(&cert_der)), 171 reinterpret_cast<const char*>(vector_as_array(&cert_der)),
172 cert_der.size())); 172 cert_der.size()));
173 } 173 }
174 scoped_refptr<net::X509Certificate> cert_chain( 174 scoped_refptr<net::X509Certificate> cert_chain(
175 net::X509Certificate::CreateFromDERCertChain(der_cert_chain)); 175 net::X509Certificate::CreateFromDERCertChain(der_cert_chain));
176 if (!cert_chain) { 176 if (!cert_chain) {
177 callback.Run(platform_keys::kErrorInvalidX509Cert, 0, 0); 177 callback.Run(platform_keys::kErrorInvalidX509Cert, 0, 0);
178 return; 178 return;
179 } 179 }
180 180
181 net::CertVerifier* verifier = nullptr; 181 if (!ContainsKey(extension_to_verifier_, extension_id)) {
182 if (ContainsKey(extension_to_verifier_, extension_id)) { 182 extension_to_verifier_[extension_id] =
183 verifier = extension_to_verifier_[extension_id].get(); 183 make_linked_ptr(net::CertVerifier::CreateDefault().release());
184 } else {
185 verifier = net::CertVerifier::CreateDefault();
186 extension_to_verifier_[extension_id] = make_linked_ptr(verifier);
187 } 184 }
185 net::CertVerifier* verifier = extension_to_verifier_[extension_id].get();
188 186
189 scoped_ptr<net::CertVerifyResult> verify_result(new net::CertVerifyResult); 187 scoped_ptr<net::CertVerifyResult> verify_result(new net::CertVerifyResult);
190 scoped_ptr<net::BoundNetLog> net_log(new net::BoundNetLog); 188 scoped_ptr<net::BoundNetLog> net_log(new net::BoundNetLog);
191 const int flags = 0; 189 const int flags = 0;
192 190
193 std::string ocsp_response; 191 std::string ocsp_response;
194 net::CertVerifyResult* const verify_result_ptr = verify_result.get(); 192 net::CertVerifyResult* const verify_result_ptr = verify_result.get();
195 193
196 RequestState* request_state = new RequestState(); 194 RequestState* request_state = new RequestState();
197 base::Callback<void(int)> bound_callback( 195 base::Callback<void(int)> bound_callback(
(...skipping 21 matching lines...) Expand all
219 scoped_ptr<net::CertVerifyResult> verify_result, 217 scoped_ptr<net::CertVerifyResult> verify_result,
220 RequestState* request_state, 218 RequestState* request_state,
221 int return_value) { 219 int return_value) {
222 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 220 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
223 221
224 callback.Run(std::string() /* no error message */, return_value, 222 callback.Run(std::string() /* no error message */, return_value,
225 verify_result->cert_status); 223 verify_result->cert_status);
226 } 224 }
227 225
228 } // namespace extensions 226 } // namespace extensions
OLDNEW
« no previous file with comments | « android_webview/browser/net/aw_url_request_context_getter.cc ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698