[email protected] | 71011c168 | 2014-07-09 17:19:16 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 5 | #include "components/variations/variations_http_header_provider.h" |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 6 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 7 | #include <stddef.h> |
| 8 | |
horo | e09b6c8 | 2014-11-01 02:08:28 | [diff] [blame] | 9 | #include <set> |
| 10 | #include <string> |
[email protected] | 1bd918d | 2013-10-13 18:23:09 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 13 | #include "base/base64.h" |
| 14 | #include "base/memory/singleton.h" |
asvitkine | 454600f | 2015-06-16 16:34:50 | [diff] [blame] | 15 | #include "base/metrics/histogram_macros.h" |
[email protected] | 1bd918d | 2013-10-13 18:23:09 | [diff] [blame] | 16 | #include "base/strings/string_number_conversions.h" |
| 17 | #include "base/strings/string_split.h" |
[email protected] | 7f8a993 | 2013-07-26 20:43:34 | [diff] [blame] | 18 | #include "base/strings/string_util.h" |
fdoray | cddcf0e | 2016-06-23 21:20:30 | [diff] [blame] | 19 | #include "base/threading/thread_task_runner_handle.h" |
[email protected] | ea15bd5 | 2014-07-14 22:42:50 | [diff] [blame] | 20 | #include "components/variations/proto/client_variations.pb.h" |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 21 | |
[email protected] | 71011c168 | 2014-07-09 17:19:16 | [diff] [blame] | 22 | namespace variations { |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 23 | |
Jun Cai | f3aba7f9 | 2018-07-12 16:52:40 | [diff] [blame] | 24 | // The following documents how adding/removing http headers for web content |
| 25 | // requests are implemented when Network Service is enabled or not enabled. |
| 26 | // |
| 27 | // When Network Service is not enabled, adding headers is implemented in |
| 28 | // ChromeResourceDispatcherHostDelegate::RequestBeginning() by calling |
| 29 | // variations::AppendVariationHeaders(), and removing headers is implemented in |
| 30 | // ChromeNetworkDelegate::OnBeforeRedirect() by calling |
| 31 | // variations::StripVariationHeaderIfNeeded(). |
| 32 | // |
| 33 | // When Network Service is enabled, adding/removing headers is implemented by |
| 34 | // request consumers, and how it is implemented depends on the request type. |
| 35 | // There are three cases: |
| 36 | // 1. Subresources request in renderer, it is implemented |
| 37 | // in URLLoaderThrottleProviderImpl::CreateThrottles() by adding a |
John Abd-El-Malek | 9fb6049 | 2018-08-02 04:28:50 | [diff] [blame] | 38 | // GoogleURLLoaderThrottle to a content::URLLoaderThrottle vector. |
Jun Cai | f3aba7f9 | 2018-07-12 16:52:40 | [diff] [blame] | 39 | // 2. Navigations/Downloads request in browser, it is implemented in |
| 40 | // ChromeContentBrowserClient::CreateURLLoaderThrottles() by also adding a |
John Abd-El-Malek | 9fb6049 | 2018-08-02 04:28:50 | [diff] [blame] | 41 | // GoogleURLLoaderThrottle to a content::URLLoaderThrottle vector. |
Jun Cai | f3aba7f9 | 2018-07-12 16:52:40 | [diff] [blame] | 42 | // 3. SimpleURLLoader in browser, it is implemented in a SimpleURLLoader wrapper |
| 43 | // function variations::CreateSimpleURLLoaderWithVariationsHeaders(). |
| 44 | |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 45 | // static |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 46 | VariationsHttpHeaderProvider* VariationsHttpHeaderProvider::GetInstance() { |
olli.raula | 36aa8be | 2015-09-10 11:14:22 | [diff] [blame] | 47 | return base::Singleton<VariationsHttpHeaderProvider>::get(); |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 48 | } |
| 49 | |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 50 | std::string VariationsHttpHeaderProvider::GetClientDataHeader( |
| 51 | bool is_signed_in) { |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 52 | // Lazily initialize the header, if not already done, before attempting to |
| 53 | // transmit it. |
| 54 | InitVariationIDsCacheIfNeeded(); |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 55 | |
| 56 | std::string variation_ids_header_copy; |
| 57 | { |
| 58 | base::AutoLock scoped_lock(lock_); |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 59 | variation_ids_header_copy = is_signed_in |
| 60 | ? cached_variation_ids_header_signed_in_ |
| 61 | : cached_variation_ids_header_; |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 62 | } |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 63 | return variation_ids_header_copy; |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 64 | } |
| 65 | |
asvitkine | 35ba647 | 2015-12-18 23:52:33 | [diff] [blame] | 66 | std::string VariationsHttpHeaderProvider::GetVariationsString() { |
| 67 | InitVariationIDsCacheIfNeeded(); |
| 68 | |
| 69 | // Construct a space-separated string with leading and trailing spaces from |
| 70 | // the variations set. Note: The ids in it will be in sorted order per the |
| 71 | // std::set contract. |
| 72 | std::string ids_string = " "; |
| 73 | { |
| 74 | base::AutoLock scoped_lock(lock_); |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 75 | for (const VariationIDEntry& entry : GetAllVariationIds()) { |
| 76 | if (entry.second == GOOGLE_WEB_PROPERTIES) { |
| 77 | ids_string.append(base::IntToString(entry.first)); |
| 78 | ids_string.push_back(' '); |
| 79 | } |
asvitkine | 35ba647 | 2015-12-18 23:52:33 | [diff] [blame] | 80 | } |
| 81 | } |
| 82 | return ids_string; |
| 83 | } |
| 84 | |
Alexei Svitkine | 105f942e | 2018-02-17 02:53:48 | [diff] [blame] | 85 | VariationsHttpHeaderProvider::ForceIdsResult |
| 86 | VariationsHttpHeaderProvider::ForceVariationIds( |
| 87 | const std::vector<std::string>& variation_ids, |
| 88 | const std::string& command_line_variation_ids) { |
| 89 | default_variation_ids_set_.clear(); |
| 90 | |
| 91 | if (!AddDefaultVariationIds(variation_ids)) |
| 92 | return ForceIdsResult::INVALID_VECTOR_ENTRY; |
| 93 | |
jkrcal | bf07337 | 2016-07-29 07:21:31 | [diff] [blame] | 94 | if (!command_line_variation_ids.empty()) { |
Alexei Svitkine | 105f942e | 2018-02-17 02:53:48 | [diff] [blame] | 95 | std::vector<std::string> variation_ids_from_command_line = |
jkrcal | bf07337 | 2016-07-29 07:21:31 | [diff] [blame] | 96 | base::SplitString(command_line_variation_ids, ",", |
| 97 | base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
Alexei Svitkine | 105f942e | 2018-02-17 02:53:48 | [diff] [blame] | 98 | if (!AddDefaultVariationIds(variation_ids_from_command_line)) |
| 99 | return ForceIdsResult::INVALID_SWITCH_ENTRY; |
jkrcal | bf07337 | 2016-07-29 07:21:31 | [diff] [blame] | 100 | } |
Alexei Svitkine | 105f942e | 2018-02-17 02:53:48 | [diff] [blame] | 101 | return ForceIdsResult::SUCCESS; |
[email protected] | 1bd918d | 2013-10-13 18:23:09 | [diff] [blame] | 102 | } |
| 103 | |
Jun Cai | 0e56863 | 2018-08-09 02:05:33 | [diff] [blame] | 104 | void VariationsHttpHeaderProvider::AddObserver(Observer* observer) { |
| 105 | observer_list_.AddObserver(observer); |
| 106 | } |
| 107 | |
| 108 | void VariationsHttpHeaderProvider::RemoveObserver(Observer* observer) { |
| 109 | observer_list_.RemoveObserver(observer); |
| 110 | } |
| 111 | |
asvitkine | b4ed7868 | 2015-03-12 18:18:54 | [diff] [blame] | 112 | void VariationsHttpHeaderProvider::ResetForTesting() { |
| 113 | base::AutoLock scoped_lock(lock_); |
| 114 | |
| 115 | // Stop observing field trials so that it can be restarted when this is |
| 116 | // re-inited. Note: This is a no-op if this is not currently observing. |
| 117 | base::FieldTrialList::RemoveObserver(this); |
| 118 | variation_ids_cache_initialized_ = false; |
Olivier Robin | 9edc20f | 2018-10-03 09:51:42 | [diff] [blame^] | 119 | variation_ids_set_.clear(); |
| 120 | default_variation_ids_set_.clear(); |
| 121 | synthetic_variation_ids_set_.clear(); |
| 122 | cached_variation_ids_header_.clear(); |
| 123 | cached_variation_ids_header_signed_in_.clear(); |
asvitkine | b4ed7868 | 2015-03-12 18:18:54 | [diff] [blame] | 124 | } |
| 125 | |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 126 | VariationsHttpHeaderProvider::VariationsHttpHeaderProvider() |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 127 | : variation_ids_cache_initialized_(false) {} |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 128 | |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 129 | VariationsHttpHeaderProvider::~VariationsHttpHeaderProvider() {} |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 130 | |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 131 | void VariationsHttpHeaderProvider::OnFieldTrialGroupFinalized( |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 132 | const std::string& trial_name, |
| 133 | const std::string& group_name) { |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 134 | base::AutoLock scoped_lock(lock_); |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 135 | const size_t old_size = variation_ids_set_.size(); |
| 136 | CacheVariationsId(trial_name, group_name, GOOGLE_WEB_PROPERTIES); |
| 137 | CacheVariationsId(trial_name, group_name, GOOGLE_WEB_PROPERTIES_SIGNED_IN); |
| 138 | CacheVariationsId(trial_name, group_name, GOOGLE_WEB_PROPERTIES_TRIGGER); |
| 139 | if (variation_ids_set_.size() != old_size) |
| 140 | UpdateVariationIDsHeaderValue(); |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 141 | } |
| 142 | |
asvitkine | e0dbdbe | 2014-10-31 21:59:57 | [diff] [blame] | 143 | void VariationsHttpHeaderProvider::OnSyntheticTrialsChanged( |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 144 | const std::vector<SyntheticTrialGroup>& groups) { |
asvitkine | e0dbdbe | 2014-10-31 21:59:57 | [diff] [blame] | 145 | base::AutoLock scoped_lock(lock_); |
| 146 | |
| 147 | synthetic_variation_ids_set_.clear(); |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 148 | for (const SyntheticTrialGroup& group : groups) { |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 149 | VariationID id = |
asvitkine | e0dbdbe | 2014-10-31 21:59:57 | [diff] [blame] | 150 | GetGoogleVariationIDFromHashes(GOOGLE_WEB_PROPERTIES, group.id); |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 151 | if (id != EMPTY_ID) { |
| 152 | synthetic_variation_ids_set_.insert( |
| 153 | VariationIDEntry(id, GOOGLE_WEB_PROPERTIES)); |
| 154 | } |
| 155 | id = GetGoogleVariationIDFromHashes(GOOGLE_WEB_PROPERTIES_SIGNED_IN, |
| 156 | group.id); |
| 157 | if (id != EMPTY_ID) { |
| 158 | synthetic_variation_ids_set_.insert( |
| 159 | VariationIDEntry(id, GOOGLE_WEB_PROPERTIES_SIGNED_IN)); |
| 160 | } |
asvitkine | e0dbdbe | 2014-10-31 21:59:57 | [diff] [blame] | 161 | } |
| 162 | UpdateVariationIDsHeaderValue(); |
| 163 | } |
| 164 | |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 165 | void VariationsHttpHeaderProvider::InitVariationIDsCacheIfNeeded() { |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 166 | base::AutoLock scoped_lock(lock_); |
| 167 | if (variation_ids_cache_initialized_) |
| 168 | return; |
| 169 | |
| 170 | // Register for additional cache updates. This is done first to avoid a race |
| 171 | // that could cause registered FieldTrials to be missed. |
fdoray | cddcf0e | 2016-06-23 21:20:30 | [diff] [blame] | 172 | DCHECK(base::ThreadTaskRunnerHandle::IsSet()); |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 173 | base::FieldTrialList::AddObserver(this); |
| 174 | |
[email protected] | 999f7b4 | 2013-02-04 16:14:25 | [diff] [blame] | 175 | base::TimeTicks before_time = base::TimeTicks::Now(); |
| 176 | |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 177 | base::FieldTrial::ActiveGroups initial_groups; |
| 178 | base::FieldTrialList::GetActiveFieldTrialGroups(&initial_groups); |
asvitkine | 35ba647 | 2015-12-18 23:52:33 | [diff] [blame] | 179 | |
| 180 | for (const auto& entry : initial_groups) { |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 181 | CacheVariationsId(entry.trial_name, entry.group_name, |
| 182 | GOOGLE_WEB_PROPERTIES); |
| 183 | CacheVariationsId(entry.trial_name, entry.group_name, |
| 184 | GOOGLE_WEB_PROPERTIES_SIGNED_IN); |
| 185 | CacheVariationsId(entry.trial_name, entry.group_name, |
| 186 | GOOGLE_WEB_PROPERTIES_TRIGGER); |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 187 | } |
| 188 | UpdateVariationIDsHeaderValue(); |
| 189 | |
[email protected] | 999f7b4 | 2013-02-04 16:14:25 | [diff] [blame] | 190 | UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 191 | "Variations.HeaderConstructionTime", |
drbasic | f0d1b26 | 2016-08-23 06:10:42 | [diff] [blame] | 192 | (base::TimeTicks::Now() - before_time).InMicroseconds(), 1, |
asvitkine | 9a27983 | 2015-12-18 02:35:50 | [diff] [blame] | 193 | base::TimeDelta::FromSeconds(1).InMicroseconds(), 50); |
[email protected] | 999f7b4 | 2013-02-04 16:14:25 | [diff] [blame] | 194 | |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 195 | variation_ids_cache_initialized_ = true; |
| 196 | } |
| 197 | |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 198 | void VariationsHttpHeaderProvider::CacheVariationsId( |
| 199 | const std::string& trial_name, |
| 200 | const std::string& group_name, |
| 201 | IDCollectionKey key) { |
| 202 | const VariationID id = GetGoogleVariationID(key, trial_name, group_name); |
| 203 | if (id != EMPTY_ID) |
| 204 | variation_ids_set_.insert(VariationIDEntry(id, key)); |
| 205 | } |
| 206 | |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 207 | void VariationsHttpHeaderProvider::UpdateVariationIDsHeaderValue() { |
| 208 | lock_.AssertAcquired(); |
| 209 | |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 210 | // The header value is a serialized protobuffer of Variation IDs which is |
| 211 | // base64 encoded before transmitting as a string. |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 212 | cached_variation_ids_header_.clear(); |
| 213 | cached_variation_ids_header_signed_in_.clear(); |
[email protected] | 1bd918d | 2013-10-13 18:23:09 | [diff] [blame] | 214 | |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 215 | // If successful, swap the header value with the new one. |
| 216 | // Note that the list of IDs and the header could be temporarily out of sync |
| 217 | // if IDs are added as the header is recreated. The receiving servers are OK |
| 218 | // with such discrepancies. |
| 219 | cached_variation_ids_header_ = GenerateBase64EncodedProto(false); |
| 220 | cached_variation_ids_header_signed_in_ = GenerateBase64EncodedProto(true); |
Jun Cai | 0e56863 | 2018-08-09 02:05:33 | [diff] [blame] | 221 | |
| 222 | for (auto& observer : observer_list_) { |
| 223 | observer.VariationIdsHeaderUpdated(cached_variation_ids_header_, |
| 224 | cached_variation_ids_header_signed_in_); |
| 225 | } |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | std::string VariationsHttpHeaderProvider::GenerateBase64EncodedProto( |
| 229 | bool is_signed_in) { |
| 230 | std::set<VariationIDEntry> all_variation_ids_set = GetAllVariationIds(); |
| 231 | |
| 232 | ClientVariations proto; |
| 233 | for (const VariationIDEntry& entry : all_variation_ids_set) { |
| 234 | switch (entry.second) { |
| 235 | case GOOGLE_WEB_PROPERTIES_SIGNED_IN: |
| 236 | if (is_signed_in) |
| 237 | proto.add_variation_id(entry.first); |
| 238 | break; |
| 239 | case GOOGLE_WEB_PROPERTIES: |
| 240 | proto.add_variation_id(entry.first); |
| 241 | break; |
| 242 | case GOOGLE_WEB_PROPERTIES_TRIGGER: |
| 243 | proto.add_trigger_variation_id(entry.first); |
| 244 | break; |
Sky Malice | a846ad7d | 2017-12-05 00:44:42 | [diff] [blame] | 245 | case CHROME_SYNC_EVENT_LOGGER: |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 246 | case ID_COLLECTION_COUNT: |
| 247 | // These cases included to get full enum coverage for switch, so that |
| 248 | // new enums introduce compiler warnings. Nothing to do for these. |
| 249 | break; |
| 250 | } |
[email protected] | 8c2c544 | 2014-04-04 18:55:29 | [diff] [blame] | 251 | } |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 252 | |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 253 | const size_t total_id_count = |
| 254 | proto.variation_id_size() + proto.trigger_variation_id_size(); |
| 255 | |
| 256 | if (total_id_count == 0) |
| 257 | return std::string(); |
| 258 | |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 259 | // This is the bottleneck for the creation of the header, so validate the size |
| 260 | // here. Force a hard maximum on the ID count in case the Variations server |
| 261 | // returns too many IDs and DOSs receiving servers with large requests. |
Alexei Svitkine | 93c85fc | 2018-07-20 20:21:05 | [diff] [blame] | 262 | DCHECK_LE(total_id_count, 20U); |
[email protected] | a27ae2a | 2014-08-01 16:17:52 | [diff] [blame] | 263 | UMA_HISTOGRAM_COUNTS_100("Variations.Headers.ExperimentCount", |
| 264 | total_id_count); |
Alexei Svitkine | 93c85fc | 2018-07-20 20:21:05 | [diff] [blame] | 265 | if (total_id_count > 30) |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 266 | return std::string(); |
[email protected] | 8c2c544 | 2014-04-04 18:55:29 | [diff] [blame] | 267 | |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 268 | std::string serialized; |
| 269 | proto.SerializeToString(&serialized); |
| 270 | |
| 271 | std::string hashed; |
[email protected] | 33fca12 | 2013-12-11 01:48:50 | [diff] [blame] | 272 | base::Base64Encode(serialized, &hashed); |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 273 | return hashed; |
[email protected] | bd3b471 | 2012-12-18 17:01:30 | [diff] [blame] | 274 | } |
[email protected] | ab778079 | 2013-01-10 01:26:09 | [diff] [blame] | 275 | |
Alexei Svitkine | 105f942e | 2018-02-17 02:53:48 | [diff] [blame] | 276 | bool VariationsHttpHeaderProvider::AddDefaultVariationIds( |
| 277 | const std::vector<std::string>& variation_ids) { |
| 278 | for (const std::string& entry : variation_ids) { |
| 279 | if (entry.empty()) { |
| 280 | default_variation_ids_set_.clear(); |
| 281 | return false; |
| 282 | } |
| 283 | bool trigger_id = |
| 284 | base::StartsWith(entry, "t", base::CompareCase::SENSITIVE); |
| 285 | // Remove the "t" prefix if it's there. |
| 286 | std::string trimmed_entry = trigger_id ? entry.substr(1) : entry; |
| 287 | |
| 288 | int variation_id = 0; |
| 289 | if (!base::StringToInt(trimmed_entry, &variation_id)) { |
| 290 | default_variation_ids_set_.clear(); |
| 291 | return false; |
| 292 | } |
| 293 | default_variation_ids_set_.insert(VariationIDEntry( |
| 294 | variation_id, |
| 295 | trigger_id ? GOOGLE_WEB_PROPERTIES_TRIGGER : GOOGLE_WEB_PROPERTIES)); |
| 296 | } |
| 297 | return true; |
| 298 | } |
| 299 | |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 300 | std::set<VariationsHttpHeaderProvider::VariationIDEntry> |
| 301 | VariationsHttpHeaderProvider::GetAllVariationIds() { |
asvitkine | 35ba647 | 2015-12-18 23:52:33 | [diff] [blame] | 302 | lock_.AssertAcquired(); |
| 303 | |
yutak | 3305f49d | 2016-12-13 10:32:31 | [diff] [blame] | 304 | std::set<VariationIDEntry> all_variation_ids_set = default_variation_ids_set_; |
| 305 | for (const VariationIDEntry& entry : variation_ids_set_) { |
| 306 | all_variation_ids_set.insert(entry); |
| 307 | } |
| 308 | for (const VariationIDEntry& entry : synthetic_variation_ids_set_) { |
| 309 | all_variation_ids_set.insert(entry); |
| 310 | } |
asvitkine | 35ba647 | 2015-12-18 23:52:33 | [diff] [blame] | 311 | return all_variation_ids_set; |
| 312 | } |
| 313 | |
[email protected] | 71011c168 | 2014-07-09 17:19:16 | [diff] [blame] | 314 | } // namespace variations |