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

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

Issue 2838193002: Split the ScopedSubresourceFilterFeatureToggle into two helper classes. (Closed)
Patch Set: More polish. 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 cd3e242d7cda44503491e965a3cb9ccecd82ddfc..b0f5e1c10067e0af88d69198a5e2fedc593aa685 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features.h
+++ b/components/subresource_filter/core/browser/subresource_filter_features.h
@@ -18,8 +18,11 @@ namespace subresource_filter {
// should operate.
struct Configuration {
Configuration();
- ~Configuration();
+ Configuration(ActivationLevel activation_level,
+ ActivationScope activation_scope,
+ ActivationList activation_list = ActivationList::NONE);
Configuration(Configuration&&);
+ ~Configuration();
Configuration& operator=(Configuration&&);
// The maximum degree to which subresource filtering should be activated on
@@ -47,8 +50,8 @@ struct Configuration {
// 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.
+ // The ruleset flavor to download through the component updater. This 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.
@@ -75,15 +78,16 @@ class ConfigurationList : public base::RefCountedThreadSafe<ConfigurationList> {
// Retrieves all currently enabled subresource filtering configurations. The
// configurations are parsed on first access and then the result is cached.
//
-// In tests, however, the config may change in-between navigations, so callers
-// should not hold on to the result for long.
+// In tests, however, the config may be altered in-between navigations, so
+// callers should not hold on to the result for long.
scoped_refptr<ConfigurationList> GetActiveConfigurations();
namespace testing {
-// Clears the cached active ConfigurationList so that it will be recomputed on
-// next access. Used in tests when the variation parameters are altered.
-void ClearCachedActiveConfigurations();
+// Returns the currently cached active ConfigurationList, if any, and replaces
+// it with |configs|, which may be nullptr to clear the cache.
+scoped_refptr<ConfigurationList> ReplaceCachedActiveConfigurations(
Charlie Harrison 2017/04/25 19:36:21 This is like a get-and-set right? Maybe GetAndSetA
engedy 2017/04/25 20:13:24 Done.
+ scoped_refptr<ConfigurationList> configs);
} // namespace testing

Powered by Google App Engine
This is Rietveld 408576698