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

Unified Diff: components/rappor/rappor.h

Issue 49753002: RAPPOR implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698