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

Side by Side Diff: chrome/browser/chromeos/platform_keys/platform_keys_nss.cc

Issue 2838243002: Remove client_certs from SSLCertRequestInfo. (Closed)
Patch Set: missed bits 2 Created 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <cert.h> 5 #include <cert.h>
6 #include <cryptohi.h> 6 #include <cryptohi.h>
7 #include <keyhi.h> 7 #include <keyhi.h>
8 #include <secder.h> 8 #include <secder.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 std::unique_ptr<net::CertificateList> matches, 236 std::unique_ptr<net::CertificateList> matches,
237 const std::string& error_message) { 237 const std::string& error_message) {
238 origin_task_runner_->PostTask( 238 origin_task_runner_->PostTask(
239 from, base::Bind(callback_, base::Passed(&matches), error_message)); 239 from, base::Bind(callback_, base::Passed(&matches), error_message));
240 } 240 }
241 241
242 const std::string username_hash_; 242 const std::string username_hash_;
243 const bool use_system_key_slot_; 243 const bool use_system_key_slot_;
244 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; 244 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
245 std::unique_ptr<net::ClientCertStore> cert_store_; 245 std::unique_ptr<net::ClientCertStore> cert_store_;
246 std::unique_ptr<net::CertificateList> certs_;
247 246
248 private: 247 private:
249 // Must be called on origin thread, therefore use CallBack(). 248 // Must be called on origin thread, therefore use CallBack().
250 subtle::SelectCertificatesCallback callback_; 249 subtle::SelectCertificatesCallback callback_;
251 }; 250 };
252 251
253 class GetCertificatesState : public NSSOperationState { 252 class GetCertificatesState : public NSSOperationState {
254 public: 253 public:
255 explicit GetCertificatesState(const GetCertificatesCallback& callback); 254 explicit GetCertificatesState(const GetCertificatesCallback& callback);
256 ~GetCertificatesState() override {} 255 ~GetCertificatesState() override {}
257 256
258 void OnError(const tracked_objects::Location& from, 257 void OnError(const tracked_objects::Location& from,
259 const std::string& error_message) override { 258 const std::string& error_message) override {
260 CallBack(from, 259 CallBack(from,
261 std::unique_ptr<net::CertificateList>() /* no certificates */, 260 std::unique_ptr<net::CertificateList>() /* no certificates */,
262 error_message); 261 error_message);
263 } 262 }
264 263
265 void CallBack(const tracked_objects::Location& from, 264 void CallBack(const tracked_objects::Location& from,
266 std::unique_ptr<net::CertificateList> certs, 265 std::unique_ptr<net::CertificateList> certs,
267 const std::string& error_message) { 266 const std::string& error_message) {
268 origin_task_runner_->PostTask( 267 origin_task_runner_->PostTask(
269 from, base::Bind(callback_, base::Passed(&certs), error_message)); 268 from, base::Bind(callback_, base::Passed(&certs), error_message));
270 } 269 }
271
davidben 2017/04/26 02:37:56 Stray change?
mattm 2017/04/26 04:46:15 Done.
272 std::unique_ptr<net::CertificateList> certs_; 270 std::unique_ptr<net::CertificateList> certs_;
273 271
274 private: 272 private:
275 // Must be called on origin thread, therefore use CallBack(). 273 // Must be called on origin thread, therefore use CallBack().
276 GetCertificatesCallback callback_; 274 GetCertificatesCallback callback_;
277 }; 275 };
278 276
279 class ImportCertificateState : public NSSOperationState { 277 class ImportCertificateState : public NSSOperationState {
280 public: 278 public:
281 ImportCertificateState(const scoped_refptr<net::X509Certificate>& certificate, 279 ImportCertificateState(const scoped_refptr<net::X509Certificate>& certificate,
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 .WithPriority(base::TaskPriority::BACKGROUND) 541 .WithPriority(base::TaskPriority::BACKGROUND)
544 .WithShutdownBehavior( 542 .WithShutdownBehavior(
545 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), 543 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
546 base::Bind(&SignRSAOnWorkerThread, base::Passed(&state))); 544 base::Bind(&SignRSAOnWorkerThread, base::Passed(&state)));
547 } 545 }
548 546
549 // Called when ClientCertStoreChromeOS::GetClientCerts is done. Builds the list 547 // Called when ClientCertStoreChromeOS::GetClientCerts is done. Builds the list
550 // of net::CertificateList and calls back. Used by 548 // of net::CertificateList and calls back. Used by
551 // SelectCertificatesOnIOThread(). 549 // SelectCertificatesOnIOThread().
552 void DidSelectCertificatesOnIOThread( 550 void DidSelectCertificatesOnIOThread(
553 std::unique_ptr<SelectCertificatesState> state) { 551 std::unique_ptr<SelectCertificatesState> state,
552 net::CertificateList certs) {
554 DCHECK_CURRENTLY_ON(BrowserThread::IO); 553 DCHECK_CURRENTLY_ON(BrowserThread::IO);
555 state->CallBack(FROM_HERE, std::move(state->certs_), 554 state->CallBack(FROM_HERE,
555 base::MakeUnique<net::CertificateList>(std::move(certs)),
556 std::string() /* no error */); 556 std::string() /* no error */);
557 } 557 }
558 558
559 // Continues selecting certificates on the IO thread. Used by 559 // Continues selecting certificates on the IO thread. Used by
560 // SelectClientCertificates(). 560 // SelectClientCertificates().
561 void SelectCertificatesOnIOThread( 561 void SelectCertificatesOnIOThread(
562 std::unique_ptr<SelectCertificatesState> state) { 562 std::unique_ptr<SelectCertificatesState> state) {
563 DCHECK_CURRENTLY_ON(BrowserThread::IO); 563 DCHECK_CURRENTLY_ON(BrowserThread::IO);
564 state->cert_store_.reset(new ClientCertStoreChromeOS( 564 state->cert_store_.reset(new ClientCertStoreChromeOS(
565 nullptr, // no additional provider 565 nullptr, // no additional provider
566 base::MakeUnique<ClientCertFilterChromeOS>(state->use_system_key_slot_, 566 base::MakeUnique<ClientCertFilterChromeOS>(state->use_system_key_slot_,
567 state->username_hash_), 567 state->username_hash_),
568 ClientCertStoreChromeOS::PasswordDelegateFactory())); 568 ClientCertStoreChromeOS::PasswordDelegateFactory()));
569 569
570 state->certs_.reset(new net::CertificateList);
571
572 SelectCertificatesState* state_ptr = state.get(); 570 SelectCertificatesState* state_ptr = state.get();
573 state_ptr->cert_store_->GetClientCerts( 571 state_ptr->cert_store_->GetClientCerts(
574 *state_ptr->cert_request_info_, state_ptr->certs_.get(), 572 *state_ptr->cert_request_info_,
575 base::Bind(&DidSelectCertificatesOnIOThread, base::Passed(&state))); 573 base::Bind(&DidSelectCertificatesOnIOThread, base::Passed(&state)));
576 } 574 }
577 575
578 // Filters the obtained certificates on a worker thread. Used by 576 // Filters the obtained certificates on a worker thread. Used by
579 // DidGetCertificates(). 577 // DidGetCertificates().
580 void FilterCertificatesOnWorkerThread( 578 void FilterCertificatesOnWorkerThread(
581 std::unique_ptr<GetCertificatesState> state) { 579 std::unique_ptr<GetCertificatesState> state) {
582 std::unique_ptr<net::CertificateList> client_certs(new net::CertificateList); 580 std::unique_ptr<net::CertificateList> client_certs(new net::CertificateList);
583 for (net::CertificateList::const_iterator it = state->certs_->begin(); 581 for (net::CertificateList::const_iterator it = state->certs_->begin();
584 it != state->certs_->end(); 582 it != state->certs_->end();
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 NSSOperationState* state_ptr = state.get(); 904 NSSOperationState* state_ptr = state.get();
907 GetCertDatabase(std::string() /* don't get any specific slot */, 905 GetCertDatabase(std::string() /* don't get any specific slot */,
908 base::Bind(&GetTokensWithDB, base::Passed(&state)), 906 base::Bind(&GetTokensWithDB, base::Passed(&state)),
909 browser_context, 907 browser_context,
910 state_ptr); 908 state_ptr);
911 } 909 }
912 910
913 } // namespace platform_keys 911 } // namespace platform_keys
914 912
915 } // namespace chromeos 913 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698