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

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

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix an Android compile error 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
ncarter (slow) 2016/12/01 22:33:32 2016
Navid Zolghadr 2016/12/02 20:47:35 Done.
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_PUBLIC_SERVICE_H_
6 #define COMPONENTS_RAPPOR_RAPPOR_PUBLIC_SERVICE_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/memory/weak_ptr.h"
12 #include "components/rappor/public/rappor_parameters.h"
13 #include "components/rappor/public/sample.h"
14
15 namespace rappor {
16
17 // This class provides a public interface for recording samples for rappor
18 // metrics, which other components can be depended on.
19 class RapporPublicService : public base::SupportsWeakPtr<RapporService> {
ncarter (slow) 2016/12/01 22:33:32 I'm not opposed to this name (and ultimately it's
Navid Zolghadr 2016/12/02 20:47:35 Although holte@ gave lgtm but I believe what you a
ncarter (slow) 2016/12/05 19:50:49 Thanks for doing the rename.
20 public:
21 // Constructs a Sample object for the caller to record fields in.
22 virtual std::unique_ptr<Sample> CreateSample(RapporType) = 0;
23
24 // Records a Sample of rappor metric specified by |metric_name|.
25 //
26 // example:
27 // std::unique_ptr<Sample> sample =
28 // rappor_service->CreateSample(MY_METRIC_TYPE);
29 // sample->SetStringField("Field1", "some string");
30 // sample->SetFlagsValue("Field2", SOME|FLAGS);
31 // rappor_service->RecordSample("MyMetric", std::move(sample));
32 virtual void RecordSample(const std::string& metric_name,
33 std::unique_ptr<Sample> sample) = 0;
34
35 // Records a sample of the rappor metric specified by |metric_name|.
36 // Creates and initializes the metric, if it doesn't yet exist.
37 virtual void RecordSampleString(const std::string& metric_name,
38 RapporType type,
39 const std::string& sample) = 0;
40 };
41
42 } // namespace rappor
43
44 #endif // COMPONENTS_RAPPOR_RAPPOR_PUBLIC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698