Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: components/variations/variations_associated_data.cc

Issue 2569973002: Revert of Restrict transmission of external exp ids to signed in users. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
31 return base::Singleton<GroupMapAccessor>::get(); 31 return base::Singleton<GroupMapAccessor>::get();
32 } 32 }
33 33
34 // Note that this normally only sets the ID for a group the first time, unless 34 // Note that this normally only sets the ID for a group the first time, unless
35 // |force| is set to true, in which case it will always override it. 35 // |force| is set to true, in which case it will always override it.
36 void AssociateID(IDCollectionKey key, 36 void AssociateID(IDCollectionKey key,
37 const ActiveGroupId& group_identifier, 37 const ActiveGroupId& group_identifier,
38 const VariationID id, 38 const VariationID id,
39 const bool force) { 39 const bool force) {
40 #if !defined(NDEBUG) 40 #if !defined(NDEBUG)
41 DCHECK_EQ(4, ID_COLLECTION_COUNT); 41 DCHECK_EQ(3, ID_COLLECTION_COUNT);
42 // Ensure that at most one of the trigger/non-trigger/signed-in web property 42 // Ensure that at most one of the trigger/non-trigger web property IDs are
43 // IDs are set. 43 // set.
44 if (key == GOOGLE_WEB_PROPERTIES || key == GOOGLE_WEB_PROPERTIES_TRIGGER || 44 if (key == GOOGLE_WEB_PROPERTIES || key == GOOGLE_WEB_PROPERTIES_TRIGGER) {
45 key == GOOGLE_WEB_PROPERTIES_SIGNED_IN) { 45 IDCollectionKey other_key = key == GOOGLE_WEB_PROPERTIES ?
46 if (key != GOOGLE_WEB_PROPERTIES) 46 GOOGLE_WEB_PROPERTIES_TRIGGER : GOOGLE_WEB_PROPERTIES;
47 DCHECK_EQ(EMPTY_ID, GetID(GOOGLE_WEB_PROPERTIES, group_identifier)); 47 DCHECK_EQ(EMPTY_ID, GetID(other_key, group_identifier));
48 if (key != GOOGLE_WEB_PROPERTIES_TRIGGER) {
49 DCHECK_EQ(EMPTY_ID,
50 GetID(GOOGLE_WEB_PROPERTIES_TRIGGER, group_identifier));
51 }
52 if (key != GOOGLE_WEB_PROPERTIES_SIGNED_IN) {
53 DCHECK_EQ(EMPTY_ID,
54 GetID(GOOGLE_WEB_PROPERTIES_SIGNED_IN, group_identifier));
55 }
56 } 48 }
57 49
58 // Validate that all collections with this |group_identifier| have the same 50 // Validate that all collections with this |group_identifier| have the same
59 // associated ID. 51 // associated ID.
60 for (int i = 0; i < ID_COLLECTION_COUNT; ++i) { 52 for (int i = 0; i < ID_COLLECTION_COUNT; ++i) {
61 IDCollectionKey other_key = static_cast<IDCollectionKey>(i); 53 IDCollectionKey other_key = static_cast<IDCollectionKey>(i);
62 if (other_key == key) 54 if (other_key == key)
63 continue; 55 continue;
64 VariationID other_id = GetID(other_key, group_identifier); 56 VariationID other_id = GetID(other_key, group_identifier);
65 DCHECK(other_id == EMPTY_ID || other_id == id); 57 DCHECK(other_id == EMPTY_ID || other_id == id);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting(); 198 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting();
207 } 199 }
208 200
209 void ClearAllVariationParams() { 201 void ClearAllVariationParams() {
210 base::FieldTrialParamAssociator::GetInstance()->ClearAllParamsForTesting(); 202 base::FieldTrialParamAssociator::GetInstance()->ClearAllParamsForTesting();
211 } 203 }
212 204
213 } // namespace testing 205 } // namespace testing
214 206
215 } // namespace variations 207 } // namespace variations
OLDNEW
« no previous file with comments | « components/variations/variations_associated_data.h ('k') | components/variations/variations_http_header_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698