OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_INCIDENT_REPORTING_INCIDENT_REPORTING_SERVI
CE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SERVI
CE_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SERVI
CE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SERVI
CE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // the initial incident. Finally, already-reported incidents are pruned and any | 64 // the initial incident. Finally, already-reported incidents are pruned and any |
65 // remaining are uploaded in an incident report. | 65 // remaining are uploaded in an incident report. |
66 class IncidentReportingService : public content::NotificationObserver { | 66 class IncidentReportingService : public content::NotificationObserver { |
67 public: | 67 public: |
68 IncidentReportingService(SafeBrowsingService* safe_browsing_service, | 68 IncidentReportingService(SafeBrowsingService* safe_browsing_service, |
69 const scoped_refptr<net::URLRequestContextGetter>& | 69 const scoped_refptr<net::URLRequestContextGetter>& |
70 request_context_getter); | 70 request_context_getter); |
71 | 71 |
72 // All incident collection, data collection, and uploads in progress are | 72 // All incident collection, data collection, and uploads in progress are |
73 // dropped at destruction. | 73 // dropped at destruction. |
74 virtual ~IncidentReportingService(); | 74 ~IncidentReportingService() override; |
75 | 75 |
76 // Returns a callback by which external components can add an incident to the | 76 // Returns a callback by which external components can add an incident to the |
77 // service on behalf of |profile|. The callback may outlive the service, but | 77 // service on behalf of |profile|. The callback may outlive the service, but |
78 // will no longer have any effect after the service is deleted. The callback | 78 // will no longer have any effect after the service is deleted. The callback |
79 // must not be run after |profile| has been destroyed. | 79 // must not be run after |profile| has been destroyed. |
80 AddIncidentCallback GetAddIncidentCallback(Profile* profile); | 80 AddIncidentCallback GetAddIncidentCallback(Profile* profile); |
81 | 81 |
82 // Returns a preference validation delegate that adds incidents to the service | 82 // Returns a preference validation delegate that adds incidents to the service |
83 // for validation failures in |profile|. The delegate may outlive the service, | 83 // for validation failures in |profile|. The delegate may outlive the service, |
84 // but incidents reported by it will no longer have any effect after the | 84 // but incidents reported by it will no longer have any effect after the |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // Performs processing for a report after succesfully receiving a response. | 227 // Performs processing for a report after succesfully receiving a response. |
228 void HandleResponse(const UploadContext& context); | 228 void HandleResponse(const UploadContext& context); |
229 | 229 |
230 // IncidentReportUploader::OnResultCallback implementation. | 230 // IncidentReportUploader::OnResultCallback implementation. |
231 void OnReportUploadResult(UploadContext* context, | 231 void OnReportUploadResult(UploadContext* context, |
232 IncidentReportUploader::Result result, | 232 IncidentReportUploader::Result result, |
233 scoped_ptr<ClientIncidentResponse> response); | 233 scoped_ptr<ClientIncidentResponse> response); |
234 | 234 |
235 // content::NotificationObserver methods. | 235 // content::NotificationObserver methods. |
236 virtual void Observe(int type, | 236 void Observe(int type, |
237 const content::NotificationSource& source, | 237 const content::NotificationSource& source, |
238 const content::NotificationDetails& details) override; | 238 const content::NotificationDetails& details) override; |
239 | 239 |
240 base::ThreadChecker thread_checker_; | 240 base::ThreadChecker thread_checker_; |
241 | 241 |
242 // The safe browsing database manager, through which the whitelist killswitch | 242 // The safe browsing database manager, through which the whitelist killswitch |
243 // is checked. | 243 // is checked. |
244 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; | 244 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; |
245 | 245 |
246 // Accessor for an URL context with which reports will be sent. | 246 // Accessor for an URL context with which reports will be sent. |
247 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 247 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
248 | 248 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // that are posted during normal processing (e.g., environment collection, | 310 // that are posted during normal processing (e.g., environment collection, |
311 // safe browsing database checks, and report uploads). | 311 // safe browsing database checks, and report uploads). |
312 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; | 312 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; |
313 | 313 |
314 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); | 314 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); |
315 }; | 315 }; |
316 | 316 |
317 } // namespace safe_browsing | 317 } // namespace safe_browsing |
318 | 318 |
319 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ | 319 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ |
OLD | NEW |