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

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

Issue 2241673002: Make UnsafeResource hold a WebContents getter instead of RenderFrame ids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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/client_side_detection_host.cc
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc
index 3ea9ec65b778a979fcf3c4f9fc3e7f8730e4f693..be5822e8783e2d16aaadb3b5b04013748c368af4 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host.cc
@@ -417,10 +417,7 @@ void ClientSideDetectionHost::OnSafeBrowsingHit(
return;
// Check that this notification is really for us.
- content::RenderFrameHost* hit_rfh = content::RenderFrameHost::FromID(
- resource.render_process_host_id, resource.render_frame_id);
- if (!hit_rfh ||
- web_contents() != content::WebContents::FromRenderFrameHost(hit_rfh))
+ if (web_contents() != resource.web_contents_getter.Run())
return;
NavigationEntry *entry = resource.GetNavigationEntryForResource();
@@ -563,9 +560,10 @@ void ClientSideDetectionHost::MaybeShowPhishingWarning(GURL phishing_url,
resource.threat_type = SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL;
resource.threat_source =
safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION;
- resource.render_process_host_id =
- web_contents()->GetRenderProcessHost()->GetID();
- resource.render_frame_id = web_contents()->GetMainFrame()->GetRoutingID();
+ resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager::
+ UnsafeResource::GetWebContentsGetter(
+ web_contents()->GetRenderProcessHost()->GetID(),
+ web_contents()->GetMainFrame()->GetRoutingID());
if (!ui_manager_->IsWhitelisted(resource)) {
// We need to stop any pending navigations, otherwise the interstital
// might not get created properly.
@@ -598,9 +596,10 @@ void ClientSideDetectionHost::MaybeShowMalwareWarning(GURL original_url,
resource.threat_type = SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL;
resource.threat_source =
safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION;
- resource.render_process_host_id =
- web_contents()->GetRenderProcessHost()->GetID();
- resource.render_frame_id = web_contents()->GetMainFrame()->GetRoutingID();
+ resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager::
+ UnsafeResource::GetWebContentsGetter(
+ web_contents()->GetRenderProcessHost()->GetID(),
+ web_contents()->GetMainFrame()->GetRoutingID());
if (!ui_manager_->IsWhitelisted(resource)) {
// We need to stop any pending navigations, otherwise the interstital

Powered by Google App Engine
This is Rietveld 408576698