| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 class LogUploader; | 25 class LogUploader; |
| 26 class RapporMetric; | 26 class RapporMetric; |
| 27 class RapporReports; | 27 class RapporReports; |
| 28 struct RapporParameters; | 28 struct RapporParameters; |
| 29 | 29 |
| 30 // The type of data stored in a metric. | 30 // The type of data stored in a metric. |
| 31 enum RapporType { | 31 enum RapporType { |
| 32 // For sampling the eTLD+1 of a URL. | 32 // For sampling the eTLD+1 of a URL. |
| 33 ETLD_PLUS_ONE_RAPPOR_TYPE = 0, | 33 ETLD_PLUS_ONE_RAPPOR_TYPE = 0, |
| 34 SAFE_BROWSING_PATTERN_RAPPOR_TYPE, |
| 34 NUM_RAPPOR_TYPES | 35 NUM_RAPPOR_TYPES |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 // This class provides an interface for recording samples for rappor metrics, | 38 // This class provides an interface for recording samples for rappor metrics, |
| 38 // and periodically generates and uploads reports based on the collected data. | 39 // and periodically generates and uploads reports based on the collected data. |
| 39 class RapporService { | 40 class RapporService { |
| 40 public: | 41 public: |
| 41 RapporService(); | 42 RapporService(); |
| 42 virtual ~RapporService(); | 43 virtual ~RapporService(); |
| 43 | 44 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 103 |
| 103 // The cohort this client is assigned to. -1 is uninitialized. | 104 // The cohort this client is assigned to. -1 is uninitialized. |
| 104 int32_t cohort_; | 105 int32_t cohort_; |
| 105 | 106 |
| 106 // Timer which schedules calls to OnLogInterval(). | 107 // Timer which schedules calls to OnLogInterval(). |
| 107 base::OneShotTimer<RapporService> log_rotation_timer_; | 108 base::OneShotTimer<RapporService> log_rotation_timer_; |
| 108 | 109 |
| 109 // A private LogUploader instance for sending reports to the server. | 110 // A private LogUploader instance for sending reports to the server. |
| 110 scoped_ptr<LogUploader> uploader_; | 111 scoped_ptr<LogUploader> uploader_; |
| 111 | 112 |
| 113 // True if we are collecting all metrics instead of only whitelisted ones. |
| 114 bool all_metrics_enabled_; |
| 115 |
| 112 // We keep all registered metrics in a map, from name to metric. | 116 // We keep all registered metrics in a map, from name to metric. |
| 113 // The map owns the metrics it contains. | 117 // The map owns the metrics it contains. |
| 114 std::map<std::string, RapporMetric*> metrics_map_; | 118 std::map<std::string, RapporMetric*> metrics_map_; |
| 115 | 119 |
| 116 DISALLOW_COPY_AND_ASSIGN(RapporService); | 120 DISALLOW_COPY_AND_ASSIGN(RapporService); |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 } // namespace rappor | 123 } // namespace rappor |
| 120 | 124 |
| 121 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ | 125 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ |
| OLD | NEW |