| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_associated_data.h" | 5 #include "components/variations/variations_associated_data.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 const std::string& group_name, | 177 const std::string& group_name, |
| 178 VariationID id) { | 178 VariationID id) { |
| 179 GroupMapAccessor::GetInstance()->AssociateID( | 179 GroupMapAccessor::GetInstance()->AssociateID( |
| 180 key, MakeActiveGroupId(trial_name, group_name), id, false); | 180 key, MakeActiveGroupId(trial_name, group_name), id, false); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void AssociateGoogleVariationIDForce(IDCollectionKey key, | 183 void AssociateGoogleVariationIDForce(IDCollectionKey key, |
| 184 const std::string& trial_name, | 184 const std::string& trial_name, |
| 185 const std::string& group_name, | 185 const std::string& group_name, |
| 186 VariationID id) { | 186 VariationID id) { |
| 187 GroupMapAccessor::GetInstance()->AssociateID( | 187 AssociateGoogleVariationIDForceHashes( |
| 188 key, MakeActiveGroupId(trial_name, group_name), id, true); | 188 key, MakeActiveGroupId(trial_name, group_name), id); |
| 189 } |
| 190 |
| 191 void AssociateGoogleVariationIDForceHashes(IDCollectionKey key, |
| 192 const ActiveGroupId& active_group, |
| 193 VariationID id) { |
| 194 GroupMapAccessor::GetInstance()->AssociateID(key, active_group, id, true); |
| 189 } | 195 } |
| 190 | 196 |
| 191 VariationID GetGoogleVariationID(IDCollectionKey key, | 197 VariationID GetGoogleVariationID(IDCollectionKey key, |
| 192 const std::string& trial_name, | 198 const std::string& trial_name, |
| 193 const std::string& group_name) { | 199 const std::string& group_name) { |
| 194 return GroupMapAccessor::GetInstance()->GetID( | 200 return GetGoogleVariationIDFromHashes( |
| 195 key, MakeActiveGroupId(trial_name, group_name)); | 201 key, MakeActiveGroupId(trial_name, group_name)); |
| 196 } | 202 } |
| 197 | 203 |
| 204 VariationID GetGoogleVariationIDFromHashes( |
| 205 IDCollectionKey key, |
| 206 const ActiveGroupId& active_group) { |
| 207 return GroupMapAccessor::GetInstance()->GetID(key, active_group); |
| 208 } |
| 209 |
| 198 bool AssociateVariationParams( | 210 bool AssociateVariationParams( |
| 199 const std::string& trial_name, | 211 const std::string& trial_name, |
| 200 const std::string& group_name, | 212 const std::string& group_name, |
| 201 const std::map<std::string, std::string>& params) { | 213 const std::map<std::string, std::string>& params) { |
| 202 return VariationsParamAssociator::GetInstance()->AssociateVariationParams( | 214 return VariationsParamAssociator::GetInstance()->AssociateVariationParams( |
| 203 trial_name, group_name, params); | 215 trial_name, group_name, params); |
| 204 } | 216 } |
| 205 | 217 |
| 206 bool GetVariationParams(const std::string& trial_name, | 218 bool GetVariationParams(const std::string& trial_name, |
| 207 std::map<std::string, std::string>* params) { | 219 std::map<std::string, std::string>* params) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 228 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting(); | 240 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting(); |
| 229 } | 241 } |
| 230 | 242 |
| 231 void ClearAllVariationParams() { | 243 void ClearAllVariationParams() { |
| 232 VariationsParamAssociator::GetInstance()->ClearAllParamsForTesting(); | 244 VariationsParamAssociator::GetInstance()->ClearAllParamsForTesting(); |
| 233 } | 245 } |
| 234 | 246 |
| 235 } // namespace testing | 247 } // namespace testing |
| 236 | 248 |
| 237 } // namespace variations | 249 } // namespace variations |
| OLD | NEW |