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

Side by Side Diff: chrome/browser/safe_browsing/ping_manager.h

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use SecurityInterstitialMetricsHelper for extended reporting events 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SAFE_BROWSING_PING_MANAGER_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_
7 7
8 // A class that reports safebrowsing statistics to Google's SafeBrowsing 8 // A class that reports safebrowsing statistics to Google's SafeBrowsing
9 // servers. 9 // servers.
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "chrome/browser/safe_browsing/protocol_manager_helper.h" 16 #include "chrome/browser/safe_browsing/protocol_manager_helper.h"
17 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 17 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
18 #include "net/url_request/url_fetcher_delegate.h" 18 #include "net/url_request/url_fetcher_delegate.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace chrome_browser_net {
22 class CertificateErrorReporter;
23 }
24
21 namespace net { 25 namespace net {
26 class SSLInfo;
22 class URLRequestContextGetter; 27 class URLRequestContextGetter;
23 } // namespace net 28 } // namespace net
24 29
25 30
26 class SafeBrowsingPingManager : public net::URLFetcherDelegate { 31 class SafeBrowsingPingManager : public net::URLFetcherDelegate {
27 public: 32 public:
28 ~SafeBrowsingPingManager() override; 33 ~SafeBrowsingPingManager() override;
29 34
30 // Create an instance of the safe browsing ping manager. 35 // Create an instance of the safe browsing ping manager.
31 static SafeBrowsingPingManager* Create( 36 static SafeBrowsingPingManager* Create(
(...skipping 10 matching lines...) Expand all
42 const GURL& page_url, 47 const GURL& page_url,
43 const GURL& referrer_url, 48 const GURL& referrer_url,
44 bool is_subresource, 49 bool is_subresource,
45 SBThreatType threat_type, 50 SBThreatType threat_type,
46 const std::string& post_data); 51 const std::string& post_data);
47 52
48 // Users can opt-in on the SafeBrowsing interstitial to send detailed 53 // Users can opt-in on the SafeBrowsing interstitial to send detailed
49 // malware reports. |report| is the serialized report. 54 // malware reports. |report| is the serialized report.
50 void ReportMalwareDetails(const std::string& report); 55 void ReportMalwareDetails(const std::string& report);
51 56
57 // Users can opt-in on the SSL interstitial to send reports of invalid
58 // certificate chains.
59 void ReportInvalidCertificateChain(const std::string& hostname,
60 const net::SSLInfo& ssl_info);
61
62 void SetCertificateErrorReporterForTesting(
63 chrome_browser_net::CertificateErrorReporter* certificate_error_reporter);
mattm 2015/03/23 05:31:17 should be passed as a scoped_ptr since it takes ow
estark 2015/03/23 16:42:13 Done.
64
52 private: 65 private:
53 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, 66 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest,
54 TestSafeBrowsingHitUrl); 67 TestSafeBrowsingHitUrl);
55 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, 68 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest,
56 TestMalwareDetailsUrl); 69 TestMalwareDetailsUrl);
57 70
58 typedef std::set<const net::URLFetcher*> Reports; 71 typedef std::set<const net::URLFetcher*> Reports;
59 72
60 // Constructs a SafeBrowsingPingManager that issues network requests 73 // Constructs a SafeBrowsingPingManager that issues network requests
61 // using |request_context_getter|. 74 // using |request_context_getter|.
(...skipping 19 matching lines...) Expand all
81 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 94 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
82 95
83 // URL prefix where browser reports hits to the safebrowsing list and 96 // URL prefix where browser reports hits to the safebrowsing list and
84 // sends detaild malware reports for UMA users. 97 // sends detaild malware reports for UMA users.
85 std::string url_prefix_; 98 std::string url_prefix_;
86 99
87 // Track outstanding SafeBrowsing report fetchers for clean up. 100 // Track outstanding SafeBrowsing report fetchers for clean up.
88 // We add both "hit" and "detail" fetchers in this set. 101 // We add both "hit" and "detail" fetchers in this set.
89 Reports safebrowsing_reports_; 102 Reports safebrowsing_reports_;
90 103
104 // Sends reports of invalid SSL certificate chains.
105 scoped_ptr<chrome_browser_net::CertificateErrorReporter>
106 certificate_error_reporter_;
107
91 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); 108 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager);
92 }; 109 };
93 110
94 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ 111 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698