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

Side by Side Diff: components/rappor/rappor_service.h

Issue 1014543003: Add an IPC method for Blink to call RapporService::RecordSample() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ 5 #ifndef COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_
6 #define COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ 6 #define COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/metrics/user_metrics.h"
15 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
16 #include "components/metrics/daily_event.h" 17 #include "components/metrics/daily_event.h"
17 #include "components/rappor/rappor_parameters.h" 18 #include "components/rappor/rappor_parameters.h"
18 19
19 class PrefRegistrySimple; 20 class PrefRegistrySimple;
20 class PrefService; 21 class PrefService;
21 22
22 namespace net { 23 namespace net {
23 class URLRequestContextGetter; 24 class URLRequestContextGetter;
24 } 25 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const RapporParameters& parameters, 102 const RapporParameters& parameters,
102 const std::string& sample); 103 const std::string& sample);
103 104
104 // Checks if the service has been started successfully. 105 // Checks if the service has been started successfully.
105 bool IsInitialized() const; 106 bool IsInitialized() const;
106 107
107 // Called whenever the logging interval elapses to generate a new log of 108 // Called whenever the logging interval elapses to generate a new log of
108 // reports and pass it to the uploader. 109 // reports and pass it to the uploader.
109 void OnLogInterval(); 110 void OnLogInterval();
110 111
112 void EnableRecordFromUserMetrics();
113 void OnUserMetricsCallback(
114 const std::string& metric,
115 const std::string& sample);
116
111 // Finds a metric in the metrics_map_, creating it if it doesn't already 117 // Finds a metric in the metrics_map_, creating it if it doesn't already
112 // exist. 118 // exist.
113 RapporMetric* LookUpMetric(const std::string& metric_name, 119 RapporMetric* LookUpMetric(const std::string& metric_name,
114 const RapporParameters& parameters); 120 const RapporParameters& parameters);
115 121
116 // A weak pointer to the PrefService used to read and write preferences. 122 // A weak pointer to the PrefService used to read and write preferences.
117 PrefService* pref_service_; 123 PrefService* pref_service_;
118 124
119 // A callback for testing if incognito mode is active; 125 // A callback for testing if incognito mode is active;
120 const base::Callback<bool(void)> is_incognito_callback_; 126 const base::Callback<bool(void)> is_incognito_callback_;
(...skipping 13 matching lines...) Expand all
134 // A private LogUploader instance for sending reports to the server. 140 // A private LogUploader instance for sending reports to the server.
135 scoped_ptr<LogUploaderInterface> uploader_; 141 scoped_ptr<LogUploaderInterface> uploader_;
136 142
137 // What reporting level of metrics are being reported. 143 // What reporting level of metrics are being reported.
138 RecordingLevel recording_level_; 144 RecordingLevel recording_level_;
139 145
140 // We keep all registered metrics in a map, from name to metric. 146 // We keep all registered metrics in a map, from name to metric.
141 // The map owns the metrics it contains. 147 // The map owns the metrics it contains.
142 std::map<std::string, RapporMetric*> metrics_map_; 148 std::map<std::string, RapporMetric*> metrics_map_;
143 149
150 base::RapporCallback user_metrics_callback_;
151
144 DISALLOW_COPY_AND_ASSIGN(RapporService); 152 DISALLOW_COPY_AND_ASSIGN(RapporService);
145 }; 153 };
146 154
147 } // namespace rappor 155 } // namespace rappor
148 156
149 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ 157 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698