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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 const ClientIncidentReport& report); | 154 const ClientIncidentReport& report); |
155 | 155 |
156 // Returns true if a report is currently being processed. | 156 // Returns true if a report is currently being processed. |
157 bool IsProcessingReport() const; | 157 bool IsProcessingReport() const; |
158 | 158 |
159 private: | 159 private: |
160 struct ProfileContext; | 160 struct ProfileContext; |
161 class UploadContext; | 161 class UploadContext; |
162 class Receiver; | 162 class Receiver; |
163 | 163 |
164 // A mapping of profiles to contexts holding state about received incidents. | |
165 typedef std::map<Profile*, ProfileContext*> ProfileContextCollection; | |
166 | |
167 // Returns the context for |profile|, creating it if it does not exist. | 164 // Returns the context for |profile|, creating it if it does not exist. |
168 ProfileContext* GetOrCreateProfileContext(Profile* profile); | 165 ProfileContext* GetOrCreateProfileContext(Profile* profile); |
169 | 166 |
170 // Returns the context for |profile|, or NULL if it is unknown. | 167 // Returns the context for |profile|, or NULL if it is unknown. |
171 ProfileContext* GetProfileContext(Profile* profile); | 168 ProfileContext* GetProfileContext(Profile* profile); |
172 | 169 |
173 // Handles the destruction of a profile. Incidents reported for the profile | 170 // Handles the destruction of a profile. Incidents reported for the profile |
174 // but not yet uploaded are dropped. | 171 // but not yet uploaded are dropped. |
175 void OnProfileDestroyed(Profile* profile); | 172 void OnProfileDestroyed(Profile* profile); |
176 | 173 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // The time at which the last incident is reported. | 323 // The time at which the last incident is reported. |
327 base::TimeTicks last_incident_time_; | 324 base::TimeTicks last_incident_time_; |
328 | 325 |
329 // The time at which environmental data collection was initiated. | 326 // The time at which environmental data collection was initiated. |
330 base::TimeTicks environment_collection_begin_; | 327 base::TimeTicks environment_collection_begin_; |
331 | 328 |
332 // The time at which download collection was initiated. | 329 // The time at which download collection was initiated. |
333 base::TimeTicks last_download_begin_; | 330 base::TimeTicks last_download_begin_; |
334 | 331 |
335 // Context data for all on-the-record profiles plus the process-wide (NULL) | 332 // Context data for all on-the-record profiles plus the process-wide (NULL) |
336 // context. | 333 // context. A mapping of profiles to contexts holding state about received |
337 ProfileContextCollection profiles_; | 334 // incidents. |
| 335 std::map<Profile*, std::unique_ptr<ProfileContext>> profiles_; |
338 | 336 |
339 // Callbacks registered for performing delayed analysis. | 337 // Callbacks registered for performing delayed analysis. |
340 DelayedCallbackRunner delayed_analysis_callbacks_; | 338 DelayedCallbackRunner delayed_analysis_callbacks_; |
341 | 339 |
342 // Callbacks registered for performing delayed analysis that should only | 340 // Callbacks registered for performing delayed analysis that should only |
343 // be executed for safebrowsing extended reporting users. | 341 // be executed for safebrowsing extended reporting users. |
344 DelayedCallbackRunner extended_reporting_only_delayed_analysis_callbacks_; | 342 DelayedCallbackRunner extended_reporting_only_delayed_analysis_callbacks_; |
345 | 343 |
346 DownloadMetadataManager download_metadata_manager_; | 344 DownloadMetadataManager download_metadata_manager_; |
347 | 345 |
(...skipping 15 matching lines...) Expand all Loading... |
363 // that are posted during normal processing (e.g., environment collection, | 361 // that are posted during normal processing (e.g., environment collection, |
364 // safe browsing database checks, and report uploads). | 362 // safe browsing database checks, and report uploads). |
365 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; | 363 base::WeakPtrFactory<IncidentReportingService> weak_ptr_factory_; |
366 | 364 |
367 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); | 365 DISALLOW_COPY_AND_ASSIGN(IncidentReportingService); |
368 }; | 366 }; |
369 | 367 |
370 } // namespace safe_browsing | 368 } // namespace safe_browsing |
371 | 369 |
372 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ | 370 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_REPORTING_SE
RVICE_H_ |
OLD | NEW |