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 c6106319cac4c7ab993d0b3b08c1a29f86f65257..db90ce237c785dd557be291e89be160656759e6b 100644 |
--- a/components/subresource_filter/core/browser/subresource_filter_features.h |
+++ b/components/subresource_filter/core/browser/subresource_filter_features.h |
@@ -5,6 +5,8 @@ |
#ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_H_ |
#define COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_H_ |
+#include <vector> |
+ |
#include "base/feature_list.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
@@ -58,19 +60,31 @@ struct Configuration { |
bool should_whitelist_site_on_reload = false; |
}; |
-// TODO(engedy): Make this an actual list once all call sites are prepared to |
-// handle multiple simultaneous configurations. |
+// Thread-safe, ref-counted wrapper around an immutable list of configurations. |
class ConfigurationList : public base::RefCountedThreadSafe<ConfigurationList> { |
public: |
+ explicit ConfigurationList(std::vector<Configuration> configs); |
explicit ConfigurationList(Configuration config); |
- const Configuration& the_one_and_only() const { return config_; } |
+ // Returns the most specific ruleset flavor string that is prescribed by any |
+ // of the configurations; where `most specific` is defined as the longest |
+ // string, and in case of a tie, the lexicographically greatest among those. |
+ std::string GetMostSpecificRulesetFlavor() const; |
+ |
+ // Retrieves the configurations pre-sorted in decreasing order of priority. |
+ // |
+ // For each navigation, subresource filtering shall be activated according to |
+ // at most one configuration: the one whose |activation_scope| contains the |
+ // navigation, and has the highest priority among such configurations. |
+ const std::vector<Configuration>& ordered_configs() const { |
+ return ordered_configs_; |
+ } |
private: |
friend class base::RefCountedThreadSafe<ConfigurationList>; |
~ConfigurationList(); |
- const Configuration config_; |
+ const std::vector<Configuration> ordered_configs_; |
DISALLOW_COPY_AND_ASSIGN(ConfigurationList); |
}; |