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

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

Issue 1076273002: Add interstitial info to certificate reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ 5 #ifndef CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_
6 #define CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ 6 #define CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 REPORT_TYPE_PINNING_VIOLATION, 33 REPORT_TYPE_PINNING_VIOLATION,
34 // A report for an invalid certificate chain that is being sent for 34 // A report for an invalid certificate chain that is being sent for
35 // a user who has opted-in to the extended reporting program. 35 // a user who has opted-in to the extended reporting program.
36 REPORT_TYPE_EXTENDED_REPORTING 36 REPORT_TYPE_EXTENDED_REPORTING
37 }; 37 };
38 38
39 // Represents whether or not to send cookies along with reports sent 39 // Represents whether or not to send cookies along with reports sent
40 // to the server. 40 // to the server.
41 enum CookiesPreference { SEND_COOKIES, DO_NOT_SEND_COOKIES }; 41 enum CookiesPreference { SEND_COOKIES, DO_NOT_SEND_COOKIES };
42 42
43 enum ProceedDecision { USER_PROCEEDED, USER_DID_NOT_PROCEED };
44 enum Overridable { OVERRIDABLE, NOT_OVERRIDABLE };
Ryan Sleevi 2015/04/16 01:44:10 First scan: This seems to introduce awareness of i
estark 2015/04/16 02:09:31 Agreed. As I mentioned, I wasn't sure how to avoid
45
43 // Create a certificate error reporter that will send certificate 46 // Create a certificate error reporter that will send certificate
44 // error reports to |upload_url|, using |request_context| as the 47 // error reports to |upload_url|, using |request_context| as the
45 // context for the reports. |cookies_preference| controls whether 48 // context for the reports. |cookies_preference| controls whether
46 // cookies will be sent along with the reports. 49 // cookies will be sent along with the reports.
47 CertificateErrorReporter(net::URLRequestContext* request_context, 50 CertificateErrorReporter(net::URLRequestContext* request_context,
48 const GURL& upload_url, 51 const GURL& upload_url,
49 CookiesPreference cookies_preference); 52 CookiesPreference cookies_preference);
50 53
51 ~CertificateErrorReporter() override; 54 ~CertificateErrorReporter() override;
52 55
53 // Construct, serialize, and send a certificate report to the report 56 // Construct, serialize, and send a certificate report to the report
54 // collection server containing the |ssl_info| associated with a 57 // collection server containing the |ssl_info| associated with a
55 // connection to |hostname|. 58 // connection to |hostname|.
56 // 59 //
57 // SendReport actually sends the report over the network; callers are 60 // SendReport actually sends the report over the network; callers are
58 // responsible for enforcing any preconditions (such as obtaining user 61 // responsible for enforcing any preconditions (such as obtaining user
59 // opt-in, only sending reports for certain hostnames, checking for 62 // opt-in, only sending reports for certain hostnames, checking for
60 // incognito mode, etc.). 63 // incognito mode, etc.).
64 virtual void SendReport(ReportType type, const CertLoggerRequest& report);
Ryan Sleevi 2015/04/16 01:44:10 Virtuals + overloads = special place in hell when
61 virtual void SendReport(ReportType type, 65 virtual void SendReport(ReportType type,
62 const std::string& hostname, 66 const std::string& hostname,
63 const net::SSLInfo& ssl_info); 67 const net::SSLInfo& ssl_info);
64 68
65 // net::URLRequest::Delegate 69 // net::URLRequest::Delegate
66 void OnResponseStarted(net::URLRequest* request) override; 70 void OnResponseStarted(net::URLRequest* request) override;
67 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; 71 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
68 72
73 // Populate the CertLoggerRequest for a report.
Ryan Sleevi 2015/04/16 01:44:10 By making this public, this is beginning to violat
74 static void BuildReport(const std::string& hostname,
75 const net::SSLInfo& ssl_info,
76 CertLoggerRequest* out_request);
77 static void BuildReport(const std::string& hostname,
Ryan Sleevi 2015/04/16 01:44:10 ditto overloads again
78 const net::SSLInfo& ssl_info,
79 uint32 validation_result,
80 uint32 interstitial_reason,
81 ProceedDecision proceed_decision,
82 Overridable overridable,
83 CertLoggerRequest* out_request);
84
69 private: 85 private:
70 // Create a URLRequest with which to send a certificate report to the 86 // Create a URLRequest with which to send a certificate report to the
71 // server. 87 // server.
72 virtual scoped_ptr<net::URLRequest> CreateURLRequest( 88 virtual scoped_ptr<net::URLRequest> CreateURLRequest(
73 net::URLRequestContext* context); 89 net::URLRequestContext* context);
74 90
75 // Serialize and send a CertLoggerRequest protobuf to the report 91 // Serialize and send a CertLoggerRequest protobuf to the report
76 // collection server. 92 // collection server.
77 void SendCertLoggerRequest(const CertLoggerRequest& request); 93 void SendCertLoggerRequest(const CertLoggerRequest& request);
78 94
79 // Populate the CertLoggerRequest for a report.
80 static void BuildReport(const std::string& hostname,
81 const net::SSLInfo& ssl_info,
82 CertLoggerRequest* out_request);
83
84 // Performs post-report cleanup. 95 // Performs post-report cleanup.
85 void RequestComplete(net::URLRequest* request); 96 void RequestComplete(net::URLRequest* request);
86 97
87 net::URLRequestContext* const request_context_; 98 net::URLRequestContext* const request_context_;
88 const GURL upload_url_; 99 const GURL upload_url_;
89 100
90 // Owns the contained requests. 101 // Owns the contained requests.
91 std::set<net::URLRequest*> inflight_requests_; 102 std::set<net::URLRequest*> inflight_requests_;
92 103
93 CookiesPreference cookies_preference_; 104 CookiesPreference cookies_preference_;
94 105
95 DISALLOW_COPY_AND_ASSIGN(CertificateErrorReporter); 106 DISALLOW_COPY_AND_ASSIGN(CertificateErrorReporter);
96 }; 107 };
97 108
98 } // namespace chrome_browser_net 109 } // namespace chrome_browser_net
99 110
100 #endif // CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ 111 #endif // CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698