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

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

Issue 2848313003: Revert of Remove client_certs from SSLCertRequestInfo. (Closed)
Patch Set: 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_;
246 247
247 private: 248 private:
248 // Must be called on origin thread, therefore use CallBack(). 249 // Must be called on origin thread, therefore use CallBack().
249 subtle::SelectCertificatesCallback callback_; 250 subtle::SelectCertificatesCallback callback_;
250 }; 251 };
251 252
252 class GetCertificatesState : public NSSOperationState { 253 class GetCertificatesState : public NSSOperationState {
253 public: 254 public:
254 explicit GetCertificatesState(const GetCertificatesCallback& callback); 255 explicit GetCertificatesState(const GetCertificatesCallback& callback);
255 ~GetCertificatesState() override {} 256 ~GetCertificatesState() override {}
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 .WithPriority(base::TaskPriority::BACKGROUND) 543 .WithPriority(base::TaskPriority::BACKGROUND)
543 .WithShutdownBehavior( 544 .WithShutdownBehavior(
544 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), 545 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
545 base::Bind(&SignRSAOnWorkerThread, base::Passed(&state))); 546 base::Bind(&SignRSAOnWorkerThread, base::Passed(&state)));
546 } 547 }
547 548
548 // Called when ClientCertStoreChromeOS::GetClientCerts is done. Builds the list 549 // Called when ClientCertStoreChromeOS::GetClientCerts is done. Builds the list
549 // of net::CertificateList and calls back. Used by 550 // of net::CertificateList and calls back. Used by
550 // SelectCertificatesOnIOThread(). 551 // SelectCertificatesOnIOThread().
551 void DidSelectCertificatesOnIOThread( 552 void DidSelectCertificatesOnIOThread(
552 std::unique_ptr<SelectCertificatesState> state, 553 std::unique_ptr<SelectCertificatesState> state) {
553 net::CertificateList certs) {
554 DCHECK_CURRENTLY_ON(BrowserThread::IO); 554 DCHECK_CURRENTLY_ON(BrowserThread::IO);
555 state->CallBack(FROM_HERE, 555 state->CallBack(FROM_HERE, std::move(state->certs_),
556 base::MakeUnique<net::CertificateList>(std::move(certs)),
557 std::string() /* no error */); 556 std::string() /* no error */);
558 } 557 }
559 558
560 // Continues selecting certificates on the IO thread. Used by 559 // Continues selecting certificates on the IO thread. Used by
561 // SelectClientCertificates(). 560 // SelectClientCertificates().
562 void SelectCertificatesOnIOThread( 561 void SelectCertificatesOnIOThread(
563 std::unique_ptr<SelectCertificatesState> state) { 562 std::unique_ptr<SelectCertificatesState> state) {
564 DCHECK_CURRENTLY_ON(BrowserThread::IO); 563 DCHECK_CURRENTLY_ON(BrowserThread::IO);
565 state->cert_store_.reset(new ClientCertStoreChromeOS( 564 state->cert_store_.reset(new ClientCertStoreChromeOS(
566 nullptr, // no additional provider 565 nullptr, // no additional provider
567 base::MakeUnique<ClientCertFilterChromeOS>(state->use_system_key_slot_, 566 base::MakeUnique<ClientCertFilterChromeOS>(state->use_system_key_slot_,
568 state->username_hash_), 567 state->username_hash_),
569 ClientCertStoreChromeOS::PasswordDelegateFactory())); 568 ClientCertStoreChromeOS::PasswordDelegateFactory()));
570 569
570 state->certs_.reset(new net::CertificateList);
571
571 SelectCertificatesState* state_ptr = state.get(); 572 SelectCertificatesState* state_ptr = state.get();
572 state_ptr->cert_store_->GetClientCerts( 573 state_ptr->cert_store_->GetClientCerts(
573 *state_ptr->cert_request_info_, 574 *state_ptr->cert_request_info_, state_ptr->certs_.get(),
574 base::Bind(&DidSelectCertificatesOnIOThread, base::Passed(&state))); 575 base::Bind(&DidSelectCertificatesOnIOThread, base::Passed(&state)));
575 } 576 }
576 577
577 // Filters the obtained certificates on a worker thread. Used by 578 // Filters the obtained certificates on a worker thread. Used by
578 // DidGetCertificates(). 579 // DidGetCertificates().
579 void FilterCertificatesOnWorkerThread( 580 void FilterCertificatesOnWorkerThread(
580 std::unique_ptr<GetCertificatesState> state) { 581 std::unique_ptr<GetCertificatesState> state) {
581 std::unique_ptr<net::CertificateList> client_certs(new net::CertificateList); 582 std::unique_ptr<net::CertificateList> client_certs(new net::CertificateList);
582 for (net::CertificateList::const_iterator it = state->certs_->begin(); 583 for (net::CertificateList::const_iterator it = state->certs_->begin();
583 it != state->certs_->end(); 584 it != state->certs_->end();
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 NSSOperationState* state_ptr = state.get(); 906 NSSOperationState* state_ptr = state.get();
906 GetCertDatabase(std::string() /* don't get any specific slot */, 907 GetCertDatabase(std::string() /* don't get any specific slot */,
907 base::Bind(&GetTokensWithDB, base::Passed(&state)), 908 base::Bind(&GetTokensWithDB, base::Passed(&state)),
908 browser_context, 909 browser_context,
909 state_ptr); 910 state_ptr);
910 } 911 }
911 912
912 } // namespace platform_keys 913 } // namespace platform_keys
913 914
914 } // namespace chromeos 915 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/client_cert_store_chromeos_unittest.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698