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

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

Issue 4822002: Send malware reports when a user opts-in from the safe browsing interstitial ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_thread.h" 12 #include "chrome/browser/browser_thread.h"
13 #include "chrome/browser/metrics/metrics_service.h" 13 #include "chrome/browser/metrics/metrics_service.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/profile_manager.h" 15 #include "chrome/browser/profile_manager.h"
16 #include "chrome/browser/safe_browsing/malware_report.h"
16 #include "chrome/browser/safe_browsing/protocol_manager.h" 17 #include "chrome/browser/safe_browsing/protocol_manager.h"
17 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 18 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
18 #include "chrome/browser/safe_browsing/safe_browsing_database.h" 19 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
19 #include "chrome/browser/tab_contents/tab_util.h" 20 #include "chrome/browser/tab_contents/tab_util.h"
20 #include "chrome/browser/tab_contents/tab_contents.h" 21 #include "chrome/browser/tab_contents/tab_contents.h"
21 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/net/url_request_context_getter.h" 25 #include "chrome/common/net/url_request_context_getter.h"
25 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 if (!enabled_) 826 if (!enabled_)
826 return; 827 return;
827 828
828 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url 829 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url
829 << " " << referrer_url << " " << is_subresource << " " 830 << " " << referrer_url << " " << is_subresource << " "
830 << threat_type; 831 << threat_type;
831 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url, 832 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url,
832 referrer_url, is_subresource, 833 referrer_url, is_subresource,
833 threat_type); 834 threat_type);
834 } 835 }
836
837 // Called after the user has opted in to send the malware |report|.
838 void SafeBrowsingService::SendMalwareReport(
839 scoped_refptr<SafeBrowsingMalwareReport> report) {
840 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
841 scoped_ptr<const std::string> serialized(report->GetSerializedReport());
842 if (!serialized->empty()) {
843 DVLOG(1) << "Sending serialized report.";
844 protocol_manager_->SendMalwareReport(*serialized);
845 }
846 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698