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

Side by Side Diff: components/rappor/public/rappor_parameters.h

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix more compile errors in JNI files 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 2014 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_RAPPOR_PARAMETERS_H_ 5 #ifndef COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_
6 #define COMPONENTS_RAPPOR_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,
(...skipping 16 matching lines...) Expand all
33 // Type for low-frequency metrics from SafeBrowsing users. 33 // Type for low-frequency metrics from SafeBrowsing users.
34 LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE, 34 LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE,
35 // Type for low-frequency metrics from UMA opt-in users. Do not use for new 35 // Type for low-frequency metrics from UMA opt-in users. Do not use for new
36 // metrics. 36 // metrics.
37 LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 37 LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
38 NUM_RAPPOR_TYPES, 38 NUM_RAPPOR_TYPES,
39 COARSE_RAPPOR_TYPE = SAFEBROWSING_RAPPOR_TYPE, 39 COARSE_RAPPOR_TYPE = SAFEBROWSING_RAPPOR_TYPE,
40 }; 40 };
41 41
42 enum Probability { 42 enum Probability {
43 PROBABILITY_100, // 100% 43 PROBABILITY_100, // 100%
44 PROBABILITY_75, // 75% 44 PROBABILITY_75, // 75%
45 PROBABILITY_50, // 50% 45 PROBABILITY_50, // 50%
46 PROBABILITY_25, // 25% 46 PROBABILITY_25, // 25%
47 PROBABILITY_0, // 0% 47 PROBABILITY_0, // 0%
48 }; 48 };
49 49
50
51 // A metric is reported when its reporting group is in the set of groups 50 // A metric is reported when its reporting group is in the set of groups
52 // passed in to RapporService::Start() 51 // passed in to RapporServiceImpl::Start()
53 enum RecordingGroup { 52 enum RecordingGroup {
54 // Metrics for UMA users. 53 // Metrics for UMA users.
55 UMA_RAPPOR_GROUP = 1 << 0, 54 UMA_RAPPOR_GROUP = 1 << 0,
56 // Metrics related to SafeBrowsing, for SafeBrowsing users. 55 // Metrics related to SafeBrowsing, for SafeBrowsing users.
57 SAFEBROWSING_RAPPOR_GROUP = 1 << 1, 56 SAFEBROWSING_RAPPOR_GROUP = 1 << 1,
58 }; 57 };
59 58
60
61 // An object describing noise probabilities for a noise level 59 // An object describing noise probabilities for a noise level
62 struct NoiseParameters { 60 struct NoiseParameters {
63 // The probability that a bit will be redacted with fake data. This 61 // The probability that a bit will be redacted with fake data. This
64 // corresponds to the F privacy parameter. 62 // corresponds to the F privacy parameter.
65 Probability fake_prob; 63 Probability fake_prob;
66 // The probability that a fake bit will be a one. 64 // The probability that a fake bit will be a one.
67 Probability fake_one_prob; 65 Probability fake_one_prob;
68 // The probability that a one bit in the redacted data reports as one. This 66 // The probability that a one bit in the redacted data reports as one. This
69 // corresponds to the Q privacy parameter 67 // corresponds to the Q privacy parameter
70 Probability one_coin_prob; 68 Probability one_coin_prob;
(...skipping 28 matching lines...) Expand all
99 97
100 // The reporting level this metric is reported at. 98 // The reporting level this metric is reported at.
101 RecordingGroup recording_group; 99 RecordingGroup recording_group;
102 }; 100 };
103 101
104 namespace internal { 102 namespace internal {
105 103
106 const NoiseParameters kNoiseParametersForLevel[NUM_NOISE_LEVELS] = { 104 const NoiseParameters kNoiseParametersForLevel[NUM_NOISE_LEVELS] = {
107 // NO_NOISE 105 // NO_NOISE
108 { 106 {
109 rappor::PROBABILITY_0 /* Fake data probability */, 107 rappor::PROBABILITY_0 /* Fake data probability */,
110 rappor::PROBABILITY_0 /* Fake one probability */, 108 rappor::PROBABILITY_0 /* Fake one probability */,
111 rappor::PROBABILITY_100 /* One coin probability */, 109 rappor::PROBABILITY_100 /* One coin probability */,
112 rappor::PROBABILITY_0 /* Zero coin probability */, 110 rappor::PROBABILITY_0 /* Zero coin probability */,
113 }, 111 },
114 // NORMAL_NOISE 112 // NORMAL_NOISE
115 { 113 {
116 rappor::PROBABILITY_50 /* Fake data probability */, 114 rappor::PROBABILITY_50 /* Fake data probability */,
117 rappor::PROBABILITY_50 /* Fake one probability */, 115 rappor::PROBABILITY_50 /* Fake one probability */,
118 rappor::PROBABILITY_75 /* One coin probability */, 116 rappor::PROBABILITY_75 /* One coin probability */,
119 rappor::PROBABILITY_25 /* Zero coin probability */, 117 rappor::PROBABILITY_25 /* Zero coin probability */,
120 }, 118 },
121 // SPARSE_NOISE 119 // SPARSE_NOISE
122 { 120 {
123 rappor::PROBABILITY_25 /* Fake data probability */, 121 rappor::PROBABILITY_25 /* Fake data probability */,
124 rappor::PROBABILITY_50 /* Fake one probability */, 122 rappor::PROBABILITY_50 /* Fake one probability */,
125 rappor::PROBABILITY_75 /* One coin probability */, 123 rappor::PROBABILITY_75 /* One coin probability */,
126 rappor::PROBABILITY_25 /* Zero coin probability */, 124 rappor::PROBABILITY_25 /* Zero coin probability */,
127 }, 125 },
128 }; 126 };
129 127
130 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { 128 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = {
131 // UMA_RAPPOR_TYPE 129 // UMA_RAPPOR_TYPE
132 {128 /* Num cohorts */, 130 {
133 4 /* Bloom filter size bytes */, 131 128 /* Num cohorts */,
134 2 /* Bloom filter hash count */, 132 4 /* Bloom filter size bytes */,
135 rappor::NORMAL_NOISE /* Noise level */, 133 2 /* Bloom filter hash count */,
136 UMA_RAPPOR_GROUP /* Recording group */}, 134 rappor::NORMAL_NOISE /* Noise level */,
135 UMA_RAPPOR_GROUP /* Recording group */
136 },
137 // SAFEBROWSING_RAPPOR_TYPE 137 // SAFEBROWSING_RAPPOR_TYPE
138 {128 /* Num cohorts */, 138 {
139 1 /* Bloom filter size bytes */, 139 128 /* Num cohorts */,
140 2 /* Bloom filter hash count */, 140 1 /* Bloom filter size bytes */,
141 rappor::NORMAL_NOISE /* Noise level */, 141 2 /* Bloom filter hash count */,
142 SAFEBROWSING_RAPPOR_GROUP /* Recording group */}, 142 rappor::NORMAL_NOISE /* Noise level */,
143 SAFEBROWSING_RAPPOR_GROUP /* Recording group */
144 },
143 // ETLD_PLUS_ONE_RAPPOR_TYPE 145 // ETLD_PLUS_ONE_RAPPOR_TYPE
144 {128 /* Num cohorts */, 146 {
145 16 /* Bloom filter size bytes */, 147 128 /* Num cohorts */,
146 2 /* Bloom filter hash count */, 148 16 /* Bloom filter size bytes */,
147 rappor::NORMAL_NOISE /* Noise level */, 149 2 /* Bloom filter hash count */,
148 UMA_RAPPOR_GROUP /* Recording group */}, 150 rappor::NORMAL_NOISE /* Noise level */,
151 UMA_RAPPOR_GROUP /* Recording group */
152 },
149 // LOW_FREQUENCY_UMA_RAPPOR_TYPE 153 // LOW_FREQUENCY_UMA_RAPPOR_TYPE
150 {128 /* Num cohorts */, 154 {
151 4 /* Bloom filter size bytes */, 155 128 /* Num cohorts */,
152 2 /* Bloom filter hash count */, 156 4 /* Bloom filter size bytes */,
153 rappor::SPARSE_NOISE /* Noise level */, 157 2 /* Bloom filter hash count */,
154 UMA_RAPPOR_GROUP /* Recording group */}, 158 rappor::SPARSE_NOISE /* Noise level */,
159 UMA_RAPPOR_GROUP /* Recording group */
160 },
155 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE 161 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE
156 {128 /* Num cohorts */, 162 {
157 1 /* Bloom filter size bytes */, 163 128 /* Num cohorts */,
158 2 /* Bloom filter hash count */, 164 1 /* Bloom filter size bytes */,
159 rappor::SPARSE_NOISE /* Noise level */, 165 2 /* Bloom filter hash count */,
160 SAFEBROWSING_RAPPOR_GROUP /* Recording group */}, 166 rappor::SPARSE_NOISE /* Noise level */,
167 SAFEBROWSING_RAPPOR_GROUP /* Recording group */
168 },
161 // LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE 169 // LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE
162 {128 /* Num cohorts */, 170 {
163 16 /* Bloom filter size bytes */, 171 128 /* Num cohorts */,
164 2 /* Bloom filter hash count */, 172 16 /* Bloom filter size bytes */,
165 rappor::SPARSE_NOISE /* Noise level */, 173 2 /* Bloom filter hash count */,
166 UMA_RAPPOR_GROUP /* Recording group */}, 174 rappor::SPARSE_NOISE /* Noise level */,
175 UMA_RAPPOR_GROUP /* Recording group */
176 },
167 }; 177 };
168 178
169 } // namespace internal 179 } // namespace internal
170 180
171 } // namespace rappor 181 } // namespace rappor
172 182
173 #endif // COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ 183 #endif // COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PARAMETERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698