| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "net/cert/internal/trust_store_collection.h" | 5 #include "net/cert/internal/trust_store_collection.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 TrustStoreCollection::TrustStoreCollection() = default; | 9 TrustStoreCollection::TrustStoreCollection() = default; |
| 10 TrustStoreCollection::~TrustStoreCollection() = default; | 10 TrustStoreCollection::~TrustStoreCollection() = default; |
| 11 | 11 |
| 12 void TrustStoreCollection::SetPrimaryTrustStore(TrustStore* store) { | 12 void TrustStoreCollection::AddTrustStore(TrustStore* store) { |
| 13 DCHECK(!primary_store_); | |
| 14 DCHECK(store); | 13 DCHECK(store); |
| 15 primary_store_ = store; | 14 stores_.push_back(store); |
| 16 } | |
| 17 | |
| 18 void TrustStoreCollection::AddTrustStoreSynchronousOnly(TrustStore* store) { | |
| 19 DCHECK(store); | |
| 20 sync_only_stores_.push_back(store); | |
| 21 } | 15 } |
| 22 | 16 |
| 23 void TrustStoreCollection::FindTrustAnchorsForCert( | 17 void TrustStoreCollection::FindTrustAnchorsForCert( |
| 24 const scoped_refptr<ParsedCertificate>& cert, | 18 const scoped_refptr<ParsedCertificate>& cert, |
| 25 const TrustAnchorsCallback& callback, | 19 TrustAnchors* matches) const { |
| 26 TrustAnchors* synchronous_matches, | 20 for (auto* store : stores_) { |
| 27 std::unique_ptr<Request>* out_req) const { | 21 store->FindTrustAnchorsForCert(cert, matches); |
| 28 if (primary_store_) | |
| 29 primary_store_->FindTrustAnchorsForCert(cert, callback, synchronous_matches, | |
| 30 out_req); | |
| 31 | |
| 32 for (auto* store : sync_only_stores_) { | |
| 33 store->FindTrustAnchorsForCert(cert, TrustAnchorsCallback(), | |
| 34 synchronous_matches, nullptr); | |
| 35 } | 22 } |
| 36 } | 23 } |
| 37 | 24 |
| 38 } // namespace net | 25 } // namespace net |
| OLD | NEW |