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..3cdc380d09828ea08d9d89794fea1533ee826620 100644 |
| --- a/net/base/net_util.cc |
| +++ b/net/base/net_util.cc |
| @@ -1031,6 +1031,29 @@ bool IsLocalhostTLD(const std::string& host) { |
| 0; |
| } |
| +bool HasGoogleHost(const GURL& url) { |
| + static const char* kSuffixesToGoogleHosts[] = { |
|
Ryan Hamilton
2015/04/28 04:25:18
nit: kGoogleHostSuffixes ?
ramant (doing other things)
2015/04/28 17:19:16
Done.
|
| + ".google.com", |
| + ".youtube.com", |
| + ".gmail.com", |
| + ".doubleclick.net", |
| + ".gstatic.com", |
| + ".googlevideo.com", |
| + ".googleusercontent.com", |
| + ".googlesyndication.com", |
| + ".google-analytics.com", |
| + ".googleadservices.com", |
| + ".googleapis.com", |
| + ".ytimg.com", |
| + }; |
| + const std::string& host = url.host(); |
| + for (size_t i = 0; i < arraysize(kSuffixesToGoogleHosts); ++i) { |
|
Ryan Hamilton
2015/04/28 04:25:18
nit: I think you can do something like:
for (con
ramant (doing other things)
2015/04/28 17:19:16
Done.
|
| + if (EndsWith(host, kSuffixesToGoogleHosts[i], false)) |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| NetworkInterface::NetworkInterface() |
| : type(NetworkChangeNotifier::CONNECTION_UNKNOWN), prefix_length(0) { |
| } |