| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 public: | 71 public: |
| 72 IncidentReportingService(SafeBrowsingService* safe_browsing_service, | 72 IncidentReportingService(SafeBrowsingService* safe_browsing_service, |
| 73 const scoped_refptr<net::URLRequestContextGetter>& | 73 const scoped_refptr<net::URLRequestContextGetter>& |
| 74 request_context_getter); | 74 request_context_getter); |
| 75 | 75 |
| 76 // All incident collection, data collection, and uploads in progress are | 76 // All incident collection, data collection, and uploads in progress are |
| 77 // dropped at destruction. | 77 // dropped at destruction. |
| 78 ~IncidentReportingService() override; | 78 ~IncidentReportingService() override; |
| 79 | 79 |
| 80 // Returns a callback by which external components can add an incident to the | 80 // Returns a callback by which external components can add an incident to the |
| 81 // service on behalf of |profile|. The callback may outlive the service, but | 81 // service. The callback may outlive the service, but will no longer have any |
| 82 // will no longer have any effect after the service is deleted. The callback | 82 // effect after the service is deleted. |
| 83 // must not be run after |profile| has been destroyed. | 83 AddIncidentCallback GetAddIncidentCallback(); |
| 84 AddIncidentCallback GetAddIncidentCallback(Profile* profile); | |
| 85 | 84 |
| 86 // Returns a preference validation delegate that adds incidents to the service | 85 // Returns a preference validation delegate that adds incidents to the service |
| 87 // for validation failures in |profile|. The delegate may outlive the service, | 86 // for validation failures in |profile|. The delegate may outlive the service, |
| 88 // but incidents reported by it will no longer have any effect after the | 87 // but incidents reported by it will no longer have any effect after the |
| 89 // service is deleted. The lifetime of the delegate should not extend beyond | 88 // service is deleted. |
| 90 // that of the profile it services. | |
| 91 scoped_ptr<TrackedPreferenceValidationDelegate> | 89 scoped_ptr<TrackedPreferenceValidationDelegate> |
| 92 CreatePreferenceValidationDelegate(Profile* profile); | 90 CreatePreferenceValidationDelegate(Profile* profile); |
| 93 | 91 |
| 94 // Registers |callback| to be run after some delay following process launch. | 92 // Registers |callback| to be run after some delay following process launch. |
| 95 void RegisterDelayedAnalysisCallback(const DelayedAnalysisCallback& callback); | 93 void RegisterDelayedAnalysisCallback(const DelayedAnalysisCallback& callback); |
| 96 | 94 |
| 97 // Adds |download_manager| to the set monitored for client download request | 95 // Adds |download_manager| to the set monitored for client download request |
| 98 // storage. | 96 // storage. |
| 99 void AddDownloadManager(content::DownloadManager* download_manager); | 97 void AddDownloadManager(content::DownloadManager* download_manager); |
| 100 | 98 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 ProfileContext* GetProfileContext(Profile* profile); | 152 ProfileContext* GetProfileContext(Profile* profile); |
| 155 | 153 |
| 156 // Handles the destruction of a profile. Incidents reported for the profile | 154 // Handles the destruction of a profile. Incidents reported for the profile |
| 157 // but not yet uploaded are dropped. | 155 // but not yet uploaded are dropped. |
| 158 void OnProfileDestroyed(Profile* profile); | 156 void OnProfileDestroyed(Profile* profile); |
| 159 | 157 |
| 160 // Returns an initialized profile that participates in safe browsing. Profiles | 158 // Returns an initialized profile that participates in safe browsing. Profiles |
| 161 // participating in extended safe browsing are preferred. | 159 // participating in extended safe browsing are preferred. |
| 162 Profile* FindEligibleProfile() const; | 160 Profile* FindEligibleProfile() const; |
| 163 | 161 |
| 164 // Adds |incident_data| to the service. The incident_time_msec field is | 162 // Adds |incident_data| relating to the optional |profile| to the service. |
| 165 // populated with the current time if the caller has not already done so. | |
| 166 void AddIncident(Profile* profile, scoped_ptr<Incident> incident); | 163 void AddIncident(Profile* profile, scoped_ptr<Incident> incident); |
| 167 | 164 |
| 168 // Begins processing a report. If processing is already underway, ensures that | 165 // Begins processing a report. If processing is already underway, ensures that |
| 169 // collection tasks have completed or are running. | 166 // collection tasks have completed or are running. |
| 170 void BeginReportProcessing(); | 167 void BeginReportProcessing(); |
| 171 | 168 |
| 172 // Begins the process of collating incidents by waiting for incidents to | 169 // Begins the process of collating incidents by waiting for incidents to |
| 173 // arrive. This function is idempotent. | 170 // arrive. This function is idempotent. |
| 174 void BeginIncidentCollation(); | 171 void BeginIncidentCollation(); |
| 175 | 172 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // that are posted during normal processing (e.g., environment collection, | 325 // that are posted during normal processing (e.g., environment collection, |
| 329 // safe browsing database checks, and report uploads). | 326 // safe browsing database checks, and report uploads). |
| 330 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; | 327 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; |
| 331 | 328 |
| 332 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); | 329 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); |
| 333 }; | 330 }; |
| 334 | 331 |
| 335 } // namespace safe_browsing | 332 } // namespace safe_browsing |
| 336 | 333 |
| 337 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ | 334 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ |
| OLD | NEW |