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

Side by Side Diff: components/variations/variations_seed_processor.h

Issue 1984003002: Use low entropy for studies that send experiment IDs to Google properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_
6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ 6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 22 matching lines...) Expand all
33 class VariationsSeedProcessor { 33 class VariationsSeedProcessor {
34 public: 34 public:
35 typedef base::Callback<void(uint32_t, const base::string16&)> 35 typedef base::Callback<void(uint32_t, const base::string16&)>
36 UIStringOverrideCallback; 36 UIStringOverrideCallback;
37 37
38 VariationsSeedProcessor(); 38 VariationsSeedProcessor();
39 virtual ~VariationsSeedProcessor(); 39 virtual ~VariationsSeedProcessor();
40 40
41 // Creates field trials from the specified variations |seed|, based on the 41 // Creates field trials from the specified variations |seed|, based on the
42 // specified configuration, as specified in the parameters. 42 // specified configuration, as specified in the parameters.
43 void CreateTrialsFromSeed(const VariationsSeed& seed, 43 void CreateTrialsFromSeed(
44 const std::string& locale, 44 const VariationsSeed& seed,
45 const base::Time& reference_date, 45 const std::string& locale,
46 const base::Version& version, 46 const base::Time& reference_date,
47 Study_Channel channel, 47 const base::Version& version,
48 Study_FormFactor form_factor, 48 Study_Channel channel,
49 const std::string& hardware_class, 49 Study_FormFactor form_factor,
50 const std::string& session_consistency_country, 50 const std::string& hardware_class,
51 const std::string& permanent_consistency_country, 51 const std::string& session_consistency_country,
52 const UIStringOverrideCallback& override_callback, 52 const std::string& permanent_consistency_country,
53 base::FeatureList* feature_list); 53 const UIStringOverrideCallback& override_callback,
54 base::FeatureList* feature_list,
55 const base::FieldTrial::EntropyProvider* low_entropy_provider);
54 56
55 private: 57 private:
56 friend class VariationsSeedProcessorTest; 58 friend class VariationsSeedProcessorTest;
57 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, 59 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
58 AllowForceGroupAndVariationId); 60 AllowForceGroupAndVariationId);
59 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, 61 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
60 AllowVariationIdWithForcingFlag); 62 AllowVariationIdWithForcingFlag);
61 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, 63 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
62 ForbidForceGroupWithVariationId); 64 ForbidForceGroupWithVariationId);
63 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); 65 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1);
64 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); 66 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2);
65 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, 67 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
66 ForceGroup_ChooseFirstGroupWithFlag); 68 ForceGroup_ChooseFirstGroupWithFlag);
67 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, 69 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
68 ForceGroup_DontChooseGroupWithFlag); 70 ForceGroup_DontChooseGroupWithFlag);
69 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); 71 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired);
70 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); 72 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams);
71 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, 73 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
72 VariationParamsWithForcingFlag); 74 VariationParamsWithForcingFlag);
73 75
74 // Check if the |study| is only associated with platform Android/iOS and 76 // Check if the |study| is only associated with platform Android/iOS and
75 // channel dev/canary. If so, forcing flag and variation id can both be set. 77 // channel dev/canary. If so, forcing flag and variation id can both be set.
76 // (Otherwise, forcing_flag and variation_id are mutually exclusive.) 78 // (Otherwise, forcing_flag and variation_id are mutually exclusive.)
77 bool AllowVariationIdWithForcingFlag(const Study& study); 79 bool AllowVariationIdWithForcingFlag(const Study& study);
78 80
79 // Creates and registers a field trial from the |processed_study| data. 81 // Creates and registers a field trial from the |processed_study| data.
80 // Disables the trial if |processed_study.is_expired| is true. 82 // Disables the trial if |processed_study.is_expired| is true.
Alexei Svitkine (slow) 2016/05/17 16:31:35 Nit: Document low_entropy_provider param
jwd 2016/05/18 13:24:18 Done.
81 void CreateTrialFromStudy(const ProcessedStudy& processed_study, 83 void CreateTrialFromStudy(
82 const UIStringOverrideCallback& override_callback, 84 const ProcessedStudy& processed_study,
83 base::FeatureList* feature_list); 85 const UIStringOverrideCallback& override_callback,
86 base::FeatureList* feature_list,
Alexei Svitkine (slow) 2016/05/17 16:31:35 Nit: non-const params should be last.
jwd 2016/05/18 13:24:18 Done.
87 const base::FieldTrial::EntropyProvider* low_entropy_provider);
84 88
85 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); 89 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor);
86 }; 90 };
87 91
88 } // namespace variations 92 } // namespace variations
89 93
90 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ 94 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698