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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 void DnsProbeService::ClearCachedResultForTesting() { | 168 void DnsProbeService::ClearCachedResultForTesting() { |
169 ClearCachedResult(); | 169 ClearCachedResult(); |
170 } | 170 } |
171 | 171 |
172 void DnsProbeService::SetSystemClientToCurrentConfig() { | 172 void DnsProbeService::SetSystemClientToCurrentConfig() { |
173 DnsConfig system_config; | 173 DnsConfig system_config; |
174 NetworkChangeNotifier::GetDnsConfig(&system_config); | 174 NetworkChangeNotifier::GetDnsConfig(&system_config); |
175 system_config.search.clear(); | 175 system_config.search.clear(); |
176 system_config.attempts = 1; | 176 system_config.attempts = 1; |
177 system_config.randomize_ports = false; | 177 system_config.randomize_ports = false; |
| 178 system_config.unhandled_options = false; |
178 | 179 |
179 scoped_ptr<DnsClient> system_client(DnsClient::CreateClient(NULL)); | 180 scoped_ptr<DnsClient> system_client(DnsClient::CreateClient(NULL)); |
180 system_client->SetConfig(system_config); | 181 system_client->SetConfig(system_config); |
181 | 182 |
182 system_runner_.SetClient(system_client.Pass()); | 183 system_runner_.SetClient(system_client.Pass()); |
183 } | 184 } |
184 | 185 |
185 void DnsProbeService::SetPublicClientToGooglePublicDns() { | 186 void DnsProbeService::SetPublicClientToGooglePublicDns() { |
186 DnsConfig public_config; | 187 DnsConfig public_config; |
187 public_config.nameservers.push_back(MakeDnsEndPoint(kGooglePublicDns1)); | 188 public_config.nameservers.push_back(MakeDnsEndPoint(kGooglePublicDns1)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 bool DnsProbeService::CachedResultIsExpired() const { | 252 bool DnsProbeService::CachedResultIsExpired() const { |
252 if (state_ != STATE_RESULT_CACHED) | 253 if (state_ != STATE_RESULT_CACHED) |
253 return false; | 254 return false; |
254 | 255 |
255 const base::TimeDelta kMaxResultAge = | 256 const base::TimeDelta kMaxResultAge = |
256 base::TimeDelta::FromMilliseconds(kMaxResultAgeMs); | 257 base::TimeDelta::FromMilliseconds(kMaxResultAgeMs); |
257 return base::Time::Now() - probe_start_time_ > kMaxResultAge; | 258 return base::Time::Now() - probe_start_time_ > kMaxResultAge; |
258 } | 259 } |
259 | 260 |
260 } // namespace chrome_browser_net | 261 } // namespace chrome_browser_net |
OLD | NEW |