[email protected] | 0d5a61a8 | 2014-05-31 22:28:34 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ | ||||
6 | #define COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ | ||||
7 | |||||
8 | #include <string> | ||||
9 | |||||
[email protected] | 0d5a61a8 | 2014-05-31 22:28:34 | [diff] [blame] | 10 | #include "base/callback.h" |
11 | #include "base/macros.h" | ||||
holte | 4ae63f5 | 2017-03-08 00:25:08 | [diff] [blame] | 12 | #include "base/strings/string_piece.h" |
[email protected] | 0d5a61a8 | 2014-05-31 22:28:34 | [diff] [blame] | 13 | |
14 | namespace metrics { | ||||
15 | |||||
16 | // MetricsLogUploader is an abstract base class for uploading UMA logs on behalf | ||||
17 | // of MetricsService. | ||||
18 | class MetricsLogUploader { | ||||
19 | public: | ||||
holte | 035ec7fb | 2017-04-04 20:16:59 | [diff] [blame^] | 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 | |||||
rkaplow | 9c42082 | 2017-02-24 15:29:57 | [diff] [blame] | 24 | // Possible service types. This should correspond to a type from |
25 | // DataUseUserData. | ||||
26 | enum MetricServiceType { | ||||
27 | UMA, | ||||
28 | UKM, | ||||
29 | }; | ||||
30 | |||||
holte | 4ae63f5 | 2017-03-08 00:25:08 | [diff] [blame] | 31 | virtual ~MetricsLogUploader() {} |
[email protected] | 0d5a61a8 | 2014-05-31 22:28:34 | [diff] [blame] | 32 | |
[email protected] | 9706e1b | 2014-06-11 16:31:24 | [diff] [blame] | 33 | // Uploads a log with the specified |compressed_log_data| and |log_hash|. |
34 | // |log_hash| is expected to be the hex-encoded SHA1 hash of the log data | ||||
35 | // before compression. | ||||
isherman | a672752 | 2015-08-06 22:28:49 | [diff] [blame] | 36 | virtual void UploadLog(const std::string& compressed_log_data, |
[email protected] | 0d5a61a8 | 2014-05-31 22:28:34 | [diff] [blame] | 37 | const std::string& log_hash) = 0; |
[email protected] | 0d5a61a8 | 2014-05-31 22:28:34 | [diff] [blame] | 38 | }; |
39 | |||||
40 | } // namespace metrics | ||||
41 | |||||
42 | #endif // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ |