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 19f9c00b922c2176d6ca127292fa25ef19d100d1..9ac8d317cb60586a5cc86c2396b55ef1d97e2e42 100644 |
--- a/components/subresource_filter/core/browser/subresource_filter_features.h |
+++ b/components/subresource_filter/core/browser/subresource_filter_features.h |
@@ -12,6 +12,52 @@ |
namespace subresource_filter { |
+// Encapsulates all parameters that define how the subresource filter feature |
+// should operate. |
+struct Configuration { |
+ Configuration(); |
+ ~Configuration(); |
+ Configuration(Configuration&&); |
+ Configuration& operator=(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 |
+ // 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; |
@@ -42,38 +88,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_ |