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

Unified 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 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') | chrome/chrome_browser.gypi » ('j') | 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 68800)
+++ chrome/browser/safe_browsing/safe_browsing_service.cc (working copy)
@@ -14,6 +14,7 @@
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/safe_browsing/malware_details.h"
#include "chrome/browser/safe_browsing/protocol_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/safe_browsing/safe_browsing_database.h"
@@ -35,11 +36,12 @@
using base::TimeDelta;
// The default URL prefix where browser fetches chunk updates, hashes,
-// and reports malware.
+// and reports safe browsing hits.
static const char* const kSbDefaultInfoURLPrefix =
"http://safebrowsing.clients.google.com/safebrowsing";
-// The default URL prefix where browser fetches MAC client key.
+// The default URL prefix where browser fetches MAC client key and reports
+// malware details.
static const char* const kSbDefaultMacKeyURLPrefix =
"https://sb-ssl.google.com/safebrowsing";
@@ -845,6 +847,8 @@
SafeBrowsingBlockingPage::ShowBlockingPage(this, resource);
}
+// A safebrowsing hit is sent right after we create a blocking page,
+// only for UMA users.
void SafeBrowsingService::ReportSafeBrowsingHit(
const GURL& malicious_url,
const GURL& page_url,
@@ -862,3 +866,16 @@
referrer_url, is_subresource,
threat_type);
}
+
+// A MalwareDetails report is sent after the blocking page is going
+// away, at which point we see if the user had opted-in using the
+// checkbox on the blocking page.
+void SafeBrowsingService::ReportMalwareDetails(
+ scoped_refptr<MalwareDetails> details) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ scoped_ptr<const std::string> serialized(details->GetSerializedReport());
+ if (!serialized->empty()) {
+ DVLOG(1) << "Sending serialized malware details.";
+ protocol_manager_->ReportMalwareDetails(*serialized);
+ }
+}
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698