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

Unified Diff: components/certificate_transparency/log_dns_client.h

Issue 2152143003: Automatically update LogDnsClient's DNS config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Documents test members Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/certificate_transparency/log_dns_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/certificate_transparency/log_dns_client.h
diff --git a/components/certificate_transparency/log_dns_client.h b/components/certificate_transparency/log_dns_client.h
index e00cefde49e227e18143446a15baae7ca9f642b7..366702925c619ec1809ded8d3931ab9f806e5c36 100644
--- a/components/certificate_transparency/log_dns_client.h
+++ b/components/certificate_transparency/log_dns_client.h
@@ -13,6 +13,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/strings/string_piece.h"
+#include "net/base/network_change_notifier.h"
#include "net/log/net_log.h"
namespace net {
@@ -30,7 +31,8 @@ namespace certificate_transparency {
// All queries are performed asynchronously.
// For more information, see
// https://github.com/google/certificate-transparency-rfcs/blob/master/dns/draft-ct-over-dns.md.
-class LogDnsClient {
+// It must be created and deleted on the same thread. It is not thread-safe.
+class LogDnsClient : public net::NetworkChangeNotifier::DNSObserver {
public:
// Invoked when a leaf index query completes.
// If an error occured, |net_error| will be a net::Error code, otherwise it
@@ -48,9 +50,20 @@ class LogDnsClient {
// Creates a log client that will take ownership of |dns_client| and use it
// to perform DNS queries. Queries will be logged to |net_log|.
+ // The |dns_client| does not need to be configured first - this will be done
+ // automatically as needed.
LogDnsClient(std::unique_ptr<net::DnsClient> dns_client,
const net::BoundNetLog& net_log);
- virtual ~LogDnsClient();
+ // Must be deleted on the same thread that it was created on.
+ ~LogDnsClient() override;
+
+ // Called by NetworkChangeNotifier when the DNS config changes.
+ // The DnsClient's config will be updated in response.
+ void OnDNSChanged() override;
+
+ // Called by NetworkChangeNotifier when the DNS config is first read.
+ // The DnsClient's config will be updated in response.
+ void OnInitialDNSConfigRead() override;
// Queries a CT log to discover the index of the leaf with |leaf_hash|.
// The log is identified by |domain_for_log|, which is the DNS name used as a
@@ -95,6 +108,9 @@ class LogDnsClient {
int net_error,
const net::DnsResponse* response);
+ // Updates the |dns_client_| config using NetworkChangeNotifier.
+ void UpdateDnsConfig();
+
// A DNS query that is in flight.
template <typename CallbackType>
struct Query {
« no previous file with comments | « no previous file | components/certificate_transparency/log_dns_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698