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/net/variations_http_header_provider.h" | 5 #include "components/variations/net/variations_http_header_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 default_trigger_id_set_.clear(); | 90 default_trigger_id_set_.clear(); |
91 std::vector<std::string> entries; | 91 std::vector<std::string> entries; |
92 base::SplitString(variation_ids, ',', &entries); | 92 base::SplitString(variation_ids, ',', &entries); |
93 for (std::vector<std::string>::const_iterator it = entries.begin(); | 93 for (std::vector<std::string>::const_iterator it = entries.begin(); |
94 it != entries.end(); ++it) { | 94 it != entries.end(); ++it) { |
95 if (it->empty()) { | 95 if (it->empty()) { |
96 default_variation_ids_set_.clear(); | 96 default_variation_ids_set_.clear(); |
97 default_trigger_id_set_.clear(); | 97 default_trigger_id_set_.clear(); |
98 return false; | 98 return false; |
99 } | 99 } |
100 bool trigger_id = StartsWithASCII(*it, "t", true); | 100 bool trigger_id = base::StartsWithASCII(*it, "t", true); |
101 // Remove the "t" prefix if it's there. | 101 // Remove the "t" prefix if it's there. |
102 std::string entry = trigger_id ? it->substr(1) : *it; | 102 std::string entry = trigger_id ? it->substr(1) : *it; |
103 | 103 |
104 int variation_id = 0; | 104 int variation_id = 0; |
105 if (!base::StringToInt(entry, &variation_id)) { | 105 if (!base::StringToInt(entry, &variation_id)) { |
106 default_variation_ids_set_.clear(); | 106 default_variation_ids_set_.clear(); |
107 default_trigger_id_set_.clear(); | 107 default_trigger_id_set_.clear(); |
108 return false; | 108 return false; |
109 } | 109 } |
110 if (trigger_id) | 110 if (trigger_id) |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 for (size_t i = 0; i < arraysize(kSuffixesToSetHeadersFor); ++i) { | 282 for (size_t i = 0; i < arraysize(kSuffixesToSetHeadersFor); ++i) { |
283 if (EndsWith(host, kSuffixesToSetHeadersFor[i], false)) | 283 if (EndsWith(host, kSuffixesToSetHeadersFor[i], false)) |
284 return true; | 284 return true; |
285 } | 285 } |
286 | 286 |
287 return google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN, | 287 return google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN, |
288 google_util::ALLOW_NON_STANDARD_PORTS); | 288 google_util::ALLOW_NON_STANDARD_PORTS); |
289 } | 289 } |
290 | 290 |
291 } // namespace variations | 291 } // namespace variations |
OLD | NEW |