blob: 3fe7f5e3f5cdf8be9c487068f03f17725afe3dff [file] [log] [blame]
[email protected]0d5a61a82014-05-31 22:28:341// 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]0d5a61a82014-05-31 22:28:3410#include "base/callback.h"
11#include "base/macros.h"
holte4ae63f52017-03-08 00:25:0812#include "base/strings/string_piece.h"
[email protected]0d5a61a82014-05-31 22:28:3413
14namespace metrics {
15
16// MetricsLogUploader is an abstract base class for uploading UMA logs on behalf
17// of MetricsService.
18class MetricsLogUploader {
19 public:
holte035ec7fb2017-04-04 20:16:5920 // 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
rkaplow9c420822017-02-24 15:29:5724 // Possible service types. This should correspond to a type from
25 // DataUseUserData.
26 enum MetricServiceType {
27 UMA,
28 UKM,
29 };
30
holte4ae63f52017-03-08 00:25:0831 virtual ~MetricsLogUploader() {}
[email protected]0d5a61a82014-05-31 22:28:3432
[email protected]9706e1b2014-06-11 16:31:2433 // 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.
ishermana6727522015-08-06 22:28:4936 virtual void UploadLog(const std::string& compressed_log_data,
[email protected]0d5a61a82014-05-31 22:28:3437 const std::string& log_hash) = 0;
[email protected]0d5a61a82014-05-31 22:28:3438};
39
40} // namespace metrics
41
42#endif // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_