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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_H _ 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_H _
6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_H _ 6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURES_H _
7 7
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "components/subresource_filter/core/common/activation_level.h" 9 #include "components/subresource_filter/core/common/activation_level.h"
10 #include "components/subresource_filter/core/common/activation_list.h" 10 #include "components/subresource_filter/core/common/activation_list.h"
11 #include "components/subresource_filter/core/common/activation_scope.h" 11 #include "components/subresource_filter/core/common/activation_scope.h"
12 12
13 namespace subresource_filter { 13 namespace subresource_filter {
14 14
15 // Encapsulates all parameters that define how the subresource filter feature
16 // should operate.
17 struct Configuration {
18 Configuration();
19 ~Configuration();
20
21 // The maximum degree to which subresource filtering should be activated on
22 // any RenderFrame. This will be ActivationLevel::DISABLED unless the feature
23 // is enabled and variation parameters prescribe a higher activation level.
24 ActivationLevel activation_level = ActivationLevel::DISABLED;
25
26 // 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.
27 // filtering should be activated. This will be ActivationScope::NO_SITES
28 // unless the feature is enabled and variation parameters prescribe a wider
29 // activation scope.
30 ActivationScope activation_scope = ActivationScope::NO_SITES;
31
32 // The activation list to use when the |activation_scope| is ACTIVATION_LIST.
33 // This will be ActivationList::NONE unless variation parameters prescribe a
34 // recognized list.
35 ActivationList activation_list = ActivationList::NONE;
36
37 // A number in the range [0, 1], indicating the fraction of page loads that
38 // should have extended performance measurements enabled. The rate will
39 // be 0 unless a greater frequency is specified by variation parameters.
40 double performance_measurement_rate = 0.0;
41
42 // Whether notifications indicating that a subresource was disallowed should
43 // be suppressed in the UI.
44 bool should_suppress_notifications = false;
45
46 // The ruleset flavor to download through the component updater, or the empty
47 // string if the default ruleset should be used.
48 std::string ruleset_flavor;
49
50 // Whether to whitelist a site when a page loaded from that site is reloaded.
51 bool should_whitelist_site_on_reload = false;
52 };
53
54 // Retrieves the subresource filtering configuration to use. Expensive to call.
55 Configuration GetActiveConfiguration();
56
57 // Feature and variation parameter definitions -------------------------------
58
15 // The master toggle to enable/disable the Safe Browsing Subresource Filter. 59 // The master toggle to enable/disable the Safe Browsing Subresource Filter.
16 extern const base::Feature kSafeBrowsingSubresourceFilter; 60 extern const base::Feature kSafeBrowsingSubresourceFilter;
17 61
18 // Enables the new experimental UI for the Subresource Filter. 62 // Enables the new experimental UI for the Subresource Filter.
19 extern const base::Feature kSafeBrowsingSubresourceFilterExperimentalUI; 63 extern const base::Feature kSafeBrowsingSubresourceFilterExperimentalUI;
20 64
21 // Guards creation of the SubresourceFilterSafeBrowsingActivationThrottle 65 // Guards creation of the SubresourceFilterSafeBrowsingActivationThrottle
22 extern const base::Feature kSubresourceFilterSafeBrowsingActivationThrottle; 66 extern const base::Feature kSubresourceFilterSafeBrowsingActivationThrottle;
23 67
24 // Name/values of the variation parameter controlling maximum activation level. 68 // Name/values of the variation parameter controlling maximum activation level.
(...skipping 13 matching lines...) Expand all
38 extern const char kActivationListSubresourceFilter[]; 82 extern const char kActivationListSubresourceFilter[];
39 83
40 extern const char kRulesetFlavorParameterName[]; 84 extern const char kRulesetFlavorParameterName[];
41 85
42 extern const char kPerformanceMeasurementRateParameterName[]; 86 extern const char kPerformanceMeasurementRateParameterName[];
43 87
44 extern const char kSuppressNotificationsParameterName[]; 88 extern const char kSuppressNotificationsParameterName[];
45 89
46 extern const char kWhitelistSiteOnReloadParameterName[]; 90 extern const char kWhitelistSiteOnReloadParameterName[];
47 91
48 // Returns the maximum degree to which subresource filtering should be activated
49 // on any RenderFrame. This will be ActivationLevel::DISABLED unless the feature
50 // is enabled and variation parameters prescribe a higher activation level.
51 ActivationLevel GetMaximumActivationLevel();
52
53 // Returns the current activation scope, that is, the subset of page loads where
54 // subresource filtering should be activated. The function returns
55 // ActivationScope::NO_SITES unless the feature is enabled and variation
56 // parameters prescribe a wider activation scope.
57 ActivationScope GetCurrentActivationScope();
58
59 // Returns current activation list, based on the values from variation params in
60 // the feature |kSafeBrowsingSubresourceFilter|. When the corresponding
61 // variation param is empty, returns most conservative ActivationList::NONE.
62 ActivationList GetCurrentActivationList();
63
64 // Returns a number in the range [0, 1], indicating the fraction of page loads
65 // that should have extended performance measurements enabled. The rate will be
66 // 0 unless a greater frequency is specified by variation parameters.
67 double GetPerformanceMeasurementRate();
68
69 // Returns whether notifications indicating that a subresource was disallowed
70 // should be suppressed in the UI.
71 bool ShouldSuppressNotifications();
72
73 // Returns the ruleset flavor, or the empty string if the default ruleset should
74 // be used.
75 std::string GetRulesetFlavor();
76
77 // Returns whether the site of reloaded pages should be whitelisted.
78 bool ShouldWhitelistSiteOnReload();
79
80 } // namespace subresource_filter 92 } // namespace subresource_filter
81 93
82 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURE S_H_ 94 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_BROWSER_SUBRESOURCE_FILTER_FEATURE S_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698