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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NET_DNS_PROBE_RUNNER_H
6
7 #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.
8
9 #include <list>
mmenke 2013/06/11 16:15:35 Not needed.
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
10
11 #include "base/bind.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "net/base/net_log.h"
15
16 namespace net {
17 class DnsClient;
18 struct DnsConfig;
19 class DnsResponse;
20 class DnsTransaction;
21 }
22
23 namespace chrome_browser_net {
24
25 // 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
26 // Used by DnsProbeService to probe the system and public DNS configurations.
27 class DnsProbeRunner {
28 public:
29 enum Result {
30 UNKNOWN,
31 CORRECT,
32 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.
33 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.
34 UNREACHABLE
35 };
36
37 typedef base::Callback<void(Result)> ProbeCallback;
38
39 DnsProbeRunner();
40 ~DnsProbeRunner();
41
42 void RunProbe(const ProbeCallback& callback);
43
44 void set_client(scoped_ptr<net::DnsClient> client);
45 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.
46
47 private:
48 void OnTransactionComplete(bool async,
49 net::DnsTransaction* transaction,
50 int net_error,
51 const net::DnsResponse* response);
52
53 // 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.
54 // |async| or not, the |net_error| returned by the transaction, and the
55 // DNS |response| received from the server).
56 //
57 // Returns a judgment of whether the DNS configuration is returning
58 // correct results, incorrect results, errors, or nothing.
59 static Result EvaluateResponse(bool async,
60 int net_error,
61 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.
62
63 base::WeakPtrFactory<DnsProbeRunner> weak_factory_;
64 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.
65 scoped_ptr<net::DnsClient> client_;
66 ProbeCallback callback_;
67 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.
68 };
69
70 } // namespace chrome_browser_net
71
72 #endif // CHROME_BROWSER_NET_DNS_PROBE_RUNNER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698