| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 SafeBrowsingBlockingPage::ShowBlockingPage(this, resource); | 237 SafeBrowsingBlockingPage::ShowBlockingPage(this, resource); |
| 238 } | 238 } |
| 239 | 239 |
| 240 // A safebrowsing hit is sent after a blocking page for malware/phishing | 240 // A safebrowsing hit is sent after a blocking page for malware/phishing |
| 241 // or after the warning dialog for download urls, only for | 241 // or after the warning dialog for download urls, only for |
| 242 // UMA || extended_reporting users. | 242 // UMA || extended_reporting users. |
| 243 void SafeBrowsingUIManager::MaybeReportSafeBrowsingHit( | 243 void SafeBrowsingUIManager::MaybeReportSafeBrowsingHit( |
| 244 const HitReport& hit_report) { | 244 const HitReport& hit_report) { |
| 245 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 245 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 246 | 246 |
| 247 // Decide if we should send this report. | 247 // Send report if user opted-in extended reporting. |
| 248 if (hit_report.is_metrics_reporting_active || | 248 if (hit_report.is_extended_reporting) { |
| 249 hit_report.is_extended_reporting) { | |
| 250 BrowserThread::PostTask( | 249 BrowserThread::PostTask( |
| 251 BrowserThread::IO, FROM_HERE, | 250 BrowserThread::IO, FROM_HERE, |
| 252 base::Bind(&SafeBrowsingUIManager::ReportSafeBrowsingHitOnIOThread, | 251 base::Bind(&SafeBrowsingUIManager::ReportSafeBrowsingHitOnIOThread, |
| 253 this, hit_report)); | 252 this, hit_report)); |
| 254 } | 253 } |
| 255 } | 254 } |
| 256 | 255 |
| 257 void SafeBrowsingUIManager::ReportSafeBrowsingHitOnIOThread( | 256 void SafeBrowsingUIManager::ReportSafeBrowsingHitOnIOThread( |
| 258 const HitReport& hit_report) { | 257 const HitReport& hit_report) { |
| 259 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 258 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 364 } |
| 366 | 365 |
| 367 WhitelistUrlSet* site_list = | 366 WhitelistUrlSet* site_list = |
| 368 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); | 367 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); |
| 369 if (!site_list) | 368 if (!site_list) |
| 370 return false; | 369 return false; |
| 371 return site_list->Contains(maybe_whitelisted_url); | 370 return site_list->Contains(maybe_whitelisted_url); |
| 372 } | 371 } |
| 373 | 372 |
| 374 } // namespace safe_browsing | 373 } // namespace safe_browsing |
| OLD | NEW |