| OLD | NEW |
| 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 <memory> |
| 10 #include <set> | 11 #include <set> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "chrome/browser/safe_browsing/protocol_manager_helper.h" | 17 #include "chrome/browser/safe_browsing/protocol_manager_helper.h" |
| 18 #include "components/safe_browsing_db/hit_report.h" | 18 #include "components/safe_browsing_db/hit_report.h" |
| 19 #include "components/safe_browsing_db/util.h" | 19 #include "components/safe_browsing_db/util.h" |
| 20 #include "net/url_request/url_fetcher_delegate.h" | 20 #include "net/url_request/url_fetcher_delegate.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace certificate_reporting { | 23 namespace certificate_reporting { |
| 24 class ErrorReporter; | 24 class ErrorReporter; |
| 25 } | 25 } |
| 26 | 26 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 50 | 50 |
| 51 // Users can opt-in on the SafeBrowsing interstitial to send detailed | 51 // Users can opt-in on the SafeBrowsing interstitial to send detailed |
| 52 // threat reports. |report| is the serialized report. | 52 // threat reports. |report| is the serialized report. |
| 53 void ReportThreatDetails(const std::string& report); | 53 void ReportThreatDetails(const std::string& report); |
| 54 | 54 |
| 55 // Users can opt-in on the SSL interstitial to send reports of invalid | 55 // Users can opt-in on the SSL interstitial to send reports of invalid |
| 56 // certificate chains. | 56 // certificate chains. |
| 57 void ReportInvalidCertificateChain(const std::string& serialized_report); | 57 void ReportInvalidCertificateChain(const std::string& serialized_report); |
| 58 | 58 |
| 59 void SetCertificateErrorReporterForTesting( | 59 void SetCertificateErrorReporterForTesting( |
| 60 scoped_ptr<certificate_reporting::ErrorReporter> | 60 std::unique_ptr<certificate_reporting::ErrorReporter> |
| 61 certificate_error_reporter); | 61 certificate_error_reporter); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, | 64 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, |
| 65 TestSafeBrowsingHitUrl); | 65 TestSafeBrowsingHitUrl); |
| 66 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl); | 66 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl); |
| 67 | 67 |
| 68 typedef std::set<const net::URLFetcher*> Reports; | 68 typedef std::set<const net::URLFetcher*> Reports; |
| 69 | 69 |
| 70 // Constructs a SafeBrowsingPingManager that issues network requests | 70 // Constructs a SafeBrowsingPingManager that issues network requests |
| (...skipping 19 matching lines...) Expand all Loading... |
| 90 | 90 |
| 91 // URL prefix where browser reports hits to the safebrowsing list and | 91 // URL prefix where browser reports hits to the safebrowsing list and |
| 92 // sends detaild threat reports for UMA users. | 92 // sends detaild threat reports for UMA users. |
| 93 std::string url_prefix_; | 93 std::string url_prefix_; |
| 94 | 94 |
| 95 // Track outstanding SafeBrowsing report fetchers for clean up. | 95 // Track outstanding SafeBrowsing report fetchers for clean up. |
| 96 // We add both "hit" and "detail" fetchers in this set. | 96 // We add both "hit" and "detail" fetchers in this set. |
| 97 Reports safebrowsing_reports_; | 97 Reports safebrowsing_reports_; |
| 98 | 98 |
| 99 // Sends reports of invalid SSL certificate chains. | 99 // Sends reports of invalid SSL certificate chains. |
| 100 scoped_ptr<certificate_reporting::ErrorReporter> certificate_error_reporter_; | 100 std::unique_ptr<certificate_reporting::ErrorReporter> |
| 101 certificate_error_reporter_; |
| 101 | 102 |
| 102 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); | 103 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 } // namespace safe_browsing | 106 } // namespace safe_browsing |
| 106 | 107 |
| 107 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ | 108 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ |
| OLD | NEW |