Chromium Code Reviews| 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 "chrome/browser/metrics/variations/variations_http_header_provider.h" | 5 #include "chrome/browser/metrics/variations/variations_http_header_provider.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 google_util::ALLOW_NON_STANDARD_PORTS)) { | 222 google_util::ALLOW_NON_STANDARD_PORTS)) { |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| 225 | 225 |
| 226 if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS()) | 226 if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS()) |
| 227 return false; | 227 return false; |
| 228 | 228 |
| 229 // Some domains don't have international TLD extensions, so testing for them | 229 // Some domains don't have international TLD extensions, so testing for them |
| 230 // is very straight forward. | 230 // is very straight forward. |
| 231 const std::string host = url.host(); | 231 const std::string host = url.host(); |
| 232 if (EndsWith(host, ".doubleclick.net", false) || | 232 if (EndsWith(host, ".android.com", false) || |
| 233 EndsWith(host, ".doubleclick.com", false) || | |
| 234 EndsWith(host, ".doubleclick.net", false) || | |
| 235 EndsWith(host, ".ggpht.com", false) || | |
| 236 EndsWith(host, ".googleadservices.com", false) || | |
| 237 EndsWith(host, ".googleapis.com", false) || | |
| 238 EndsWith(host, ".googleapis.com", false) || | |
|
Alexei Svitkine (slow)
2014/05/29 20:14:38
This seems to be repeated.
Ryan Hamilton
2014/05/29 22:44:27
Done.
| |
| 233 EndsWith(host, ".googlesyndication.com", false) || | 239 EndsWith(host, ".googlesyndication.com", false) || |
| 240 EndsWith(host, ".googleusercontent.com", false) || | |
| 241 EndsWith(host, ".googlevideo.com", false) || | |
|
Alexei Svitkine (slow)
2014/05/29 20:14:38
This seems to be just a redirect, do we really nee
Ryan Hamilton
2014/05/29 22:44:27
www.googlevideo.com may be a redirect, but there a
| |
| 242 EndsWith(host, ".gstatic.com", false) || | |
| 243 EndsWith(host, ".youtube.com", false) || | |
|
Alexei Svitkine (slow)
2014/05/29 20:14:38
Youtube is already being checked lower down.
Ryan Hamilton
2014/05/29 22:44:27
Done.
| |
| 244 EndsWith(host, ".ytimg.com", false) || | |
|
Ryan Hamilton
2014/05/28 22:38:31
If you prefer, we could stick these suffixes into
Alexei Svitkine (slow)
2014/05/29 00:08:54
Yeah, that would be better if we really want that
Ryan Hamilton
2014/05/29 22:44:27
That's the plan, yes.
| |
| 234 LowerCaseEqualsASCII(host, "www.googleadservices.com")) { | 245 LowerCaseEqualsASCII(host, "www.googleadservices.com")) { |
| 235 return true; | 246 return true; |
| 236 } | 247 } |
| 237 | 248 |
| 238 // The below mirrors logic in IsGoogleDomainUrl(), but for youtube.<TLD>. | 249 // The below mirrors logic in IsGoogleDomainUrl(), but for youtube.<TLD>. |
| 239 const size_t tld_length = net::registry_controlled_domains::GetRegistryLength( | 250 const size_t tld_length = net::registry_controlled_domains::GetRegistryLength( |
| 240 host, | 251 host, |
| 241 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 252 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
| 242 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 253 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 243 if ((tld_length == 0) || (tld_length == std::string::npos)) | 254 if ((tld_length == 0) || (tld_length == std::string::npos)) |
| 244 return false; | 255 return false; |
| 245 | 256 |
| 246 const std::string host_minus_tld(host, 0, host.length() - tld_length); | 257 const std::string host_minus_tld(host, 0, host.length() - tld_length); |
| 247 return LowerCaseEqualsASCII(host_minus_tld, "youtube.") || | 258 return LowerCaseEqualsASCII(host_minus_tld, "youtube.") || |
| 248 EndsWith(host_minus_tld, ".youtube.", false); | 259 EndsWith(host_minus_tld, ".youtube.", false); |
| 249 } | 260 } |
| 250 | 261 |
| 251 } // namespace chrome_variations | 262 } // namespace chrome_variations |
| OLD | NEW |