OLD | NEW |
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 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 protected: | 76 protected: |
77 // Initializes the state of the RapporService. | 77 // Initializes the state of the RapporService. |
78 void InitializeInternal(scoped_ptr<LogUploaderInterface> uploader, | 78 void InitializeInternal(scoped_ptr<LogUploaderInterface> uploader, |
79 int32_t cohort, | 79 int32_t cohort, |
80 const std::string& secret); | 80 const std::string& secret); |
81 | 81 |
82 // Sets the recording level. | 82 // Sets the recording level. |
83 void SetRecordingLevel(RecordingLevel parameters); | 83 void SetRecordingLevel(RecordingLevel parameters); |
84 | 84 |
85 // Retrieves the cohort number this client was assigned to, generating it if | |
86 // doesn't already exist. The cohort should be persistent. | |
87 int32_t LoadCohort(); | |
88 | |
89 // Retrieves the value for secret_ from preferences, generating it if doesn't | |
90 // already exist. The secret should be persistent, so that additional bits | |
91 // from the client do not get exposed over time. | |
92 std::string LoadSecret(); | |
93 | |
94 // Cancels the next call to OnLogInterval. | 85 // Cancels the next call to OnLogInterval. |
95 virtual void CancelNextLogRotation(); | 86 virtual void CancelNextLogRotation(); |
96 | 87 |
97 // Schedules the next call to OnLogInterval. | 88 // Schedules the next call to OnLogInterval. |
98 virtual void ScheduleNextLogRotation(base::TimeDelta interval); | 89 virtual void ScheduleNextLogRotation(base::TimeDelta interval); |
99 | 90 |
100 // Logs all of the collected metrics to the reports proto message and clears | 91 // Logs all of the collected metrics to the reports proto message and clears |
101 // the internal map. Exposed for tests. Returns true if any metrics were | 92 // the internal map. Exposed for tests. Returns true if any metrics were |
102 // recorded. | 93 // recorded. |
103 bool ExportMetrics(RapporReports* reports); | 94 bool ExportMetrics(RapporReports* reports); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // We keep all registered metrics in a map, from name to metric. | 140 // We keep all registered metrics in a map, from name to metric. |
150 // The map owns the metrics it contains. | 141 // The map owns the metrics it contains. |
151 std::map<std::string, RapporMetric*> metrics_map_; | 142 std::map<std::string, RapporMetric*> metrics_map_; |
152 | 143 |
153 DISALLOW_COPY_AND_ASSIGN(RapporService); | 144 DISALLOW_COPY_AND_ASSIGN(RapporService); |
154 }; | 145 }; |
155 | 146 |
156 } // namespace rappor | 147 } // namespace rappor |
157 | 148 |
158 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ | 149 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ |
OLD | NEW |