| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/variations/variations_http_header_provider.h" | 5 #include "components/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" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "components/google/core/browser/google_util.h" | 15 #include "components/google/core/browser/google_util.h" |
| 16 #include "components/variations/proto/client_variations.pb.h" | 16 #include "components/variations/proto/client_variations.pb.h" |
| 17 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 17 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 18 #include "net/http/http_request_headers.h" | 18 #include "net/http/http_request_headers.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 // TODO(mathp): Once the move to variations namespace is complete, remove these. |
| 22 using chrome_variations::EMPTY_ID; |
| 23 using chrome_variations::GOOGLE_WEB_PROPERTIES; |
| 24 using chrome_variations::GOOGLE_WEB_PROPERTIES_TRIGGER; |
| 25 using chrome_variations::VariationID; |
| 26 |
| 21 namespace variations { | 27 namespace variations { |
| 22 | 28 |
| 23 namespace { | 29 namespace { |
| 24 | 30 |
| 25 const char* kSuffixesToSetHeadersFor[] = { | 31 const char* kSuffixesToSetHeadersFor[] = { |
| 26 ".android.com", | 32 ".android.com", |
| 27 ".doubleclick.com", | 33 ".doubleclick.com", |
| 28 ".doubleclick.net", | 34 ".doubleclick.net", |
| 29 ".ggpht.com", | 35 ".ggpht.com", |
| 30 ".googleadservices.com", | 36 ".googleadservices.com", |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 for (size_t i = 0; i < arraysize(kSuffixesToSetHeadersFor); ++i) { | 256 for (size_t i = 0; i < arraysize(kSuffixesToSetHeadersFor); ++i) { |
| 251 if (EndsWith(host, kSuffixesToSetHeadersFor[i], false)) | 257 if (EndsWith(host, kSuffixesToSetHeadersFor[i], false)) |
| 252 return true; | 258 return true; |
| 253 } | 259 } |
| 254 | 260 |
| 255 return google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN, | 261 return google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN, |
| 256 google_util::ALLOW_NON_STANDARD_PORTS); | 262 google_util::ALLOW_NON_STANDARD_PORTS); |
| 257 } | 263 } |
| 258 | 264 |
| 259 } // namespace variations | 265 } // namespace variations |
| OLD | NEW |