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

Unified Diff: chrome/browser/subresource_filter/chrome_subresource_filter_client.cc

Issue 2859783002: [subresource_filter] Make website setting existence imply site activation (Closed)
Patch Set: rebase Created 3 years, 7 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 | chrome/browser/subresource_filter/subresource_filter_content_settings_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
diff --git a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
index 92d4e7d3b4159c8bf58505def0ba0df62d72baaa..6c1a9d1fe4f59de1b3188d23ac429add34981628 100644
--- a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
+++ b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
@@ -121,9 +121,18 @@ bool ChromeSubresourceFilterClient::OnPageActivationComputed(
bool activated) {
const GURL& url(navigation_handle->GetURL());
DCHECK(navigation_handle->IsInMainFrame());
+
+ // If the site is no longer activated, clear the metadata. This is to maintain
+ // the invariant that metadata implies activated.
+ if (!activated && url.SchemeIsHTTPOrHTTPS())
+ settings_manager_->ClearSiteMetadata(url);
+
// Return whether the activation should be whitelisted.
return whitelisted_hosts_.count(url.host()) ||
settings_manager_->GetSitePermission(url) == CONTENT_SETTING_BLOCK;
+ // TODO(csharrison): Consider setting the metadata to an empty dict here if
+ // the site is activated and not whitelisted. Need to be careful about various
+ // edge cases like |should_suppress_notification| and DRYRUN activation.
}
void ChromeSubresourceFilterClient::WhitelistByContentSettings(
« no previous file with comments | « no previous file | chrome/browser/subresource_filter/subresource_filter_content_settings_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698