Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: components/metrics/metrics_log_uploader.h

Issue 2735443003: Use StringPiece for CreateUploader/NetMetricsLogUploader params. (Closed)
Patch Set: Fix destructor Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/metrics/BUILD.gn ('k') | components/metrics/metrics_log_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13
13 namespace metrics { 14 namespace metrics {
14 15
15 // 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
16 // of MetricsService. 17 // of MetricsService.
17 class MetricsLogUploader { 18 class MetricsLogUploader {
18 public: 19 public:
19 // Possible service types. This should correspond to a type from 20 // Possible service types. This should correspond to a type from
20 // DataUseUserData. 21 // DataUseUserData.
21 enum MetricServiceType { 22 enum MetricServiceType {
22 UMA, 23 UMA,
23 UKM, 24 UKM,
24 }; 25 };
25 26
26 // Constructs the uploader that will upload logs to the specified |server_url| 27 virtual ~MetricsLogUploader() {};
Alexei Svitkine (slow) 2017/03/07 04:39:49 Nit: Remove ;
27 // with the given |mime_type|. The |service_type| marks which service the
28 // data usage should be attributed to. The |on_upload_complete| callback will
29 // be called with the HTTP response code of the upload or with -1 on an error.
30 MetricsLogUploader(const std::string& server_url,
31 const std::string& mime_type,
32 MetricServiceType service_type,
33 const base::Callback<void(int)>& on_upload_complete);
34 virtual ~MetricsLogUploader();
35 28
36 // Uploads a log with the specified |compressed_log_data| and |log_hash|. 29 // Uploads a log with the specified |compressed_log_data| and |log_hash|.
37 // |log_hash| is expected to be the hex-encoded SHA1 hash of the log data 30 // |log_hash| is expected to be the hex-encoded SHA1 hash of the log data
38 // before compression. 31 // before compression.
39 virtual void UploadLog(const std::string& compressed_log_data, 32 virtual void UploadLog(const std::string& compressed_log_data,
40 const std::string& log_hash) = 0; 33 const std::string& log_hash) = 0;
41
42 protected:
43 const std::string server_url_;
44 const std::string mime_type_;
45
46 // Which service type this uploads for. This is used for bandwidth
47 // attribution.
48 const MetricServiceType service_type_;
49
50 const base::Callback<void(int)> on_upload_complete_;
51
52 private:
53 DISALLOW_COPY_AND_ASSIGN(MetricsLogUploader);
54 }; 34 };
55 35
56 } // namespace metrics 36 } // namespace metrics
57 37
58 #endif // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_ 38 #endif // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_
OLDNEW
« no previous file with comments | « components/metrics/BUILD.gn ('k') | components/metrics/metrics_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698