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

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, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url, 1029 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url,
1030 referrer_url, is_subresource, 1030 referrer_url, is_subresource,
1031 threat_type); 1031 threat_type);
1032 } 1032 }
1033 1033
1034 // If the user had opted-in to send MalwareDetails, this gets called 1034 // If the user had opted-in to send MalwareDetails, this gets called
1035 // at the time that the blocking page is going away. 1035 // at the time that the blocking page is going away.
1036 void SafeBrowsingService::ReportMalwareDetails( 1036 void SafeBrowsingService::ReportMalwareDetails(
1037 scoped_refptr<MalwareDetails> details) { 1037 scoped_refptr<MalwareDetails> details) {
1038 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1038 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1039 details->AddRef();
lzheng 2011/03/05 00:37:50 We should avoid AddRef() and Release(). And I don'
panayiotis 2011/03/29 18:14:55 Done.
1040 // Starts gathering data from the HTTP cache, when done, OnReportReady is
1041 // called with the serialized report.
1042 details->StartCacheCollection(
1043 NewCallback(this, &SafeBrowsingService::OnReportReady));
1044 }
1045
1046 void SafeBrowsingService::OnReportReady(scoped_refptr<MalwareDetails> details) {
1047 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1048 details->Release();
1049
1039 scoped_ptr<const std::string> serialized(details->GetSerializedReport()); 1050 scoped_ptr<const std::string> serialized(details->GetSerializedReport());
1051
1040 if (!serialized->empty()) { 1052 if (!serialized->empty()) {
1041 DVLOG(1) << "Sending serialized malware details."; 1053 DVLOG(1) << "Sending serialized malware details.";
1042 protocol_manager_->ReportMalwareDetails(*serialized); 1054 protocol_manager_->ReportMalwareDetails(*serialized);
1043 } 1055 }
1044 } 1056 }
1045 1057
1046 void SafeBrowsingService::CheckDownloadHashOnSBThread( 1058 void SafeBrowsingService::CheckDownloadHashOnSBThread(
1047 SafeBrowsingCheck* check) { 1059 SafeBrowsingCheck* check) {
1048 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop()); 1060 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop());
1049 DCHECK(enable_download_protection_); 1061 DCHECK(enable_download_protection_);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 check->is_download = true; 1156 check->is_download = true;
1145 check->timeout_task = 1157 check->timeout_task =
1146 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check); 1158 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check);
1147 checks_.insert(check); 1159 checks_.insert(check);
1148 1160
1149 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1161 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1150 1162
1151 MessageLoop::current()->PostDelayedTask( 1163 MessageLoop::current()->PostDelayedTask(
1152 FROM_HERE, check->timeout_task, timeout_ms); 1164 FROM_HERE, check->timeout_task, timeout_ms);
1153 } 1165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698