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

Unified Diff: net/base/net_util.cc

Issue 1096783005: QUIC - Collect performance stats for QUIC vs non-QUIC when google (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor comment fix Created 5 years, 8 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
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) {
}

Powered by Google App Engine
This is Rietveld 408576698