| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui_manager.h" | 5 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 profile && | 243 profile && |
| 244 profile->GetPrefs()->GetBoolean( | 244 profile->GetPrefs()->GetBoolean( |
| 245 prefs::kSafeBrowsingExtendedReportingEnabled); | 245 prefs::kSafeBrowsingExtendedReportingEnabled); |
| 246 hit_report.is_metrics_reporting_active = | 246 hit_report.is_metrics_reporting_active = |
| 247 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(); | 247 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(); |
| 248 | 248 |
| 249 MaybeReportSafeBrowsingHit(hit_report); | 249 MaybeReportSafeBrowsingHit(hit_report); |
| 250 } | 250 } |
| 251 | 251 |
| 252 if (resource.threat_type != SB_THREAT_TYPE_SAFE) { | 252 if (resource.threat_type != SB_THREAT_TYPE_SAFE) { |
| 253 FOR_EACH_OBSERVER(Observer, observer_list_, OnSafeBrowsingHit(resource)); | 253 for (Observer& observer : observer_list_) |
| 254 observer.OnSafeBrowsingHit(resource); |
| 254 } | 255 } |
| 255 AddToWhitelistUrlSet(resource, true /* A decision is now pending */); | 256 AddToWhitelistUrlSet(resource, true /* A decision is now pending */); |
| 256 SafeBrowsingBlockingPage::ShowBlockingPage(this, resource); | 257 SafeBrowsingBlockingPage::ShowBlockingPage(this, resource); |
| 257 } | 258 } |
| 258 | 259 |
| 259 // A safebrowsing hit is sent after a blocking page for malware/phishing | 260 // A safebrowsing hit is sent after a blocking page for malware/phishing |
| 260 // or after the warning dialog for download urls, only for | 261 // or after the warning dialog for download urls, only for |
| 261 // UMA || extended_reporting users. | 262 // UMA || extended_reporting users. |
| 262 void SafeBrowsingUIManager::MaybeReportSafeBrowsingHit( | 263 void SafeBrowsingUIManager::MaybeReportSafeBrowsingHit( |
| 263 const HitReport& hit_report) { | 264 const HitReport& hit_report) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 428 |
| 428 bool whitelisted = site_list->Contains(lookup_url); | 429 bool whitelisted = site_list->Contains(lookup_url); |
| 429 if (whitelist_only) { | 430 if (whitelist_only) { |
| 430 return whitelisted; | 431 return whitelisted; |
| 431 } else { | 432 } else { |
| 432 return whitelisted || site_list->ContainsPending(lookup_url); | 433 return whitelisted || site_list->ContainsPending(lookup_url); |
| 433 } | 434 } |
| 434 } | 435 } |
| 435 | 436 |
| 436 } // namespace safe_browsing | 437 } // namespace safe_browsing |
| OLD | NEW |