| 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 <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "chrome/browser/permissions/permission_request.h" | |
| 18 #include "chrome/browser/permissions/permission_uma_util.h" | 17 #include "chrome/browser/permissions/permission_uma_util.h" |
| 19 #include "chrome/browser/safe_browsing/protocol_manager_helper.h" | 18 #include "chrome/browser/safe_browsing/protocol_manager_helper.h" |
| 20 #include "components/safe_browsing_db/hit_report.h" | 19 #include "components/safe_browsing_db/hit_report.h" |
| 21 #include "components/safe_browsing_db/util.h" | 20 #include "components/safe_browsing_db/util.h" |
| 22 #include "content/public/browser/permission_type.h" | 21 #include "content/public/browser/permission_type.h" |
| 23 #include "net/url_request/url_fetcher_delegate.h" | 22 #include "net/url_request/url_fetcher_delegate.h" |
| 24 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 25 | 24 |
| 26 namespace certificate_reporting { | 25 namespace certificate_reporting { |
| 27 class ErrorReporter; | 26 class ErrorReporter; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 58 |
| 60 // Users can opt-in on the SSL interstitial to send reports of invalid | 59 // Users can opt-in on the SSL interstitial to send reports of invalid |
| 61 // certificate chains. | 60 // certificate chains. |
| 62 void ReportInvalidCertificateChain(const std::string& serialized_report); | 61 void ReportInvalidCertificateChain(const std::string& serialized_report); |
| 63 | 62 |
| 64 void SetCertificateErrorReporterForTesting( | 63 void SetCertificateErrorReporterForTesting( |
| 65 std::unique_ptr<certificate_reporting::ErrorReporter> | 64 std::unique_ptr<certificate_reporting::ErrorReporter> |
| 66 certificate_error_reporter); | 65 certificate_error_reporter); |
| 67 | 66 |
| 68 // Report permission action to SafeBrowsing servers. | 67 // Report permission action to SafeBrowsing servers. |
| 69 void ReportPermissionAction(const GURL& origin, | 68 void ReportPermissionAction(const PermissionReportInfo& report_info); |
| 70 content::PermissionType permission, | |
| 71 PermissionAction action, | |
| 72 PermissionSourceUI source_ui, | |
| 73 PermissionRequestGestureType gesture_type, | |
| 74 int num_prior_dismissals, | |
| 75 int num_prior_ignores); | |
| 76 | 69 |
| 77 private: | 70 private: |
| 78 friend class PermissionReporterBrowserTest; | 71 friend class PermissionReporterBrowserTest; |
| 79 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, | 72 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, |
| 80 TestSafeBrowsingHitUrl); | 73 TestSafeBrowsingHitUrl); |
| 81 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl); | 74 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl); |
| 82 | 75 |
| 83 typedef std::set<const net::URLFetcher*> Reports; | 76 typedef std::set<const net::URLFetcher*> Reports; |
| 84 | 77 |
| 85 // Constructs a SafeBrowsingPingManager that issues network requests | 78 // Constructs a SafeBrowsingPingManager that issues network requests |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 110 |
| 118 // Sends reports of permission actions. | 111 // Sends reports of permission actions. |
| 119 std::unique_ptr<PermissionReporter> permission_reporter_; | 112 std::unique_ptr<PermissionReporter> permission_reporter_; |
| 120 | 113 |
| 121 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); | 114 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); |
| 122 }; | 115 }; |
| 123 | 116 |
| 124 } // namespace safe_browsing | 117 } // namespace safe_browsing |
| 125 | 118 |
| 126 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ | 119 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ |
| OLD | NEW |