Chromium Code Reviews| Index: net/base/net_util.cc |
| diff --git a/net/base/net_util.cc b/net/base/net_util.cc |
| index c893e6164d0301196d9dcff4709bd977baa4a130..8fc1a410714faa7e6f69e2f45415c47044ba6c94 100644 |
| --- a/net/base/net_util.cc |
| +++ b/net/base/net_util.cc |
| @@ -1031,6 +1031,36 @@ bool IsLocalhostTLD(const std::string& host) { |
| 0; |
| } |
| +bool IsGoogleHost(const std::string& host) { |
| + static const size_t kMaxHostLength = 24; |
| + static const char kGoogleHosts[][kMaxHostLength] = { |
| + "google.com", |
| + "youtube.com", |
| + "gmail.com", |
| + "doubleclick.net", |
| + "gstatic.com", |
| + "googlevideo.com", |
| + "googleusercontent.com", |
| + "googlesyndication.com", |
| + "google-analytics.com", |
| + "googleadservices.com", |
| + "googleapis.com", |
| + "", |
| + }; |
| + for (size_t i = 0; kGoogleHosts[i][0]; ++i) { |
| + const char* google_host = kGoogleHosts[i]; |
| + const size_t google_host_length = strlen(google_host); |
| + if (host.size() >= google_host_length && |
| + host.compare(host.size() - google_host_length, google_host_length, |
| + google_host) == 0 && |
| + (host.size() == google_host_length || |
| + host[host.size() - google_host_length - 1] == '.')) { |
|
Alexei Svitkine (slow)
2015/04/27 19:23:55
This logic is quite complicated. In other places w
ramant (doing other things)
2015/04/28 00:30:25
The above is accepting a host name which could be
|
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| NetworkInterface::NetworkInterface() |
| : type(NetworkChangeNotifier::CONNECTION_UNKNOWN), prefix_length(0) { |
| } |