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

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

Issue 2047253002: Add hooks to permission layer for permission action reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-reporter-implementation
Patch Set: Add guard to permission reporting Created 4 years, 6 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 <memory> 10 #include <memory>
(...skipping 13 matching lines...) Expand all
24 class ErrorReporter; 24 class ErrorReporter;
25 } 25 }
26 26
27 namespace net { 27 namespace net {
28 class SSLInfo; 28 class SSLInfo;
29 class URLRequestContextGetter; 29 class URLRequestContextGetter;
30 } // namespace net 30 } // namespace net
31 31
32 namespace safe_browsing { 32 namespace safe_browsing {
33 33
34 class PermissionReporter;
35
34 class SafeBrowsingPingManager : public net::URLFetcherDelegate { 36 class SafeBrowsingPingManager : public net::URLFetcherDelegate {
35 public: 37 public:
36 ~SafeBrowsingPingManager() override; 38 ~SafeBrowsingPingManager() override;
37 39
38 // Create an instance of the safe browsing ping manager. 40 // Create an instance of the safe browsing ping manager.
39 static SafeBrowsingPingManager* Create( 41 static SafeBrowsingPingManager* Create(
40 net::URLRequestContextGetter* request_context_getter, 42 net::URLRequestContextGetter* request_context_getter,
41 const SafeBrowsingProtocolConfig& config); 43 const SafeBrowsingProtocolConfig& config);
42 44
43 // net::URLFetcherDelegate interface. 45 // net::URLFetcherDelegate interface.
44 void OnURLFetchComplete(const net::URLFetcher* source) override; 46 void OnURLFetchComplete(const net::URLFetcher* source) override;
45 47
46 // Report to Google when a SafeBrowsing warning is shown to the user. 48 // Report to Google when a SafeBrowsing warning is shown to the user.
47 // |hit_report.threat_type| should be one of the types known by 49 // |hit_report.threat_type| should be one of the types known by
48 // SafeBrowsingtHitUrl. 50 // SafeBrowsingtHitUrl.
49 void ReportSafeBrowsingHit(const safe_browsing::HitReport& hit_report); 51 void ReportSafeBrowsingHit(const safe_browsing::HitReport& hit_report);
50 52
51 // Users can opt-in on the SafeBrowsing interstitial to send detailed 53 // Users can opt-in on the SafeBrowsing interstitial to send detailed
52 // threat reports. |report| is the serialized report. 54 // threat reports. |report| is the serialized report.
53 void ReportThreatDetails(const std::string& report); 55 void ReportThreatDetails(const std::string& report);
54 56
55 // Users can opt-in on the SSL interstitial to send reports of invalid 57 // Users can opt-in on the SSL interstitial to send reports of invalid
56 // certificate chains. 58 // certificate chains.
57 void ReportInvalidCertificateChain(const std::string& serialized_report); 59 void ReportInvalidCertificateChain(const std::string& serialized_report);
58 60
59 void SetCertificateErrorReporterForTesting( 61 void SetCertificateErrorReporterForTesting(
60 std::unique_ptr<certificate_reporting::ErrorReporter> 62 std::unique_ptr<certificate_reporting::ErrorReporter>
61 certificate_error_reporter); 63 certificate_error_reporter);
62 64
65 PermissionReporter* permission_reporter();
raymes 2016/06/14 02:47:11 Do you think we should have a Send function here,
stefanocs 2016/06/14 03:37:37 Should we remove the ReportPermissionAction functi
raymes 2016/06/14 03:58:16 That seems good since the function will be so smal
66
63 private: 67 private:
64 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, 68 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest,
65 TestSafeBrowsingHitUrl); 69 TestSafeBrowsingHitUrl);
66 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl); 70 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl);
67 71
68 typedef std::set<const net::URLFetcher*> Reports; 72 typedef std::set<const net::URLFetcher*> Reports;
69 73
70 // Constructs a SafeBrowsingPingManager that issues network requests 74 // Constructs a SafeBrowsingPingManager that issues network requests
71 // using |request_context_getter|. 75 // using |request_context_getter|.
72 SafeBrowsingPingManager( 76 SafeBrowsingPingManager(
(...skipping 20 matching lines...) Expand all
93 std::string url_prefix_; 97 std::string url_prefix_;
94 98
95 // Track outstanding SafeBrowsing report fetchers for clean up. 99 // Track outstanding SafeBrowsing report fetchers for clean up.
96 // We add both "hit" and "detail" fetchers in this set. 100 // We add both "hit" and "detail" fetchers in this set.
97 Reports safebrowsing_reports_; 101 Reports safebrowsing_reports_;
98 102
99 // Sends reports of invalid SSL certificate chains. 103 // Sends reports of invalid SSL certificate chains.
100 std::unique_ptr<certificate_reporting::ErrorReporter> 104 std::unique_ptr<certificate_reporting::ErrorReporter>
101 certificate_error_reporter_; 105 certificate_error_reporter_;
102 106
107 // Sends reports of permission actions.
108 std::unique_ptr<PermissionReporter> permission_reporter_;
109
103 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); 110 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager);
104 }; 111 };
105 112
106 } // namespace safe_browsing 113 } // namespace safe_browsing
107 114
108 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ 115 #endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698