| OLD | NEW |
| 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_DOMAIN_RELIABILITY_UPLOADER_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_ |
| 6 #define COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "components/domain_reliability/domain_reliability_export.h" | 14 #include "components/domain_reliability/domain_reliability_export.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 class URLFetcher; | 18 class URLFetcher; |
| 18 class URLRequest; | 19 class URLRequest; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 typedef base::Callback<void(const UploadResult& result)> UploadCallback; | 45 typedef base::Callback<void(const UploadResult& result)> UploadCallback; |
| 45 | 46 |
| 46 DomainReliabilityUploader(); | 47 DomainReliabilityUploader(); |
| 47 | 48 |
| 48 virtual ~DomainReliabilityUploader(); | 49 virtual ~DomainReliabilityUploader(); |
| 49 | 50 |
| 50 // Creates an uploader that uses the given |url_request_context_getter| to | 51 // Creates an uploader that uses the given |url_request_context_getter| to |
| 51 // get a URLRequestContext to use for uploads. (See test_util.h for a mock | 52 // get a URLRequestContext to use for uploads. (See test_util.h for a mock |
| 52 // version.) | 53 // version.) |
| 53 static scoped_ptr<DomainReliabilityUploader> Create( | 54 static std::unique_ptr<DomainReliabilityUploader> Create( |
| 54 MockableTime* time, | 55 MockableTime* time, |
| 55 const scoped_refptr< | 56 const scoped_refptr<net::URLRequestContextGetter>& |
| 56 net::URLRequestContextGetter>& url_request_context_getter); | 57 url_request_context_getter); |
| 57 | 58 |
| 58 // Uploads |report_json| to |upload_url| and calls |callback| when the upload | 59 // Uploads |report_json| to |upload_url| and calls |callback| when the upload |
| 59 // has either completed or failed. | 60 // has either completed or failed. |
| 60 virtual void UploadReport(const std::string& report_json, | 61 virtual void UploadReport(const std::string& report_json, |
| 61 int max_beacon_depth, | 62 int max_beacon_depth, |
| 62 const GURL& upload_url, | 63 const GURL& upload_url, |
| 63 const UploadCallback& callback) = 0; | 64 const UploadCallback& callback) = 0; |
| 64 | 65 |
| 65 virtual void set_discard_uploads(bool discard_uploads) = 0; | 66 virtual void set_discard_uploads(bool discard_uploads) = 0; |
| 66 | 67 |
| 67 static int GetURLRequestUploadDepth(const net::URLRequest& request); | 68 static int GetURLRequestUploadDepth(const net::URLRequest& request); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace domain_reliability | 71 } // namespace domain_reliability |
| 71 | 72 |
| 72 #endif // COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_ | 73 #endif // COMPONENTS_DOMAIN_RELIABILITY_UPLOADER_H_ |
| OLD | NEW |