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 COMPONENTS_RAPPOR_RAPPOR_H_ |
| 6 #define COMPONENTS_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 #include "components/rappor/rappor_parameters.h" |
| 17 #include "components/rappor/byte_vector_utils.h" |
| 18 |
| 19 namespace rappor { |
| 20 |
| 21 // A RapporMetric is an object for collects string samples into a bloom filter, |
| 22 // and generates randomized reports about the collected data. |
| 23 // |
| 24 // For a full description of the rappor metrics, see |
| 25 // http://www.chromium.org/developers/design-documents/rappor |
| 26 class RapporMetric { |
| 27 public: |
| 28 RapporMetric(const RapporParameters& parameters); |
| 29 |
| 30 // Record additional samples in the bloom filter. |
| 31 void AddSamples(const std::vector<std::string>& strings); |
| 32 void AddSample(const std::string& str); |
| 33 |
| 34 // Retrieves the current bloom filter bits. |
| 35 const ByteVector& GetBytes() const; |
| 36 const RapporParameters* parameters() const { return ¶meters_; } |
| 37 |
| 38 ByteVector GetReport(const std::string& secret) const; |
| 39 |
| 40 private: |
| 41 const RapporParameters parameters_; |
| 42 BloomFilter bloom_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(RapporMetric); |
| 45 }; |
| 46 |
| 47 } // namespace rappor |
| 48 |
| 49 #endif // COMPONENTS_RAPPOR_RAPPOR_H_ |
OLD | NEW |