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

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

Issue 2644133005: Include all server redirects in referrer chain (Closed)
Patch Set: proto change and adding two histograms Created 3 years, 11 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/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index e500413c8a437638eed1907f77fde09f1f351d6f..a6a0308e914dfb96227bf27b06d20ec4e89530fd 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -1240,6 +1240,8 @@ class DownloadProtectionService::PPAPIDownloadRequest
scoped_refptr<SafeBrowsingDatabaseManager> database_manager)
: requestor_url_(requestor_url),
initiating_frame_url_(initiating_frame_url),
+ initiating_main_frame_url_(
+ web_contents ? web_contents->GetLastCommittedURL():GURL()),
Nathan Parker 2017/01/27 22:53:37 nit: add spaces around :
Jialiu Lin 2017/01/27 23:25:06 Done.
tab_id_(SessionTabHelper::IdForTab(web_contents)),
default_file_path_(default_file_path),
alternate_extensions_(alternate_extensions),
@@ -1374,6 +1376,7 @@ class DownloadProtectionService::PPAPIDownloadRequest
service_->AddReferrerChainToPPAPIClientDownloadRequest(
initiating_frame_url_,
+ initiating_main_frame_url_,
tab_id_,
has_user_gesture_,
&request);
@@ -1500,9 +1503,12 @@ class DownloadProtectionService::PPAPIDownloadRequest
// URL of document that requested the PPAPI download.
const GURL requestor_url_;
- // URL of the frame that hosted the PPAPI plugin.
+ // URL of the frame that hosts the PPAPI plugin.
const GURL initiating_frame_url_;
+ // URL of the tab that contains the initialting_frame.
+ const GURL initiating_main_frame_url_;
+
// Tab id that associated with the PPAPI plugin, computed by
// SessionTabHelper::IdForTab().
int tab_id_;
@@ -1847,12 +1853,14 @@ void DownloadProtectionService::AddReferrerChainToClientDownloadRequest(
UMA_HISTOGRAM_ENUMERATION(
"SafeBrowsing.ReferrerAttributionResult.DownloadAttribution", result,
SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX);
+ out_request->set_download_attribution_finch_enabled(true);
for (auto& entry : attribution_chain)
out_request->add_referrer_chain()->Swap(entry.get());
}
void DownloadProtectionService::AddReferrerChainToPPAPIClientDownloadRequest(
const GURL& initiating_frame_url,
+ const GURL& initiating_main_frame_url,
int tab_id,
bool has_user_gesture,
ClientDownloadRequest* out_request) {
@@ -1869,6 +1877,7 @@ void DownloadProtectionService::AddReferrerChainToPPAPIClientDownloadRequest(
SafeBrowsingNavigationObserverManager::AttributionResult result =
navigation_observer_manager_->IdentifyReferrerChainForPPAPIDownload(
initiating_frame_url,
+ initiating_main_frame_url,
tab_id,
has_user_gesture,
kDownloadAttributionUserGestureLimit,
@@ -1879,6 +1888,7 @@ void DownloadProtectionService::AddReferrerChainToPPAPIClientDownloadRequest(
UMA_HISTOGRAM_ENUMERATION(
"SafeBrowsing.ReferrerAttributionResult.PPAPIDownloadAttribution", result,
SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX);
+ out_request->set_download_attribution_finch_enabled(true);
for (auto& entry : attribution_chain)
out_request->add_referrer_chain()->Swap(entry.get());
}

Powered by Google App Engine
This is Rietveld 408576698