| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_ | 5 #ifndef COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_ |
| 6 #define COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_ | 6 #define COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace rappor { | 10 namespace rappor { |
| 11 | 11 |
| 12 // Levels of noise added to a sample. | 12 // Levels of noise added to a sample. |
| 13 enum NoiseLevel { | 13 enum NoiseLevel { |
| 14 NO_NOISE = 0, | 14 NO_NOISE = 0, |
| 15 NORMAL_NOISE, | 15 NORMAL_NOISE, |
| 16 SPARSE_NOISE, | 16 SPARSE_NOISE, |
| 17 NUM_NOISE_LEVELS, | 17 NUM_NOISE_LEVELS, |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 // The type of data stored in a metric. | 20 // The type of data stored in a metric. |
| 21 // Any use of the LOW_FREQUENCY types must be approved by Chrome Privacy and | 21 // Any use of the LOW_FREQUENCY types must be approved by Chrome Privacy and |
| 22 // the rappor-dev team. | 22 // the rappor-dev team. |
| 23 enum RapporType { | 23 enum RapporType { |
| 24 // Generic metrics from UMA opt-in users. | 24 // Generic metrics from UMA opt-in users. |
| 25 UMA_RAPPOR_TYPE = 0, | 25 UMA_RAPPOR_TYPE = 0, |
| 26 // Generic metrics for SafeBrowsing users. Deprecated, replaced by | |
| 27 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE. | |
| 28 SAFEBROWSING_RAPPOR_TYPE, | |
| 29 // Deprecated: Use UMA_RAPPOR_TYPE for new metrics | 26 // Deprecated: Use UMA_RAPPOR_TYPE for new metrics |
| 30 ETLD_PLUS_ONE_RAPPOR_TYPE, | 27 ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 31 // Type for low-frequency metrics from UMA opt-in users. | 28 // Type for low-frequency metrics from UMA opt-in users. |
| 32 LOW_FREQUENCY_UMA_RAPPOR_TYPE, | 29 LOW_FREQUENCY_UMA_RAPPOR_TYPE, |
| 33 // Type for low-frequency metrics from SafeBrowsing users. | |
| 34 LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE, | |
| 35 // Type for low-frequency metrics from UMA opt-in users. Do not use for new | 30 // Type for low-frequency metrics from UMA opt-in users. Do not use for new |
| 36 // metrics. | 31 // metrics. |
| 37 LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 32 LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 38 NUM_RAPPOR_TYPES, | 33 NUM_RAPPOR_TYPES, |
| 39 COARSE_RAPPOR_TYPE = SAFEBROWSING_RAPPOR_TYPE, | |
| 40 }; | 34 }; |
| 41 | 35 |
| 42 enum Probability { | 36 enum Probability { |
| 43 PROBABILITY_100, // 100% | 37 PROBABILITY_100, // 100% |
| 44 PROBABILITY_75, // 75% | 38 PROBABILITY_75, // 75% |
| 45 PROBABILITY_50, // 50% | 39 PROBABILITY_50, // 50% |
| 46 PROBABILITY_25, // 25% | 40 PROBABILITY_25, // 25% |
| 47 PROBABILITY_0, // 0% | 41 PROBABILITY_0, // 0% |
| 48 }; | 42 }; |
| 49 | 43 |
| 50 // A metric is reported when its reporting group is in the set of groups | 44 // A metric is reported when its reporting group is in the set of groups |
| 51 // passed in to RapporServiceImpl::Start() | 45 // passed in to RapporServiceImpl::Start() |
| 52 enum RecordingGroup { | 46 enum RecordingGroup { |
| 53 // Metrics for UMA users. | 47 // Metrics for UMA users. |
| 54 UMA_RAPPOR_GROUP = 1 << 0, | 48 UMA_RAPPOR_GROUP = 1 << 0, |
| 55 // Metrics related to SafeBrowsing, for SafeBrowsing users. | |
| 56 SAFEBROWSING_RAPPOR_GROUP = 1 << 1, | |
| 57 }; | 49 }; |
| 58 | 50 |
| 59 // An object describing noise probabilities for a noise level | 51 // An object describing noise probabilities for a noise level |
| 60 struct NoiseParameters { | 52 struct NoiseParameters { |
| 61 // The probability that a bit will be redacted with fake data. This | 53 // The probability that a bit will be redacted with fake data. This |
| 62 // corresponds to the F privacy parameter. | 54 // corresponds to the F privacy parameter. |
| 63 Probability fake_prob; | 55 Probability fake_prob; |
| 64 // The probability that a fake bit will be a one. | 56 // The probability that a fake bit will be a one. |
| 65 Probability fake_one_prob; | 57 Probability fake_one_prob; |
| 66 // The probability that a one bit in the redacted data reports as one. This | 58 // The probability that a one bit in the redacted data reports as one. This |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 119 |
| 128 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { | 120 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { |
| 129 // UMA_RAPPOR_TYPE | 121 // UMA_RAPPOR_TYPE |
| 130 { | 122 { |
| 131 128 /* Num cohorts */, | 123 128 /* Num cohorts */, |
| 132 4 /* Bloom filter size bytes */, | 124 4 /* Bloom filter size bytes */, |
| 133 2 /* Bloom filter hash count */, | 125 2 /* Bloom filter hash count */, |
| 134 rappor::NORMAL_NOISE /* Noise level */, | 126 rappor::NORMAL_NOISE /* Noise level */, |
| 135 UMA_RAPPOR_GROUP /* Recording group */ | 127 UMA_RAPPOR_GROUP /* Recording group */ |
| 136 }, | 128 }, |
| 137 // SAFEBROWSING_RAPPOR_TYPE | |
| 138 { | |
| 139 128 /* Num cohorts */, | |
| 140 1 /* Bloom filter size bytes */, | |
| 141 2 /* Bloom filter hash count */, | |
| 142 rappor::NORMAL_NOISE /* Noise level */, | |
| 143 SAFEBROWSING_RAPPOR_GROUP /* Recording group */ | |
| 144 }, | |
| 145 // ETLD_PLUS_ONE_RAPPOR_TYPE | 129 // ETLD_PLUS_ONE_RAPPOR_TYPE |
| 146 { | 130 { |
| 147 128 /* Num cohorts */, | 131 128 /* Num cohorts */, |
| 148 16 /* Bloom filter size bytes */, | 132 16 /* Bloom filter size bytes */, |
| 149 2 /* Bloom filter hash count */, | 133 2 /* Bloom filter hash count */, |
| 150 rappor::NORMAL_NOISE /* Noise level */, | 134 rappor::NORMAL_NOISE /* Noise level */, |
| 151 UMA_RAPPOR_GROUP /* Recording group */ | 135 UMA_RAPPOR_GROUP /* Recording group */ |
| 152 }, | 136 }, |
| 153 // LOW_FREQUENCY_UMA_RAPPOR_TYPE | 137 // LOW_FREQUENCY_UMA_RAPPOR_TYPE |
| 154 { | 138 { |
| 155 128 /* Num cohorts */, | 139 128 /* Num cohorts */, |
| 156 4 /* Bloom filter size bytes */, | 140 4 /* Bloom filter size bytes */, |
| 157 2 /* Bloom filter hash count */, | 141 2 /* Bloom filter hash count */, |
| 158 rappor::SPARSE_NOISE /* Noise level */, | 142 rappor::SPARSE_NOISE /* Noise level */, |
| 159 UMA_RAPPOR_GROUP /* Recording group */ | 143 UMA_RAPPOR_GROUP /* Recording group */ |
| 160 }, | 144 }, |
| 161 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE | |
| 162 { | |
| 163 128 /* Num cohorts */, | |
| 164 1 /* Bloom filter size bytes */, | |
| 165 2 /* Bloom filter hash count */, | |
| 166 rappor::SPARSE_NOISE /* Noise level */, | |
| 167 SAFEBROWSING_RAPPOR_GROUP /* Recording group */ | |
| 168 }, | |
| 169 // LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE | 145 // LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE |
| 170 { | 146 { |
| 171 128 /* Num cohorts */, | 147 128 /* Num cohorts */, |
| 172 16 /* Bloom filter size bytes */, | 148 16 /* Bloom filter size bytes */, |
| 173 2 /* Bloom filter hash count */, | 149 2 /* Bloom filter hash count */, |
| 174 rappor::SPARSE_NOISE /* Noise level */, | 150 rappor::SPARSE_NOISE /* Noise level */, |
| 175 UMA_RAPPOR_GROUP /* Recording group */ | 151 UMA_RAPPOR_GROUP /* Recording group */ |
| 176 }, | 152 }, |
| 177 }; | 153 }; |
| 178 | 154 |
| 179 } // namespace internal | 155 } // namespace internal |
| 180 | 156 |
| 181 } // namespace rappor | 157 } // namespace rappor |
| 182 | 158 |
| 183 #endif // COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_ | 159 #endif // COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_ |
| OLD | NEW |