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

Unified Diff: components/subresource_filter/core/browser/subresource_filter_features.h

Issue 2798983002: Introduce subresource_filter::Configuration. (Closed)
Patch Set: Workaround 2. Created 3 years, 8 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: components/subresource_filter/core/browser/subresource_filter_features.h
diff --git a/components/subresource_filter/core/browser/subresource_filter_features.h b/components/subresource_filter/core/browser/subresource_filter_features.h
index 529580f4554d169d8ea518e63c802904fb4e6ccb..83774ab1d1c2a8fe5b11c7b28e8c4a3994606d4c 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features.h
+++ b/components/subresource_filter/core/browser/subresource_filter_features.h
@@ -12,6 +12,50 @@
namespace subresource_filter {
+// Encapsulates all parameters that define how the subresource filter feature
+// should operate.
+struct Configuration {
+ Configuration();
+ ~Configuration();
+
+ // The maximum degree to which subresource filtering should be activated on
+ // any RenderFrame. This will be ActivationLevel::DISABLED unless the feature
+ // is enabled and variation parameters prescribe a higher activation level.
+ ActivationLevel activation_level = ActivationLevel::DISABLED;
+
+ // The activation scope, that is, the subset of page loads where subresource
Charlie Harrison 2017/04/05 20:43:04 s/scope, that is/ scope. That is/
engedy 2017/04/07 08:40:58 Done.
+ // filtering should be activated. This will be ActivationScope::NO_SITES
+ // unless the feature is enabled and variation parameters prescribe a wider
+ // activation scope.
+ ActivationScope activation_scope = ActivationScope::NO_SITES;
+
+ // The activation list to use when the |activation_scope| is ACTIVATION_LIST.
+ // This will be ActivationList::NONE unless variation parameters prescribe a
+ // recognized list.
+ ActivationList activation_list = ActivationList::NONE;
+
+ // A number in the range [0, 1], indicating the fraction of page loads that
+ // should have extended performance measurements enabled. The rate will
+ // be 0 unless a greater frequency is specified by variation parameters.
+ double performance_measurement_rate = 0.0;
+
+ // Whether notifications indicating that a subresource was disallowed should
+ // be suppressed in the UI.
+ bool should_suppress_notifications = false;
+
+ // The ruleset flavor to download through the component updater, or the empty
+ // string if the default ruleset should be used.
+ std::string ruleset_flavor;
+
+ // Whether to whitelist a site when a page loaded from that site is reloaded.
+ bool should_whitelist_site_on_reload = false;
+};
+
+// Retrieves the subresource filtering configuration to use. Expensive to call.
+Configuration GetActiveConfiguration();
+
+// Feature and variation parameter definitions -------------------------------
+
// The master toggle to enable/disable the Safe Browsing Subresource Filter.
extern const base::Feature kSafeBrowsingSubresourceFilter;
@@ -45,38 +89,6 @@ extern const char kSuppressNotificationsParameterName[];
extern const char kWhitelistSiteOnReloadParameterName[];
-// Returns the maximum degree to which subresource filtering should be activated
-// on any RenderFrame. This will be ActivationLevel::DISABLED unless the feature
-// is enabled and variation parameters prescribe a higher activation level.
-ActivationLevel GetMaximumActivationLevel();
-
-// Returns the current activation scope, that is, the subset of page loads where
-// subresource filtering should be activated. The function returns
-// ActivationScope::NO_SITES unless the feature is enabled and variation
-// parameters prescribe a wider activation scope.
-ActivationScope GetCurrentActivationScope();
-
-// Returns current activation list, based on the values from variation params in
-// the feature |kSafeBrowsingSubresourceFilter|. When the corresponding
-// variation param is empty, returns most conservative ActivationList::NONE.
-ActivationList GetCurrentActivationList();
-
-// Returns a number in the range [0, 1], indicating the fraction of page loads
-// that should have extended performance measurements enabled. The rate will be
-// 0 unless a greater frequency is specified by variation parameters.
-double GetPerformanceMeasurementRate();
-
-// Returns whether notifications indicating that a subresource was disallowed
-// should be suppressed in the UI.
-bool ShouldSuppressNotifications();
-
-// Returns the ruleset flavor, or the empty string if the default ruleset should
-// be used.
-std::string GetRulesetFlavor();
-
-// Returns whether the site of reloaded pages should be whitelisted.
-bool ShouldWhitelistSiteOnReload();
-
} // namespace subresource_filter
#endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_H_

Powered by Google App Engine
This is Rietveld 408576698