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

Side by Side Diff: chrome/browser/net/chrome_certificate_reporter.h

Issue 979893003: Refactor ChromeFraudulentCertReporter for code reuse by SSL reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
(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 CHROME_BROWSER_NET_CHROME_CERTIFICATE_REPORTER_H_
6 #define CHROME_BROWSER_NET_CHROME_CERTIFICATE_REPORTER_H_
7
8 #include <set>
9 #include <string>
10
11 #include "net/url_request/url_request.h"
12
13 namespace net {
14 class URLRequestContext;
15 }
16
17 namespace chrome_browser_net {
18
19 class CertLoggerRequest;
20
21 // Provides functionality for sending reports about invalid SSL
22 // certificate chains to a report collection server.
23 class ChromeCertificateReporter : public net::URLRequest::Delegate {
estark 2015/03/04 17:33:49 Is this name confusingly similar to ChromeFraudule
felt 2015/03/04 19:15:47 It might make sense to name them something like:
Ryan Sleevi 2015/03/04 19:31:01 CertificateErrorReporter ?
Ryan Sleevi 2015/03/04 19:31:01 Eh, Chris named it for a reason, but I suppose tha
estark 2015/03/04 22:11:57 Now it's ChromeFraudulentCertificateReporter and C
24 public:
25 explicit ChromeCertificateReporter(net::URLRequestContext* request_context,
26 const std::string& upload_url);
27
28 ~ChromeCertificateReporter() override;
29
30 // Allows users of this class to override this and set their own URLRequest
31 // type. Used by SendReport.
32 virtual scoped_ptr<net::URLRequest> CreateURLRequest(
33 net::URLRequestContext* context);
34
35 // Construct, serialize, and send a certificate reporter to the report
36 // collection server containing the |ssl_info| associated with a
37 // connection to |hostname|.
38 virtual void SendReport(const std::string& hostname,
39 const net::SSLInfo& ssl_info);
40
41 // net::URLRequest::Delegate
42 void OnResponseStarted(net::URLRequest* request) override;
43 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
44
45 protected:
46 // Populate the CertLoggerRequest for a report.
47 static void BuildReport(const std::string& hostname,
48 const net::SSLInfo& ssl_info,
49 CertLoggerRequest& out_request);
50
51 // Serialize and send a CertLoggerRequest protobuf to the report
52 // collection server.
53 void SendCertLoggerRequest(CertLoggerRequest& request);
54
55 net::URLRequestContext* const request_context_;
56
57 private:
58 // Performs post-report cleanup.
59 void RequestComplete(net::URLRequest* request);
60
61 const GURL upload_url_;
62
63 // Owns the contained requests.
64 std::set<net::URLRequest*> inflight_requests_;
65
66 DISALLOW_COPY_AND_ASSIGN(ChromeCertificateReporter);
67 };
68
69 } // namespace chrome_browser_net
70
71 #endif // CHROME_BROWSER_NET_CHROME_CERTIFICATE_REPORTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/chrome_certificate_reporter.cc » ('j') | chrome/browser/net/chrome_certificate_reporter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698