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

Side by Side Diff: components/certificate_transparency/tree_state_tracker.cc

Issue 2650803004: Wire NetLog into the TreeStateTracker (Closed)
Patch Set: Created 3 years, 11 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 "components/certificate_transparency/tree_state_tracker.h" 5 #include "components/certificate_transparency/tree_state_tracker.h"
6 6
7 #include "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "components/certificate_transparency/log_dns_client.h" 9 #include "components/certificate_transparency/log_dns_client.h"
10 #include "components/certificate_transparency/single_tree_tracker.h" 10 #include "components/certificate_transparency/single_tree_tracker.h"
(...skipping 15 matching lines...) Expand all
26 const size_t kMaxConcurrentDnsQueries = 1; 26 const size_t kMaxConcurrentDnsQueries = 1;
27 } 27 }
28 28
29 namespace certificate_transparency { 29 namespace certificate_transparency {
30 30
31 // Enables or disables auditing Certificate Transparency logs over DNS. 31 // Enables or disables auditing Certificate Transparency logs over DNS.
32 const base::Feature kCTLogAuditing = {"CertificateTransparencyLogAuditing", 32 const base::Feature kCTLogAuditing = {"CertificateTransparencyLogAuditing",
33 base::FEATURE_DISABLED_BY_DEFAULT}; 33 base::FEATURE_DISABLED_BY_DEFAULT};
34 34
35 TreeStateTracker::TreeStateTracker( 35 TreeStateTracker::TreeStateTracker(
36 std::vector<scoped_refptr<const CTLogVerifier>> ct_logs) { 36 std::vector<scoped_refptr<const CTLogVerifier>> ct_logs,
37 net::NetLog* net_log) {
37 if (!base::FeatureList::IsEnabled(kCTLogAuditing)) 38 if (!base::FeatureList::IsEnabled(kCTLogAuditing))
38 return; 39 return;
39 40
40 // TODO(eranm): Hook up a real NetLog.
41 net::NetLogWithSource net_log;
42 std::unique_ptr<net::DnsClient> dns_client = 41 std::unique_ptr<net::DnsClient> dns_client =
43 net::DnsClient::CreateClient(net_log.net_log()); 42 net::DnsClient::CreateClient(net_log);
44 dns_client_ = base::MakeUnique<LogDnsClient>(std::move(dns_client), net_log, 43 dns_client_ = base::MakeUnique<LogDnsClient>(
45 kMaxConcurrentDnsQueries); 44 std::move(dns_client),
45 net::NetLogWithSource::Make(
46 net_log, net::NetLogSourceType::CT_LOG_AUDITOR),
eroman 2017/01/25 21:23:08 An alternate name could be CT_TREE_STATE_TRACKER,
Eran Messeri 2017/01/26 15:08:40 Done, as it'd be more consistent with the name of
eroman 2017/01/26 18:20:39 sgtm
47 kMaxConcurrentDnsQueries);
46 48
47 for (const auto& log : ct_logs) { 49 for (const auto& log : ct_logs) {
48 tree_trackers_[log->key_id()].reset( 50 tree_trackers_[log->key_id()].reset(
49 new SingleTreeTracker(log, dns_client_.get())); 51 new SingleTreeTracker(log, dns_client_.get()));
50 } 52 }
51 } 53 }
52 54
53 TreeStateTracker::~TreeStateTracker() {} 55 TreeStateTracker::~TreeStateTracker() {}
54 56
55 void TreeStateTracker::OnSCTVerified(X509Certificate* cert, 57 void TreeStateTracker::OnSCTVerified(X509Certificate* cert,
(...skipping 11 matching lines...) Expand all
67 // Is the STH from a known log? Since STHs can be provided from external 69 // Is the STH from a known log? Since STHs can be provided from external
68 // sources for logs not yet recognized by this client, return, rather than 70 // sources for logs not yet recognized by this client, return, rather than
69 // DCHECK. 71 // DCHECK.
70 if (it == tree_trackers_.end()) 72 if (it == tree_trackers_.end())
71 return; 73 return;
72 74
73 it->second->NewSTHObserved(sth); 75 it->second->NewSTHObserved(sth);
74 } 76 }
75 77
76 } // namespace certificate_transparency 78 } // namespace certificate_transparency
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698