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

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

Issue 7189074: Send the referral URL with the client-side phishing detection request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Brian's comments. Created 9 years, 6 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
Index: chrome/browser/safe_browsing/browser_feature_extractor.cc
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc
index 3d56279c3327f87a9755d0f309d058e1ec429e88..2c5ed57f042a3742aed1c9303105569b0712d710 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc
@@ -33,6 +33,8 @@ const char kFirstHttpHostVisitMoreThan24hAgo[] =
"FirstHttpHostVisitMoreThan24hAgo";
const char kFirstHttpsHostVisitMoreThan24hAgo[] =
"FirstHttpsHostVisitMoreThan24hAgo";
+const char kHasSSLReferrer[] = "HasSSLReferrer";
+const char kPageTransitionType[] = "PageTransitionType";
} // namespace features
static void AddFeature(const std::string& feature_name,
@@ -74,7 +76,8 @@ BrowserFeatureExtractor::~BrowserFeatureExtractor() {
pending_queries_.clear();
}
-void BrowserFeatureExtractor::ExtractFeatures(ClientPhishingRequest* request,
+void BrowserFeatureExtractor::ExtractFeatures(const BrowseInfo& info,
+ ClientPhishingRequest* request,
DoneCallback* callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(request);
@@ -84,6 +87,18 @@ void BrowserFeatureExtractor::ExtractFeatures(ClientPhishingRequest* request,
DLOG(ERROR) << "ExtractFeatures called without a callback object";
return;
}
+ bool is_secure_referrer = info.referrer.SchemeIsSecure();
+ if (!is_secure_referrer) {
+ request->set_referrer_url(info.referrer.spec());
+ }
+ AddFeature(features::kHasSSLReferrer,
+ is_secure_referrer ? 1.0 : 0.0,
+ request);
+ AddFeature(features::kPageTransitionType,
+ static_cast<double>(
+ PageTransition::StripQualifier(info.transition)),
+ request);
+
pending_extractions_.insert(std::make_pair(request, callback));
MessageLoop::current()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698