OLD | NEW |
(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 "base/callback.h" |
| 9 #include "net/base/net_export.h" |
| 10 #include "net/url_request/url_fetcher.h" |
| 11 #include "net/url_request/url_fetcher_delegate.h" |
| 12 #include "net/url_request/url_request_context_getter.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace net { |
| 16 |
| 17 // Uploads reports and converts responses to one of the specified outcomes. |
| 18 class NET_EXPORT ReportingUploader { |
| 19 public: |
| 20 enum Outcome { SUCCESS, REMOVE_ENDPOINT, FAILURE }; |
| 21 |
| 22 using Callback = base::Callback<void(Outcome outcome)>; |
| 23 |
| 24 static const char kUploadContentType[]; |
| 25 |
| 26 virtual ~ReportingUploader(); |
| 27 |
| 28 virtual void AttemptDelivery(const GURL& url, |
| 29 const std::string& json, |
| 30 const Callback& callback) = 0; |
| 31 |
| 32 static std::unique_ptr<ReportingUploader> Create( |
| 33 const URLRequestContext* context); |
| 34 }; |
| 35 |
| 36 } // namespace net |
| 37 |
| 38 #endif // NET_REPORTING_REPORTING_UPLOADER_H_ |
OLD | NEW |