OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_RAPPOR_RAPPOR_H_ |
| 6 #define CHROME_BROWSER_RAPPOR_RAPPOR_H_ |
| 7 |
| 8 #include <assert.h> |
| 9 #include <limits.h> |
| 10 #include <math.h> |
| 11 |
| 12 #include <string> |
| 13 #include <vector> |
| 14 |
| 15 #include "components/rappor/bloom_filter.h" |
| 16 |
| 17 // A Rappor is an object for collecting privacy preserving randomized reports. |
| 18 // Samples are added to named metrics through the use of the RAPPOR_SAMPLE |
| 19 // macro. Samples can be either individual strings, or a vector of strings. |
| 20 |
| 21 namespace rappor { |
| 22 |
| 23 class Rappor { |
| 24 public: |
| 25 Rappor(const std::string& name, |
| 26 const uint32_t bytes_size, |
| 27 const uint32_t hash_count, |
| 28 const int fake_prob_index, |
| 29 const int fake_one_prob_index, |
| 30 const int one_honesty_prob_index, |
| 31 const int zero_honesty_prob_index); |
| 32 |
| 33 void Add(const std::vector<std::string>& strings); |
| 34 |
| 35 void Add(const std::string& str); |
| 36 |
| 37 const ByteVector& GetBytes() const; |
| 38 |
| 39 const std::string& rappor_name() const; |
| 40 |
| 41 int fake_prob_index() const { return fake_prob_index_; } |
| 42 |
| 43 int fake_one_prob_index() const { return fake_one_prob_index_; } |
| 44 |
| 45 int one_honesty_prob_index() const { return one_honesty_prob_index_; } |
| 46 |
| 47 int zero_honesty_prob_index() const { return zero_honesty_prob_index_; } |
| 48 |
| 49 private: |
| 50 const std::string rappor_name_; |
| 51 BloomFilter bloom_; |
| 52 |
| 53 const int fake_prob_index_; |
| 54 const int fake_one_prob_index_; |
| 55 const int one_honesty_prob_index_; |
| 56 const int zero_honesty_prob_index_; |
| 57 }; |
| 58 |
| 59 } // namespace rappor |
| 60 |
| 61 #endif // CHROME_BROWSER_RAPPOR_RAPPOR_H_ |
OLD | NEW |