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

Unified Diff: components/metrics/metrics_log_uploader.h

Issue 291153013: Make MetricsService upload logs through an interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Casts for win64 compile Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/metrics.gypi ('k') | components/metrics/metrics_log_uploader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/metrics_log_uploader.h
===================================================================
--- components/metrics/metrics_log_uploader.h (revision 0)
+++ components/metrics/metrics_log_uploader.h (revision 0)
@@ -0,0 +1,44 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_
+#define COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/macros.h"
+
+namespace metrics {
+
+// MetricsLogUploader is an abstract base class for uploading UMA logs on behalf
+// of MetricsService.
+class MetricsLogUploader {
+ public:
+ // Constructs the uploader that will upload logs to the specified |server_url|
+ // with the given |mime_type|. The |on_upload_complete| callback will be
+ // called with the HTTP response code of the upload or with -1 on an error.
+ MetricsLogUploader(const std::string& server_url,
+ const std::string& mime_type,
+ const base::Callback<void(int)>& on_upload_complete);
+ virtual ~MetricsLogUploader();
+
+ // Uploads a log with the specified |log_data| and |log_hash|. |log_hash| is
+ // expected to be the hex-encoded SHA1 hash of |log_data|.
+ virtual bool UploadLog(const std::string& log_data,
+ const std::string& log_hash) = 0;
+
+ protected:
+ const std::string server_url_;
+ const std::string mime_type_;
+ const base::Callback<void(int)> on_upload_complete_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MetricsLogUploader);
+};
+
+} // namespace metrics
+
+#endif // COMPONENTS_METRICS_METRICS_LOG_UPLOADER_H_
« no previous file with comments | « components/metrics.gypi ('k') | components/metrics/metrics_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698