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

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

Issue 1509073002: Fixes for Safe Browsing with unrelated pending navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review changes for comment #13-15 Created 5 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
Index: chrome/browser/safe_browsing/threat_details.cc
diff --git a/chrome/browser/safe_browsing/threat_details.cc b/chrome/browser/safe_browsing/threat_details.cc
index af89c5ccf0a2a0cd045e05e81f0f14dfbaa377fe..433ccb20238f453ac396b5f6ce20dd85c7db855c 100644
--- a/chrome/browser/safe_browsing/threat_details.cc
+++ b/chrome/browser/safe_browsing/threat_details.cc
@@ -182,21 +182,20 @@ void ThreatDetails::StartCollection() {
report_->set_type(GetReportTypeFromSBThreatType(resource_.threat_type));
}
- GURL page_url = web_contents()->GetURL();
- if (IsReportableUrl(page_url))
- report_->set_page_url(page_url.spec());
-
GURL referrer_url;
- NavigationEntry* nav_entry = web_contents()->GetController().GetActiveEntry();
+ NavigationEntry* nav_entry = resource_.GetNavigationEntryForResource();
if (nav_entry) {
+ GURL page_url = nav_entry->GetURL();
+ if (IsReportableUrl(page_url))
+ report_->set_page_url(page_url.spec());
+
referrer_url = nav_entry->GetReferrer().url;
- if (IsReportableUrl(referrer_url)) {
+ if (IsReportableUrl(referrer_url))
report_->set_referrer_url(referrer_url.spec());
- }
- }
- // Add the nodes, starting from the page url.
- AddUrl(page_url, GURL(), std::string(), NULL);
+ // Add the nodes, starting from the page url.
+ AddUrl(page_url, GURL(), std::string(), NULL);
+ }
// Add the resource_url and its original url, if non-empty and different.
if (!resource_.original_url.is_empty() &&
@@ -224,7 +223,7 @@ void ThreatDetails::StartCollection() {
}
// Add the referrer url.
- if (nav_entry && !referrer_url.is_empty())
+ if (!referrer_url.is_empty())
AddUrl(referrer_url, GURL(), std::string(), NULL);
if (!resource_.IsMainPageLoadBlocked()) {

Powered by Google App Engine
This is Rietveld 408576698