use new api names for SkGraphics
[chromium-blink-merge.git] / components / domain_reliability / uploader.h
blob6ab63c8f2d308b966b396ba3ffbd41728fdd47ad
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_
8 #include <map>
10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h"
12 #include "components/domain_reliability/domain_reliability_export.h"
13 #include "url/gurl.h"
15 namespace net {
16 class URLFetcher;
17 class URLRequest;
18 class URLRequestContextGetter;
19 } // namespace net
21 namespace domain_reliability {
23 // Uploads Domain Reliability reports to collectors.
24 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityUploader {
25 public:
26 typedef base::Callback<void(bool success)> UploadCallback;
28 DomainReliabilityUploader();
30 virtual ~DomainReliabilityUploader();
32 // Creates an uploader that uses the given |url_request_context_getter| to
33 // get a URLRequestContext to use for uploads. (See test_util.h for a mock
34 // version.)
35 static scoped_ptr<DomainReliabilityUploader> Create(const scoped_refptr<
36 net::URLRequestContextGetter>& url_request_context_getter);
38 // Uploads |report_json| to |upload_url| and calls |callback| when the upload
39 // has either completed or failed.
40 virtual void UploadReport(const std::string& report_json,
41 const GURL& upload_url,
42 const UploadCallback& callback) = 0;
44 virtual void set_discard_uploads(bool discard_uploads) = 0;
46 static bool URLRequestIsUpload(const net::URLRequest& request);
49 } // namespace domain_reliability
51 #endif // COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_