diff options
author | ttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 23:40:43 +0000 |
---|---|---|
committer | ttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 23:40:43 +0000 |
commit | 4060442a0cd7c8521f8d034c9f9e855cb61627e6 (patch) | |
tree | 819324b8e10dc6eb2b01a283b37b227b36d13ea8 /chrome/browser/net/dns_probe_job.h | |
parent | 64954877e3e7fca9ffa936aee508ee338d78a293 (diff) | |
download | chromium_src-4060442a0cd7c8521f8d034c9f9e855cb61627e6.zip chromium_src-4060442a0cd7c8521f8d034c9f9e855cb61627e6.tar.gz chromium_src-4060442a0cd7c8521f8d034c9f9e855cb61627e6.tar.bz2 |
Beginnings of DnsProbeService.
BUG=156415
TEST=DnsProbeServiceTest, included
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11189025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/dns_probe_job.h')
-rw-r--r-- | chrome/browser/net/dns_probe_job.h | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/chrome/browser/net/dns_probe_job.h b/chrome/browser/net/dns_probe_job.h index b2412e2..462ec46 100644 --- a/chrome/browser/net/dns_probe_job.h +++ b/chrome/browser/net/dns_probe_job.h @@ -8,13 +8,11 @@ #include "base/basictypes.h" #include "base/bind.h" #include "base/memory/scoped_ptr.h" -#include "net/base/net_log.h" -#include "net/dns/dns_transaction.h" namespace net { class DnsClient; -struct DnsConfig; -}; +class NetLog; +} namespace chrome_browser_net { @@ -31,43 +29,21 @@ class DnsProbeJob { }; typedef base::Callback<void(DnsProbeJob* job, Result result)> CallbackType; + virtual ~DnsProbeJob() { } + // Creates and starts a probe job. // - // |dns_client| should be a DnsClient with the DnsConfig alreay set. + // |dns_client| should be a DnsClient with the DnsConfig already set. // |callback| will be called when the probe finishes, which may happen // before the constructor returns (for example, if we can't create the DNS // transactions). - DnsProbeJob(scoped_ptr<net::DnsClient> dns_client, - const CallbackType& callback, - net::NetLog* net_log); - ~DnsProbeJob(); - - private: - enum QueryStatus { - QUERY_UNKNOWN, - QUERY_CORRECT, - QUERY_INCORRECT, - QUERY_ERROR, - QUERY_RUNNING, - }; - - void MaybeFinishProbe(); - scoped_ptr<net::DnsTransaction> CreateTransaction( - const std::string& hostname); - void StartTransaction(net::DnsTransaction* transaction); - void OnTransactionComplete(net::DnsTransaction* transaction, - int net_error, - const net::DnsResponse* response); - void RunCallback(Result result); + static scoped_ptr<DnsProbeJob> CreateJob( + scoped_ptr<net::DnsClient> dns_client, + const CallbackType& callback, + net::NetLog* net_log); - net::BoundNetLog bound_net_log_; - scoped_ptr<net::DnsClient> dns_client_; - const CallbackType callback_; - bool probe_running_; - scoped_ptr<net::DnsTransaction> good_transaction_; - scoped_ptr<net::DnsTransaction> bad_transaction_; - QueryStatus good_status_; - QueryStatus bad_status_; + protected: + DnsProbeJob() { } DISALLOW_COPY_AND_ASSIGN(DnsProbeJob); }; |