| 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 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ | 5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ |
| 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ | 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // but the leaf index will be set. | 46 // but the leaf index will be set. |
| 47 using AuditProofCallback = | 47 using AuditProofCallback = |
| 48 base::Callback<void(int net_error, | 48 base::Callback<void(int net_error, |
| 49 std::unique_ptr<net::ct::MerkleAuditProof> proof)>; | 49 std::unique_ptr<net::ct::MerkleAuditProof> proof)>; |
| 50 | 50 |
| 51 // Creates a log client that will take ownership of |dns_client| and use it | 51 // Creates a log client that will take ownership of |dns_client| and use it |
| 52 // to perform DNS queries. Queries will be logged to |net_log|. | 52 // to perform DNS queries. Queries will be logged to |net_log|. |
| 53 // The |dns_client| does not need to be configured first - this will be done | 53 // The |dns_client| does not need to be configured first - this will be done |
| 54 // automatically as needed. | 54 // automatically as needed. |
| 55 LogDnsClient(std::unique_ptr<net::DnsClient> dns_client, | 55 LogDnsClient(std::unique_ptr<net::DnsClient> dns_client, |
| 56 const net::BoundNetLog& net_log); | 56 const net::NetLogWithSource& net_log); |
| 57 // Must be deleted on the same thread that it was created on. | 57 // Must be deleted on the same thread that it was created on. |
| 58 ~LogDnsClient() override; | 58 ~LogDnsClient() override; |
| 59 | 59 |
| 60 // Called by NetworkChangeNotifier when the DNS config changes. | 60 // Called by NetworkChangeNotifier when the DNS config changes. |
| 61 // The DnsClient's config will be updated in response. | 61 // The DnsClient's config will be updated in response. |
| 62 void OnDNSChanged() override; | 62 void OnDNSChanged() override; |
| 63 | 63 |
| 64 // Called by NetworkChangeNotifier when the DNS config is first read. | 64 // Called by NetworkChangeNotifier when the DNS config is first read. |
| 65 // The DnsClient's config will be updated in response. | 65 // The DnsClient's config will be updated in response. |
| 66 void OnInitialDNSConfigRead() override; | 66 void OnInitialDNSConfigRead() override; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // A DNS query that is in flight. | 114 // A DNS query that is in flight. |
| 115 template <typename CallbackType> | 115 template <typename CallbackType> |
| 116 struct Query { | 116 struct Query { |
| 117 std::unique_ptr<net::DnsTransaction> transaction; | 117 std::unique_ptr<net::DnsTransaction> transaction; |
| 118 CallbackType callback; | 118 CallbackType callback; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 // Used to perform DNS queries. | 121 // Used to perform DNS queries. |
| 122 std::unique_ptr<net::DnsClient> dns_client_; | 122 std::unique_ptr<net::DnsClient> dns_client_; |
| 123 // Passed to the DNS client for logging. | 123 // Passed to the DNS client for logging. |
| 124 net::BoundNetLog net_log_; | 124 net::NetLogWithSource net_log_; |
| 125 // Leaf index queries that haven't completed yet. | 125 // Leaf index queries that haven't completed yet. |
| 126 std::list<Query<LeafIndexCallback>> leaf_index_queries_; | 126 std::list<Query<LeafIndexCallback>> leaf_index_queries_; |
| 127 // Audit proof queries that haven't completed yet. | 127 // Audit proof queries that haven't completed yet. |
| 128 std::list<Query<AuditProofCallback>> audit_proof_queries_; | 128 std::list<Query<AuditProofCallback>> audit_proof_queries_; |
| 129 // Creates weak_ptrs to this, for callback purposes. | 129 // Creates weak_ptrs to this, for callback purposes. |
| 130 base::WeakPtrFactory<LogDnsClient> weak_ptr_factory_; | 130 base::WeakPtrFactory<LogDnsClient> weak_ptr_factory_; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(LogDnsClient); | 132 DISALLOW_COPY_AND_ASSIGN(LogDnsClient); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 } // namespace certificate_transparency | 135 } // namespace certificate_transparency |
| 136 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ | 136 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ |
| OLD | NEW |