[M108 Migration] Support standard build for armv7hl architecture
[platform/framework/web/chromium-efl.git] / components / metrics / metrics_log_uploader.h
1 // Copyright 2014 The Chromium Authors
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
10 #include "base/callback.h"
11 #include "base/strings/string_piece.h"
12
13 namespace metrics {
14
15 class ReportingInfo;
16
17 // MetricsLogUploader is an abstract base class for uploading UMA logs on behalf
18 // of MetricsService.
19 class MetricsLogUploader {
20  public:
21   // Type for OnUploadComplete callbacks.  These callbacks will receive three
22   // parameters: A response code, a net error code, and a boolean specifying
23   // if the connection was secure (over HTTPS).
24   using UploadCallback = base::RepeatingCallback<void(int, int, bool)>;
25
26   // Possible service types. This should correspond to a type from
27   // DataUseUserData.
28   enum MetricServiceType {
29     UMA,
30     UKM,
31   };
32
33   virtual ~MetricsLogUploader() {}
34
35   // Uploads a log with the specified |compressed_log_data|, a |log_hash| and
36   // |log_signature| for data validation, and |reporting_info|. |log_hash| is
37   // expected to be the hex-encoded SHA1 hash of the log data before compression
38   // and |log_signature| is expected to be a base64-encoded HMAC-SHA256
39   // signature of the log data before compression. When the server receives an
40   // upload it recomputes the hash and signature of the upload and compares it
41   // to the ones inlcuded in the upload. If there is a missmatched, the upload
42   // is flagged. If an Uploader implementation uploads to a server that doesn't
43   // do this validation then |log_hash| and |log_signature| can be ignored.
44   virtual void UploadLog(const std::string& compressed_log_data,
45                          const std::string& log_hash,
46                          const std::string& log_signature,
47                          const ReportingInfo& reporting_info) = 0;
48 };
49
50 }  // namespace metrics
51
52 #endif  // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_