Chromium Code Reviews| Index: components/rappor/rappor.h |
| diff --git a/components/rappor/rappor.h b/components/rappor/rappor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4e9ec85b0337ea3f1b0942934b9063590dbdfa6d |
| --- /dev/null |
| +++ b/components/rappor/rappor.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_RAPPOR_RAPPOR_H_ |
| +#define COMPONENTS_RAPPOR_RAPPOR_H_ |
| + |
| +#include <assert.h> |
| +#include <limits.h> |
| +#include <math.h> |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "components/rappor/bloom_filter.h" |
| +#include "components/rappor/rappor_parameters.h" |
| + |
| +// A Rappor is an object for collecting privacy preserving randomized reports. |
| +// Samples are added to named metrics through the use of the RAPPOR_SAMPLE |
| +// macro. Samples can be either individual strings, or a vector of strings. |
| + |
| +namespace rappor { |
| + |
| +// A class that maintains parameters and bloom filter data for a Rappor Metric. |
|
Alexei Svitkine (slow)
2013/12/19 19:47:02
Maybe it should be called RapporMetric? Rappor by
Steven Holte
2013/12/20 03:03:55
I'll pick this up in the next pass.
Steven Holte
2013/12/20 23:36:04
Done.
|
| +// |
| +// For a full description of the rappor metrics, see |
| +// http://www.chromium.org/developers/design-documents/rappor |
| +class Rappor { |
| + public: |
| + Rappor(const RapporParameters* parameters); |
| + |
| + // Record additional samples in the bloom filter. |
| + void AddSamples(const std::vector<std::string>& strings); |
| + void AddSample(const std::string& str); |
| + |
| + // Retrieves the current bloom filter bits. |
| + const ByteVector& GetBytes() const; |
| + const RapporParameters* parameters() const { return parameters_; } |
| + |
| + private: |
| + const RapporParameters* parameters_; |
| + BloomFilter bloom_; |
| +}; |
|
Alexei Svitkine (slow)
2013/12/19 19:47:02
Nit: DISALLOW_COPY_AND_ASSIGN
Steven Holte
2013/12/20 03:03:55
Done.
|
| + |
| +} // namespace rappor |
| + |
| +#endif // COMPONENTS_RAPPOR_RAPPOR_H_ |