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

Unified Diff: chrome/browser/net/dns_probe_service.cc

Issue 1807663002: Migrate chrome/browser/net/* to net::IPAddress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments eroman Created 4 years, 9 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
« no previous file with comments | « chrome/browser/net/dns_probe_runner.cc ('k') | chrome/browser/net/dns_probe_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/dns_probe_service.cc
diff --git a/chrome/browser/net/dns_probe_service.cc b/chrome/browser/net/dns_probe_service.cc
index fcec99818e59ea7a0b10b02586f89c9283a7215d..a16b65c5fe618c15b195b6cb2729150e21324110 100644
--- a/chrome/browser/net/dns_probe_service.cc
+++ b/chrome/browser/net/dns_probe_service.cc
@@ -4,11 +4,14 @@
#include "chrome/browser/net/dns_probe_service.h"
+#include <stdint.h>
+
#include <utility>
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
+#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/dns/dns_client.h"
#include "net/dns/dns_config_service.h"
@@ -19,7 +22,6 @@ using base::StringToInt;
using error_page::DnsProbeStatus;
using net::DnsClient;
using net::DnsConfig;
-using net::IPAddressNumber;
using net::ParseIPLiteralToNumber;
using net::NetworkChangeNotifier;
@@ -34,15 +36,8 @@ const int kMaxResultAgeMs = 5000;
// The public DNS servers used by the DnsProbeService to verify internet
// connectivity.
-const char kGooglePublicDns1[] = "8.8.8.8";
-const char kGooglePublicDns2[] = "8.8.4.4";
-
-net::IPEndPoint MakeDnsEndPoint(const std::string& dns_ip_literal) {
- IPAddressNumber dns_ip_number;
- bool rv = ParseIPLiteralToNumber(dns_ip_literal, &dns_ip_number);
- DCHECK(rv);
- return net::IPEndPoint(dns_ip_number, net::dns_protocol::kDefaultPort);
-}
+const uint8_t kGooglePublicDns1[] = {8, 8, 8, 8};
+const uint8_t kGooglePublicDns2[] = {8, 8, 4, 4};
DnsProbeStatus EvaluateResults(DnsProbeRunner::Result system_result,
DnsProbeRunner::Result public_result) {
@@ -154,8 +149,10 @@ void DnsProbeService::SetSystemClientToCurrentConfig() {
void DnsProbeService::SetPublicClientToGooglePublicDns() {
DnsConfig public_config;
- public_config.nameservers.push_back(MakeDnsEndPoint(kGooglePublicDns1));
- public_config.nameservers.push_back(MakeDnsEndPoint(kGooglePublicDns2));
+ public_config.nameservers.push_back(net::IPEndPoint(
+ net::IPAddress(kGooglePublicDns1), net::dns_protocol::kDefaultPort));
+ public_config.nameservers.push_back(net::IPEndPoint(
+ net::IPAddress(kGooglePublicDns2), net::dns_protocol::kDefaultPort));
public_config.attempts = 1;
public_config.randomize_ports = false;
« no previous file with comments | « chrome/browser/net/dns_probe_runner.cc ('k') | chrome/browser/net/dns_probe_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698