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

Unified Diff: components/safe_browsing/base_resource_throttle.cc

Issue 2633593002: Do not require ContentSubresourceFilterDriverFactory (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing/base_resource_throttle.cc
diff --git a/components/safe_browsing/base_resource_throttle.cc b/components/safe_browsing/base_resource_throttle.cc
index 902f64cfcaad46da22f66488c1a55c378375abd5..d30a0c4a7a916c267b0b96eb8d121c49108becf0 100644
--- a/components/safe_browsing/base_resource_throttle.cc
+++ b/components/safe_browsing/base_resource_throttle.cc
@@ -328,21 +328,22 @@ void BaseResourceThrottle::StartDisplayingBlockingPage(
using subresource_filter::ContentSubresourceFilterDriverFactory;
ContentSubresourceFilterDriverFactory* driver_factory =
ContentSubresourceFilterDriverFactory::FromWebContents(web_contents);
- DCHECK(driver_factory);
-
- // For a redirect chain of A -> B -> C, the subresource filter expects C
- // as the resource URL and [A, B] as redirect URLs.
- std::vector<GURL> redirect_parent_urls;
- if (!resource.redirect_urls.empty()) {
- redirect_parent_urls.push_back(resource.original_url);
- redirect_parent_urls.insert(redirect_parent_urls.end(),
- resource.redirect_urls.begin(),
- std::prev(resource.redirect_urls.end()));
+ // Content embedders (such as Android Webview) does not have a
+ // driver_factory.
+ if (driver_factory) {
+ // For a redirect chain of A -> B -> C, the subresource filter expects C
+ // as the resource URL and [A, B] as redirect URLs.
+ std::vector<GURL> redirect_parent_urls;
+ if (!resource.redirect_urls.empty()) {
+ redirect_parent_urls.push_back(resource.original_url);
+ redirect_parent_urls.insert(redirect_parent_urls.end(),
+ resource.redirect_urls.begin(),
+ std::prev(resource.redirect_urls.end()));
+ }
+ driver_factory->OnMainResourceMatchedSafeBrowsingBlacklist(
+ resource.url, redirect_parent_urls, resource.threat_type,
+ resource.threat_metadata.threat_pattern_type);
}
-
- driver_factory->OnMainResourceMatchedSafeBrowsingBlacklist(
- resource.url, redirect_parent_urls, resource.threat_type,
- resource.threat_metadata.threat_pattern_type);
}
ui_manager->DisplayBlockingPage(resource);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698