| 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 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser
      vice.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser
      vice.h" | 
| 6 | 6 | 
| 7 #include <math.h> | 7 #include <math.h> | 
|  | 8 #include <stddef.h> | 
| 8 | 9 | 
| 9 #include <algorithm> | 10 #include <algorithm> | 
| 10 #include <vector> | 11 #include <vector> | 
| 11 | 12 | 
|  | 13 #include "base/macros.h" | 
| 12 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" | 
| 13 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" | 
| 14 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" | 
| 15 #include "base/process/process_info.h" | 17 #include "base/process/process_info.h" | 
| 16 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" | 
| 17 #include "base/stl_util.h" | 19 #include "base/stl_util.h" | 
| 18 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" | 
| 19 #include "base/thread_task_runner_handle.h" | 21 #include "base/thread_task_runner_handle.h" | 
| 20 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" | 
|  | 23 #include "build/build_config.h" | 
| 21 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" | 
| 22 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 25 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 
| 23 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" | 
| 24 #include "chrome/browser/safe_browsing/database_manager.h" | 27 #include "chrome/browser/safe_browsing/database_manager.h" | 
| 25 #include "chrome/browser/safe_browsing/incident_reporting/environment_data_colle
      ction.h" | 28 #include "chrome/browser/safe_browsing/incident_reporting/environment_data_colle
      ction.h" | 
| 26 #include "chrome/browser/safe_browsing/incident_reporting/extension_data_collect
      ion.h" | 29 #include "chrome/browser/safe_browsing/incident_reporting/extension_data_collect
      ion.h" | 
| 27 #include "chrome/browser/safe_browsing/incident_reporting/incident.h" | 30 #include "chrome/browser/safe_browsing/incident_reporting/incident.h" | 
| 28 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" | 31 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" | 
| 29 #include "chrome/browser/safe_browsing/incident_reporting/incident_report_upload
      er_impl.h" | 32 #include "chrome/browser/safe_browsing/incident_reporting/incident_report_upload
      er_impl.h" | 
| 30 #include "chrome/browser/safe_browsing/incident_reporting/preference_validation_
      delegate.h" | 33 #include "chrome/browser/safe_browsing/incident_reporting/preference_validation_
      delegate.h" | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 60   IncidentType type; | 63   IncidentType type; | 
| 61 | 64 | 
| 62   // The key for a specific instance of an incident. | 65   // The key for a specific instance of an incident. | 
| 63   std::string key; | 66   std::string key; | 
| 64 | 67 | 
| 65   // A hash digest representing a specific instance of an incident. | 68   // A hash digest representing a specific instance of an incident. | 
| 66   uint32_t digest; | 69   uint32_t digest; | 
| 67 }; | 70 }; | 
| 68 | 71 | 
| 69 // The amount of time the service will wait to collate incidents. | 72 // The amount of time the service will wait to collate incidents. | 
| 70 const int64 kDefaultUploadDelayMs = 1000 * 60;  // one minute | 73 const int64_t kDefaultUploadDelayMs = 1000 * 60;  // one minute | 
| 71 | 74 | 
| 72 // The amount of time between running delayed analysis callbacks. | 75 // The amount of time between running delayed analysis callbacks. | 
| 73 const int64 kDefaultCallbackIntervalMs = 1000 * 20; | 76 const int64_t kDefaultCallbackIntervalMs = 1000 * 20; | 
| 74 | 77 | 
| 75 // Logs the type of incident in |incident_data| to a user metrics histogram. | 78 // Logs the type of incident in |incident_data| to a user metrics histogram. | 
| 76 void LogIncidentDataType(IncidentDisposition disposition, | 79 void LogIncidentDataType(IncidentDisposition disposition, | 
| 77                          const Incident& incident) { | 80                          const Incident& incident) { | 
| 78   static const char* const kHistogramNames[] = { | 81   static const char* const kHistogramNames[] = { | 
| 79       "SBIRS.ReceivedIncident", | 82       "SBIRS.ReceivedIncident", | 
| 80       "SBIRS.DroppedIncident", | 83       "SBIRS.DroppedIncident", | 
| 81       "SBIRS.Incident", | 84       "SBIRS.Incident", | 
| 82       "SBIRS.PrunedIncident", | 85       "SBIRS.PrunedIncident", | 
| 83       "SBIRS.DiscardedIncident", | 86       "SBIRS.DiscardedIncident", | 
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1071       if (!profile->IsOffTheRecord()) | 1074       if (!profile->IsOffTheRecord()) | 
| 1072         OnProfileDestroyed(profile); | 1075         OnProfileDestroyed(profile); | 
| 1073       break; | 1076       break; | 
| 1074     } | 1077     } | 
| 1075     default: | 1078     default: | 
| 1076       break; | 1079       break; | 
| 1077   } | 1080   } | 
| 1078 } | 1081 } | 
| 1079 | 1082 | 
| 1080 }  // namespace safe_browsing | 1083 }  // namespace safe_browsing | 
| OLD | NEW | 
|---|