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

Unified Diff: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc

Issue 2580903002: Clean up ContentSubresourceFilterDriverFactory. (Closed)
Patch Set: Created 4 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: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
index c3df047990327e9591a01f334b140843fbd44f48..dbb8f3a5918a9cbba2421ab24925f5035f118b7d 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
@@ -21,6 +21,9 @@ namespace subresource_filter {
namespace {
+const char kWebContentsUserDataKey[] =
+ "web_contents_subresource_filter_driver_factory";
+
std::string DistillURLToHostAndPath(const GURL& url) {
return url.host() + url.path();
}
@@ -32,10 +35,6 @@ bool ShouldMeasurePerformance(double rate) {
} // namespace
// static
-const char ContentSubresourceFilterDriverFactory::kWebContentsUserDataKey[] =
- "web_contents_subresource_filter_driver_factory";
-
-// static
void ContentSubresourceFilterDriverFactory::CreateForWebContents(
content::WebContents* web_contents,
std::unique_ptr<SubresourceFilterClient> client) {
@@ -80,7 +79,7 @@ void ContentSubresourceFilterDriverFactory::CreateDriverForFrameHostIfNeeded(
}
void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() {
- client_->ToggleNotificationVisibility(activation_state() ==
+ client_->ToggleNotificationVisibility(activation_state_ ==
ActivationState::ENABLED);
}
@@ -111,7 +110,7 @@ void ContentSubresourceFilterDriverFactory::
void ContentSubresourceFilterDriverFactory::AddHostOfURLToWhitelistSet(
const GURL& url) {
- if (!url.host().empty() && url.SchemeIsHTTPOrHTTPS())
+ if (url.has_host() && url.SchemeIsHTTPOrHTTPS())
whitelisted_hosts_.insert(url.host());
}
@@ -140,7 +139,7 @@ void ContentSubresourceFilterDriverFactory::ActivateForFrameHostIfNeeded(
void ContentSubresourceFilterDriverFactory::OnReloadRequested() {
UMA_HISTOGRAM_BOOLEAN("SubresourceFilter.Prompt.NumReloads", true);
- const GURL whitelist_url(web_contents()->GetLastCommittedURL());
+ const GURL& whitelist_url = web_contents()->GetLastCommittedURL();
AddHostOfURLToWhitelistSet(whitelist_url);
web_contents()->GetController().Reload(true);
}
@@ -175,7 +174,9 @@ void ContentSubresourceFilterDriverFactory::DidStartNavigation(
void ContentSubresourceFilterDriverFactory::DidRedirectNavigation(
content::NavigationHandle* navigation_handle) {
- navigation_chain_.push_back(navigation_handle->GetURL());
+ DCHECK(!navigation_handle->IsSamePage());
+ if (navigation_handle->IsInMainFrame())
+ navigation_chain_.push_back(navigation_handle->GetURL());
}
void ContentSubresourceFilterDriverFactory::RenderFrameCreated(

Powered by Google App Engine
This is Rietveld 408576698