| 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 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled); | 391 profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled); |
| 392 | 392 |
| 393 // Start processing delayed analysis callbacks if this new profile | 393 // Start processing delayed analysis callbacks if this new profile |
| 394 // participates in safe browsing. Start is idempotent, so this is safe even if | 394 // participates in safe browsing. Start is idempotent, so this is safe even if |
| 395 // they're already running. | 395 // they're already running. |
| 396 if (safe_browsing_enabled) | 396 if (safe_browsing_enabled) |
| 397 delayed_analysis_callbacks_.Start(); | 397 delayed_analysis_callbacks_.Start(); |
| 398 | 398 |
| 399 // Start a new report if this profile participates in safe browsing and there | 399 // Start a new report if this profile participates in safe browsing and there |
| 400 // are process-wide incidents. | 400 // are process-wide incidents. |
| 401 if (safe_browsing_enabled && GetProfileContext(NULL)) | 401 if (safe_browsing_enabled && GetProfileContext(NULL) && |
| 402 GetProfileContext(NULL)->incidents.size()) { |
| 402 BeginReportProcessing(); | 403 BeginReportProcessing(); |
| 404 } |
| 403 | 405 |
| 404 // TODO(grt): register for pref change notifications to start delayed analysis | 406 // TODO(grt): register for pref change notifications to start delayed analysis |
| 405 // and/or report processing if sb is currently disabled but subsequently | 407 // and/or report processing if sb is currently disabled but subsequently |
| 406 // enabled. | 408 // enabled. |
| 407 | 409 |
| 408 // Nothing else to do if a report is not being assembled. | 410 // Nothing else to do if a report is not being assembled. |
| 409 if (!report_) | 411 if (!report_) |
| 410 return; | 412 return; |
| 411 | 413 |
| 412 // Drop all incidents associated with this profile that were received prior to | 414 // Drop all incidents associated with this profile that were received prior to |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 if (!profile->IsOffTheRecord()) | 957 if (!profile->IsOffTheRecord()) |
| 956 OnProfileDestroyed(profile); | 958 OnProfileDestroyed(profile); |
| 957 break; | 959 break; |
| 958 } | 960 } |
| 959 default: | 961 default: |
| 960 break; | 962 break; |
| 961 } | 963 } |
| 962 } | 964 } |
| 963 | 965 |
| 964 } // namespace safe_browsing | 966 } // namespace safe_browsing |
| OLD | NEW |