Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 3028040: Report malware redirectors as well. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/safe_browsing_service.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_service.cc (revision 55938)
+++ chrome/browser/safe_browsing/safe_browsing_service.cc (working copy)
@@ -750,20 +750,24 @@
const MetricsService* metrics = g_browser_process->metrics_service();
DCHECK(metrics);
if (metrics && metrics->reporting_active() &&
- resource.resource_type != ResourceType::MAIN_FRAME &&
resource.threat_type == SafeBrowsingService::URL_MALWARE) {
GURL page_url = wc->GetURL();
GURL referrer_url;
NavigationEntry* entry = wc->controller().GetActiveEntry();
if (entry)
referrer_url = entry->referrer();
- ChromeThread::PostTask(
- ChromeThread::IO, FROM_HERE,
- NewRunnableMethod(this,
- &SafeBrowsingService::ReportMalware,
- resource.url,
- page_url,
- referrer_url));
+
+ if (resource.url != page_url || !referrer_url.is_empty()) {
+ bool is_subresource = resource.resource_type != ResourceType::MAIN_FRAME;
+ ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableMethod(this,
+ &SafeBrowsingService::ReportMalware,
+ resource.url,
+ page_url,
+ referrer_url,
+ is_subresource));
+ }
}
SafeBrowsingBlockingPage::ShowBlockingPage(this, resource);
@@ -771,7 +775,8 @@
void SafeBrowsingService::ReportMalware(const GURL& malware_url,
const GURL& page_url,
- const GURL& referrer_url) {
+ const GURL& referrer_url,
+ bool is_subresource) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
if (!enabled_)
@@ -779,7 +784,8 @@
if (DatabaseAvailable()) {
// Check if 'page_url' is already blacklisted (exists in our cache). Only
- // report if it's not there.
+ // report if it's not there. This can happen if the user has ignored
+ // the warning for page_url and is now hitting a warning for a resource.
std::string list;
std::vector<SBPrefix> prefix_hits;
std::vector<SBFullHashResult> full_hits;
@@ -789,5 +795,6 @@
return;
}
- protocol_manager_->ReportMalware(malware_url, page_url, referrer_url);
+ protocol_manager_->ReportMalware(malware_url, page_url, referrer_url,
+ is_subresource);
}
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698