Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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_HTTP_CERTIFICATE_REPORT_SENDER_IMPL_H_ | |
| 6 #define NET_HTTP_CERTIFICATE_REPORT_SENDER_IMPL_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "net/http/certificate_report_sender.h" | |
| 14 #include "net/url_request/url_request.h" | |
|
davidben
2015/07/23 00:09:42
Nothing else in net/http includes anything from ne
estark
2015/07/23 02:41:21
Done.
| |
| 15 | |
| 16 class GURL; | |
| 17 | |
| 18 namespace net { | |
| 19 | |
| 20 class URLRequestContext; | |
| 21 | |
| 22 // An implementation of CertificateReportSender that sends reports with | |
| 23 // a given URLRequestContext. It owns inflight requests and cleans them | |
| 24 // up when necessary. | |
| 25 class NET_EXPORT CertificateReportSenderImpl : public URLRequest::Delegate, | |
| 26 public CertificateReportSender { | |
| 27 public: | |
| 28 // Represents whether or not to send cookies along with reports. | |
| 29 enum CookiesPreference { SEND_COOKIES, DO_NOT_SEND_COOKIES }; | |
| 30 | |
| 31 // Constructs a CertificateReportSender that sends reports with the | |
| 32 // given |request_context| and includes or excludes cookies based on | |
| 33 // |cookies_preference|. Ownership of |request_context| is not | |
| 34 // transferred, so it must outlive the CertificateReportSenderImpl. | |
| 35 CertificateReportSenderImpl(URLRequestContext* request_context, | |
| 36 CookiesPreference cookies_preference); | |
| 37 | |
| 38 ~CertificateReportSenderImpl() override; | |
| 39 | |
| 40 // CertificateReportSender overrides | |
| 41 void Send(const GURL& report_uri, const std::string& report) override; | |
| 42 | |
| 43 // net::URLRequest::Delegate | |
| 44 void OnResponseStarted(URLRequest* request) override; | |
| 45 void OnReadCompleted(URLRequest* request, int bytes_read) override; | |
| 46 | |
| 47 private: | |
| 48 // Creates a URLRequest with which to send a certificate report to the | |
| 49 // server. | |
| 50 virtual scoped_ptr<URLRequest> CreateURLRequest( | |
| 51 net::URLRequestContext* context, | |
| 52 const GURL& report_uri); | |
| 53 | |
| 54 // Performs post-report cleanup. | |
| 55 void RequestComplete(net::URLRequest* request); | |
| 56 | |
| 57 net::URLRequestContext* const request_context_; | |
| 58 | |
| 59 CookiesPreference cookies_preference_; | |
| 60 | |
| 61 // Owns the contained requests. | |
| 62 std::set<URLRequest*> inflight_requests_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(CertificateReportSenderImpl); | |
| 65 }; | |
| 66 | |
| 67 } // namespace net | |
| 68 | |
| 69 #endif // NET_HTTP_CERTIFICATE_REPORT_SENDER_H_ | |
| OLD | NEW |