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

Side by Side Diff: net/reporting/reporting_uploader.h

Issue 2723563002: Reporting: Implement uploader. (Closed)
Patch Set: Make requested changes. Created 3 years, 8 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 | « net/BUILD.gn ('k') | net/reporting/reporting_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
(Empty)
1 // Copyright 2016 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 NET_REPORTING_REPORTING_UPLOADER_H_
6 #define NET_REPORTING_REPORTING_UPLOADER_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "net/base/net_export.h"
13
14 class GURL;
15
16 namespace net {
17
18 class URLRequestContext;
19
20 // Uploads already-serialized reports and converts responses to one of the
21 // specified outcomes.
22 class NET_EXPORT ReportingUploader {
23 public:
24 enum class Outcome { SUCCESS, REMOVE_ENDPOINT, FAILURE };
25
26 using Callback = base::Callback<void(Outcome outcome)>;
27
28 static const char kUploadContentType[];
29
30 virtual ~ReportingUploader();
31
32 // Starts to upload the reports in |json| (properly tagged as JSON data) to
33 // |url|, and calls |callback| when complete (whether successful or not).
34 virtual void StartUpload(const GURL& url,
35 const std::string& json,
36 const Callback& callback) = 0;
37
38 // Creates a real implementation of |ReportingUploader| that uploads reports
39 // using |context|.
40 static std::unique_ptr<ReportingUploader> Create(
41 const URLRequestContext* context);
42 };
43
44 } // namespace net
45
46 #endif // NET_REPORTING_REPORTING_UPLOADER_H_
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/reporting/reporting_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698