| 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 "net/dns/dns_config_service.h" | 5 #include "net/dns/dns_config_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 NameServerClassifier::~NameServerClassifier() {} | 43 NameServerClassifier::~NameServerClassifier() {} |
| 44 | 44 |
| 45 NameServerClassifier::NameServersType NameServerClassifier::GetNameServersType( | 45 NameServerClassifier::NameServersType NameServerClassifier::GetNameServersType( |
| 46 const std::vector<IPEndPoint>& nameservers) const { | 46 const std::vector<IPEndPoint>& nameservers) const { |
| 47 NameServersType type = NAME_SERVERS_TYPE_NONE; | 47 NameServersType type = NAME_SERVERS_TYPE_NONE; |
| 48 for (std::vector<IPEndPoint>::const_iterator it = nameservers.begin(); | 48 for (std::vector<IPEndPoint>::const_iterator it = nameservers.begin(); |
| 49 it != nameservers.end(); | 49 it != nameservers.end(); |
| 50 ++it) { | 50 ++it) { |
| 51 type = MergeNameServersTypes(type, GetNameServerType(it->address())); | 51 type = |
| 52 MergeNameServersTypes(type, GetNameServerType(it->address().bytes())); |
| 52 } | 53 } |
| 53 return type; | 54 return type; |
| 54 } | 55 } |
| 55 | 56 |
| 56 struct NameServerClassifier::NameServerTypeRule { | 57 struct NameServerClassifier::NameServerTypeRule { |
| 57 NameServerTypeRule(const char* pattern_string, NameServersType type) | 58 NameServerTypeRule(const char* pattern_string, NameServersType type) |
| 58 : type(type) { | 59 : type(type) { |
| 59 bool parsed = pattern.ParsePattern(pattern_string); | 60 bool parsed = pattern.ParsePattern(pattern_string); |
| 60 DCHECK(parsed); | 61 DCHECK(parsed); |
| 61 } | 62 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 if (watch_failed_) { | 311 if (watch_failed_) { |
| 311 // If a watch failed, the config may not be accurate, so report empty. | 312 // If a watch failed, the config may not be accurate, so report empty. |
| 312 callback_.Run(DnsConfig()); | 313 callback_.Run(DnsConfig()); |
| 313 } else { | 314 } else { |
| 314 callback_.Run(dns_config_); | 315 callback_.Run(dns_config_); |
| 315 } | 316 } |
| 316 } | 317 } |
| 317 | 318 |
| 318 } // namespace net | 319 } // namespace net |
| 319 | 320 |
| OLD | NEW |