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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/safe_browsing/download_protection_service.h" | 21 #include "chrome/browser/safe_browsing/download_protection_service.h" |
22 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb
ack.h" | 22 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb
ack.h" |
23 #include "chrome/browser/safe_browsing/incident_reporting/delayed_callback_runne
r.h" | 23 #include "chrome/browser/safe_browsing/incident_reporting/delayed_callback_runne
r.h" |
24 #include "chrome/browser/safe_browsing/incident_reporting/download_metadata_mana
ger.h" | 24 #include "chrome/browser/safe_browsing/incident_reporting/download_metadata_mana
ger.h" |
25 #include "chrome/browser/safe_browsing/incident_reporting/incident_report_upload
er.h" | 25 #include "chrome/browser/safe_browsing/incident_reporting/incident_report_upload
er.h" |
26 #include "chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
" | 26 #include "chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
" |
27 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
28 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
29 | 29 |
30 class Profile; | 30 class Profile; |
31 class SafeBrowsingDatabaseManager; | |
32 class SafeBrowsingService; | |
33 class TrackedPreferenceValidationDelegate; | 31 class TrackedPreferenceValidationDelegate; |
34 | 32 |
35 namespace base { | 33 namespace base { |
36 class TaskRunner; | 34 class TaskRunner; |
37 } | 35 } |
38 | 36 |
39 namespace content { | 37 namespace content { |
40 class DownloadManager; | 38 class DownloadManager; |
41 class NotificationDetails; | 39 class NotificationDetails; |
42 class NotificationSource; | 40 class NotificationSource; |
43 } | 41 } |
44 | 42 |
45 namespace net { | 43 namespace net { |
46 class URLRequestContextGetter; | 44 class URLRequestContextGetter; |
47 } | 45 } |
48 | 46 |
49 namespace safe_browsing { | 47 namespace safe_browsing { |
50 | 48 |
51 class ClientDownloadRequest; | 49 class ClientDownloadRequest; |
52 class ClientIncidentReport; | 50 class ClientIncidentReport; |
53 class ClientIncidentReport_DownloadDetails; | 51 class ClientIncidentReport_DownloadDetails; |
54 class ClientIncidentReport_EnvironmentData; | 52 class ClientIncidentReport_EnvironmentData; |
55 class ClientIncidentReport_ExtensionData; | 53 class ClientIncidentReport_ExtensionData; |
56 class ClientIncidentReport_IncidentData; | 54 class ClientIncidentReport_IncidentData; |
57 class Incident; | 55 class Incident; |
58 class IncidentReceiver; | 56 class IncidentReceiver; |
| 57 class SafeBrowsingDatabaseManager; |
| 58 class SafeBrowsingService; |
59 | 59 |
60 // A class that manages the collection of incidents and submission of incident | 60 // A class that manages the collection of incidents and submission of incident |
61 // reports to the safe browsing client-side detection service. The service | 61 // reports to the safe browsing client-side detection service. The service |
62 // begins operation when an incident is reported via the AddIncident method. | 62 // begins operation when an incident is reported via the AddIncident method. |
63 // Incidents reported from a profile that is loading are held until the profile | 63 // Incidents reported from a profile that is loading are held until the profile |
64 // is fully created. Incidents originating from profiles that do not participate | 64 // is fully created. Incidents originating from profiles that do not participate |
65 // in safe browsing are dropped. Process-wide incidents are affiliated with a | 65 // in safe browsing are dropped. Process-wide incidents are affiliated with a |
66 // profile that participates in safe browsing when one becomes available. | 66 // profile that participates in safe browsing when one becomes available. |
67 // Following the addition of an incident that is not dropped, the service | 67 // Following the addition of an incident that is not dropped, the service |
68 // collects environmental data, finds the most recent binary download, and waits | 68 // collects environmental data, finds the most recent binary download, and waits |
69 // a bit. Additional incidents that arrive during this time are collated with | 69 // a bit. Additional incidents that arrive during this time are collated with |
70 // the initial incident. Finally, already-reported incidents are pruned and any | 70 // the initial incident. Finally, already-reported incidents are pruned and any |
71 // remaining are uploaded in an incident report. | 71 // remaining are uploaded in an incident report. |
72 class IncidentReportingService : public content::NotificationObserver { | 72 class IncidentReportingService : public content::NotificationObserver { |
73 public: | 73 public: |
74 IncidentReportingService(SafeBrowsingService* safe_browsing_service, | 74 IncidentReportingService( |
75 const scoped_refptr<net::URLRequestContextGetter>& | 75 SafeBrowsingService* safe_browsing_service, |
76 request_context_getter); | 76 const scoped_refptr<net::URLRequestContextGetter>& |
| 77 request_context_getter); |
77 | 78 |
78 // All incident collection, data collection, and uploads in progress are | 79 // All incident collection, data collection, and uploads in progress are |
79 // dropped at destruction. | 80 // dropped at destruction. |
80 ~IncidentReportingService() override; | 81 ~IncidentReportingService() override; |
81 | 82 |
82 // Returns true if incident reporting is enabled for the given profile. | 83 // Returns true if incident reporting is enabled for the given profile. |
83 static bool IsEnabledForProfile(Profile* profile); | 84 static bool IsEnabledForProfile(Profile* profile); |
84 | 85 |
85 // Returns an object by which external components can add an incident to the | 86 // Returns an object by which external components can add an incident to the |
86 // service. The object may outlive the service, but will no longer have any | 87 // service. The object may outlive the service, but will no longer have any |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // that are posted during normal processing (e.g., environment collection, | 353 // that are posted during normal processing (e.g., environment collection, |
353 // safe browsing database checks, and report uploads). | 354 // safe browsing database checks, and report uploads). |
354 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; | 355 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; |
355 | 356 |
356 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); | 357 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); |
357 }; | 358 }; |
358 | 359 |
359 } // namespace safe_browsing | 360 } // namespace safe_browsing |
360 | 361 |
361 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ | 362 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ |
OLD | NEW |