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_METRICS_METRICS_LOG_UPLOADER_H_ | 5 #ifndef COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ |
6 #define COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ | 6 #define COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 | 13 |
14 namespace metrics { | 14 namespace metrics { |
15 | 15 |
16 // MetricsLogUploader is an abstract base class for uploading UMA logs on behalf | 16 // MetricsLogUploader is an abstract base class for uploading UMA logs on behalf |
17 // of MetricsService. | 17 // of MetricsService. |
18 class MetricsLogUploader { | 18 class MetricsLogUploader { |
19 public: | 19 public: |
| 20 // Type for OnUploadComplete callbacks. These callbacks will receive two |
| 21 // parameters: A response code and an net error code. |
| 22 typedef base::Callback<void(int, int)> UploadCallback; |
| 23 |
20 // Possible service types. This should correspond to a type from | 24 // Possible service types. This should correspond to a type from |
21 // DataUseUserData. | 25 // DataUseUserData. |
22 enum MetricServiceType { | 26 enum MetricServiceType { |
23 UMA, | 27 UMA, |
24 UKM, | 28 UKM, |
25 }; | 29 }; |
26 | 30 |
27 virtual ~MetricsLogUploader() {} | 31 virtual ~MetricsLogUploader() {} |
28 | 32 |
29 // Uploads a log with the specified |compressed_log_data| and |log_hash|. | 33 // Uploads a log with the specified |compressed_log_data| and |log_hash|. |
30 // |log_hash| is expected to be the hex-encoded SHA1 hash of the log data | 34 // |log_hash| is expected to be the hex-encoded SHA1 hash of the log data |
31 // before compression. | 35 // before compression. |
32 virtual void UploadLog(const std::string& compressed_log_data, | 36 virtual void UploadLog(const std::string& compressed_log_data, |
33 const std::string& log_hash) = 0; | 37 const std::string& log_hash) = 0; |
34 }; | 38 }; |
35 | 39 |
36 } // namespace metrics | 40 } // namespace metrics |
37 | 41 |
38 #endif // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ | 42 #endif // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ |
OLD | NEW |