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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 6611023: The optional Malware Details also collects HTTP cache information. See design... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url 1060 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url
1061 << " " << referrer_url << " " << is_subresource << " " 1061 << " " << referrer_url << " " << is_subresource << " "
1062 << threat_type; 1062 << threat_type;
1063 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url, 1063 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url,
1064 referrer_url, is_subresource, 1064 referrer_url, is_subresource,
1065 threat_type); 1065 threat_type);
1066 } 1066 }
1067 1067
1068 // If the user had opted-in to send MalwareDetails, this gets called 1068 // If the user had opted-in to send MalwareDetails, this gets called
1069 // at the time that the blocking page is going away. 1069 // when the report is ready.
1070 void SafeBrowsingService::ReportMalwareDetails( 1070 void SafeBrowsingService::SendSerializedMalwareDetails(
1071 scoped_refptr<MalwareDetails> details) { 1071 const std::string& serialized) {
1072 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1072 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1073 scoped_ptr<const std::string> serialized(details->GetSerializedReport()); 1073 if (!serialized.empty()) {
1074 if (!serialized->empty()) {
1075 DVLOG(1) << "Sending serialized malware details."; 1074 DVLOG(1) << "Sending serialized malware details.";
1076 protocol_manager_->ReportMalwareDetails(*serialized); 1075 protocol_manager_->ReportMalwareDetails(serialized);
1077 } 1076 }
1078 } 1077 }
1079 1078
1080 void SafeBrowsingService::CheckDownloadHashOnSBThread( 1079 void SafeBrowsingService::CheckDownloadHashOnSBThread(
1081 SafeBrowsingCheck* check) { 1080 SafeBrowsingCheck* check) {
1082 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop()); 1081 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop());
1083 DCHECK(enable_download_protection_); 1082 DCHECK(enable_download_protection_);
1084 1083
1085 if (!database_->ContainsDownloadHashPrefix(check->full_hash->prefix)) { 1084 if (!database_->ContainsDownloadHashPrefix(check->full_hash->prefix)) {
1086 // Good, we don't have hash for this url prefix. 1085 // Good, we don't have hash for this url prefix.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 check->is_download = true; 1177 check->is_download = true;
1179 check->timeout_task = 1178 check->timeout_task =
1180 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check); 1179 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check);
1181 checks_.insert(check); 1180 checks_.insert(check);
1182 1181
1183 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1182 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1184 1183
1185 MessageLoop::current()->PostDelayedTask( 1184 MessageLoop::current()->PostDelayedTask(
1186 FROM_HERE, check->timeout_task, timeout_ms); 1185 FROM_HERE, check->timeout_task, timeout_ms);
1187 } 1186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698