OLD | NEW |
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 IOS_CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ | 5 #ifndef IOS_CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ |
6 #define IOS_CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ | 6 #define IOS_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 "ios/chrome/browser/safe_browsing/hit_report.h" | 17 #include "ios/chrome/browser/safe_browsing/hit_report.h" |
18 #include "ios/chrome/browser/safe_browsing/protocol_manager_helper.h" | 18 #include "ios/chrome/browser/safe_browsing/protocol_manager_helper.h" |
19 #include "ios/chrome/browser/safe_browsing/util.h" | 19 #include "ios/chrome/browser/safe_browsing/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, TestSafeBrowsingHitUrl); | 64 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestSafeBrowsingHitUrl); |
65 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl); | 65 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl); |
66 | 66 |
67 typedef std::set<const net::URLFetcher*> Reports; | 67 typedef std::set<const net::URLFetcher*> Reports; |
68 | 68 |
69 // Constructs a SafeBrowsingPingManager that issues network requests | 69 // Constructs a SafeBrowsingPingManager that issues network requests |
70 // using |request_context_getter|. | 70 // using |request_context_getter|. |
(...skipping 17 matching lines...) Expand all Loading... |
88 | 88 |
89 // URL prefix where browser reports hits to the safebrowsing list and | 89 // URL prefix where browser reports hits to the safebrowsing list and |
90 // sends detaild threat reports for UMA users. | 90 // sends detaild threat reports for UMA users. |
91 std::string url_prefix_; | 91 std::string url_prefix_; |
92 | 92 |
93 // Track outstanding SafeBrowsing report fetchers for clean up. | 93 // Track outstanding SafeBrowsing report fetchers for clean up. |
94 // We add both "hit" and "detail" fetchers in this set. | 94 // We add both "hit" and "detail" fetchers in this set. |
95 Reports safebrowsing_reports_; | 95 Reports safebrowsing_reports_; |
96 | 96 |
97 // Sends reports of invalid SSL certificate chains. | 97 // Sends reports of invalid SSL certificate chains. |
98 scoped_ptr<certificate_reporting::ErrorReporter> certificate_error_reporter_; | 98 std::unique_ptr<certificate_reporting::ErrorReporter> |
| 99 certificate_error_reporter_; |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); | 101 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); |
101 }; | 102 }; |
102 | 103 |
103 } // namespace safe_browsing | 104 } // namespace safe_browsing |
104 | 105 |
105 #endif // IOS_CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ | 106 #endif // IOS_CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ |
OLD | NEW |