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

Unified Diff: chrome/browser/net/dns_probe_runner.h

Issue 13270005: Display DNS probe results. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Refactor a bit again (DnsProbeRunner is now tied to a single DnsClient), other fixes Created 7 years, 6 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
Index: chrome/browser/net/dns_probe_runner.h
diff --git a/chrome/browser/net/dns_probe_runner.h b/chrome/browser/net/dns_probe_runner.h
new file mode 100644
index 0000000000000000000000000000000000000000..aa57d724d093be14900b635c217245993c612f16
--- /dev/null
+++ b/chrome/browser/net/dns_probe_runner.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NET_DNS_PROBE_RUNNER_H
+
+#define CHROME_BROWSER_NET_DNS_PROBE_RUNNER_H
mmenke 2013/06/11 16:15:35 nit: Blank line not needed between these two line
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+
+#include <list>
mmenke 2013/06/11 16:15:35 Not needed.
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+
+#include "base/bind.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "net/base/net_log.h"
+
+namespace net {
+class DnsClient;
+struct DnsConfig;
+class DnsResponse;
+class DnsTransaction;
+}
+
+namespace chrome_browser_net {
+
+// Runs DNS probes using a single DnsClient and evaluates the responses.
mmenke 2013/06/11 16:15:35 nit: responses -> response
mmenke 2013/06/11 16:15:35 Think it's worth mentioning that we use google.com
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Disagree; a DnsProbeRunner can run multiple probes
+// Used by DnsProbeService to probe the system and public DNS configurations.
+class DnsProbeRunner {
+ public:
+ enum Result {
+ UNKNOWN,
+ CORRECT,
+ INCORRECT,
mmenke 2013/06/11 16:15:35 Think it's worth commenting that any response that
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+ FAILING,
mmenke 2013/06/11 16:15:35 Also think it's worth mentioning this means we rec
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+ UNREACHABLE
+ };
+
+ typedef base::Callback<void(Result)> ProbeCallback;
+
+ DnsProbeRunner();
+ ~DnsProbeRunner();
+
+ void RunProbe(const ProbeCallback& callback);
+
+ void set_client(scoped_ptr<net::DnsClient> client);
+ bool is_running() const;
mmenke 2013/06/11 16:15:35 If you use this naming scheme, the function should
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+
+ private:
+ void OnTransactionComplete(bool async,
+ net::DnsTransaction* transaction,
+ int net_error,
+ const net::DnsResponse* response);
+
+ // Evaluates the result of a DnsTransaction (whether the response was
mmenke 2013/06/11 16:15:35 nit: Think this comment could be clearer. Sugges
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+ // |async| or not, the |net_error| returned by the transaction, and the
+ // DNS |response| received from the server).
+ //
+ // Returns a judgment of whether the DNS configuration is returning
+ // correct results, incorrect results, errors, or nothing.
+ static Result EvaluateResponse(bool async,
+ int net_error,
+ const net::DnsResponse* response);
mmenke 2013/06/11 16:15:35 Seems like this doesn't need to be declared here -
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+
+ base::WeakPtrFactory<DnsProbeRunner> weak_factory_;
+ net::BoundNetLog bound_net_log_;
mmenke 2013/06/11 16:15:35 No need for this, or the include in this file. Yo
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+ scoped_ptr<net::DnsClient> client_;
+ ProbeCallback callback_;
+ scoped_ptr<net::DnsTransaction> transaction_;
mmenke 2013/06/11 16:15:35 DISALLOW_COPY_AND_ASSIGN (And also the correspodin
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+};
+
+} // namespace chrome_browser_net
+
+#endif // CHROME_BROWSER_NET_DNS_PROBE_RUNNER_H

Powered by Google App Engine
This is Rietveld 408576698