OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/net/dns_probe_service.h" | 5 #include "chrome/browser/net/dns_probe_service.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 void DnsProbeService::ClearCachedResultForTesting() { | 127 void DnsProbeService::ClearCachedResultForTesting() { |
128 ClearCachedResult(); | 128 ClearCachedResult(); |
129 } | 129 } |
130 | 130 |
131 void DnsProbeService::SetSystemClientToCurrentConfig() { | 131 void DnsProbeService::SetSystemClientToCurrentConfig() { |
132 DnsConfig system_config; | 132 DnsConfig system_config; |
133 NetworkChangeNotifier::GetDnsConfig(&system_config); | 133 NetworkChangeNotifier::GetDnsConfig(&system_config); |
134 system_config.search.clear(); | 134 system_config.search.clear(); |
135 system_config.attempts = 1; | 135 system_config.attempts = 1; |
136 system_config.randomize_ports = false; | 136 system_config.randomize_ports = false; |
137 system_config.unhandled_options = false; | |
mmenke
2013/08/19 14:12:04
Wonder if we should just skip the probe in this ca
szym
2013/08/19 14:26:16
What does the prober do if there's no system confi
mmenke
2013/08/19 14:54:03
DnsProbeRunner::RunProbe checks if the transaction
szym
2013/08/20 18:55:34
Removed.
| |
137 | 138 |
138 scoped_ptr<DnsClient> system_client(DnsClient::CreateClient(NULL)); | 139 scoped_ptr<DnsClient> system_client(DnsClient::CreateClient(NULL)); |
139 system_client->SetConfig(system_config); | 140 system_client->SetConfig(system_config); |
140 | 141 |
141 system_runner_.SetClient(system_client.Pass()); | 142 system_runner_.SetClient(system_client.Pass()); |
142 } | 143 } |
143 | 144 |
144 void DnsProbeService::SetPublicClientToGooglePublicDns() { | 145 void DnsProbeService::SetPublicClientToGooglePublicDns() { |
145 DnsConfig public_config; | 146 DnsConfig public_config; |
146 public_config.nameservers.push_back(MakeDnsEndPoint(kGooglePublicDns1)); | 147 public_config.nameservers.push_back(MakeDnsEndPoint(kGooglePublicDns1)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 bool DnsProbeService::CachedResultIsExpired() const { | 211 bool DnsProbeService::CachedResultIsExpired() const { |
211 if (state_ != STATE_RESULT_CACHED) | 212 if (state_ != STATE_RESULT_CACHED) |
212 return false; | 213 return false; |
213 | 214 |
214 const base::TimeDelta kMaxResultAge = | 215 const base::TimeDelta kMaxResultAge = |
215 base::TimeDelta::FromMilliseconds(kMaxResultAgeMs); | 216 base::TimeDelta::FromMilliseconds(kMaxResultAgeMs); |
216 return base::Time::Now() - probe_start_time_ > kMaxResultAge; | 217 return base::Time::Now() - probe_start_time_ > kMaxResultAge; |
217 } | 218 } |
218 | 219 |
219 } // namespace chrome_browser_net | 220 } // namespace chrome_browser_net |
OLD | NEW |