1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_SAFE_BROWSING_CORE_FEATURES_H_
6 #define COMPONENTS_SAFE_BROWSING_CORE_FEATURES_H_
7 
8 #include <stddef.h>
9 #include <algorithm>
10 #include <utility>
11 #include <vector>
12 
13 #include "base/feature_list.h"
14 #include "base/macros.h"
15 #include "base/values.h"
16 namespace base {
17 class ListValue;
18 }  // namespace base
19 
20 namespace safe_browsing {
21 // Features list, in alphabetical order.
22 
23 // Controls whether we send RIND reports when a popup originating from a Google
24 // Ad is blocked.
25 extern const base::Feature kAdPopupTriggerFeature;
26 
27 // Controls whether we send RIND reports when a redirect caused by a Google Ad
28 // is blocked.
29 extern const base::Feature kAdRedirectTriggerFeature;
30 
31 extern const base::Feature kAdSamplerTriggerFeature;
32 
33 // Controls whether we sample inline JavaScript for ads in RIND
34 // reports.
35 extern const base::Feature kCaptureInlineJavascriptForGoogleAds;
36 
37 // Controls whether we try to get the SafetyNet ID of the device for use when
38 // a SBER user downloads an APK file.
39 extern const base::Feature kCaptureSafetyNetId;
40 
41 // Controls if safe browsing interstitials are implemented as committed
42 // navigations instead of overlays.
43 extern const base::Feature kCommittedSBInterstitials;
44 
45 // Controls whether to do deep scanning for DLP. If both this feature and
46 // the enterprise policies are enabled, the downloaded and uploaded files are
47 // sent for scanning.
48 extern const base::Feature kContentComplianceEnabled;
49 
50 // Enable the addition of access tokens to download pings for enhanced
51 // protection users.
52 extern const base::Feature kDownloadRequestWithToken;
53 
54 // Enable Chrome Safe Browsing enhanced protection.
55 extern const base::Feature kEnhancedProtection;
56 
57 // Controls whether to do deep scanning for malware. If both this feature and
58 // the enterprise policies are enabled, the downloaded and uploaded files are
59 // sent for scanning.
60 extern const base::Feature kMalwareScanEnabled;
61 
62 // Enable password protection for non-Google accounts.
63 extern const base::Feature kPasswordProtectionForSavedPasswords;
64 
65 // Enable whether or not to show a list of domains the saved password was used
66 // on the modal warning dialog during password protection. This is only checked
67 // if the |kPasswordProtectionForSavedPasswords| experiment is on.
68 extern const base::Feature kPasswordProtectionShowDomainsForSavedPasswords;
69 
70 // Enable GAIA password protection for signed-in users.
71 extern const base::Feature kPasswordProtectionForSignedInUsers;
72 
73 // Controls whether Chrome prompts Advanced Protection users for deep scanning.
74 extern const base::Feature kPromptAppForDeepScanning;
75 
76 // Controls whether native (instead of WKWebView-provided) Safe Browsing
77 // is available on iOS. When this flag is enabled, Safe Browsing is still
78 // subject to an opt-out controlled by prefs::kSafeBrowsingEnabled.
79 extern const base::Feature kSafeBrowsingAvailableOnIOS;
80 
81 // Controls whether Safe Browsing uses separate NetworkContexts for each
82 // profile.
83 extern const base::Feature kSafeBrowsingSeparateNetworkContexts;
84 
85 // Controls the daily quota for the suspicious site trigger.
86 extern const base::Feature kSuspiciousSiteTriggerQuotaFeature;
87 
88 // Controls whether the real time URL lookup is enabled.
89 extern const base::Feature kRealTimeUrlLookupEnabled;
90 
91 // Controls whether the real time URL lookup is enabled for all Android devices.
92 // This flag is in effect only if |kRealTimeUrlLookupEnabled| is true.
93 extern const base::Feature kRealTimeUrlLookupEnabledForAllAndroidDevices;
94 
95 // Controls whether the real time URL lookup is enabled for Enhanced Protection
96 // users.
97 extern const base::Feature kRealTimeUrlLookupEnabledForEP;
98 
99 // Controls whether the GAIA-keyed real time URL lookup is enabled for Enhanced
100 // Protection users.
101 extern const base::Feature kRealTimeUrlLookupEnabledForEPWithToken;
102 
103 // Controls whether the GAIA-keyed real time URL lookup is enabled.
104 extern const base::Feature kRealTimeUrlLookupEnabledWithToken;
105 
106 // Controls whether the real time URL lookup is enabled for non mainframe URLs
107 // for Enhanced Protection users.
108 extern const base::Feature kRealTimeUrlLookupNonMainframeEnabledForEP;
109 
110 // Specifies which non-resource HTML Elements to collect based on their tag and
111 // attributes. It's a single param containing a comma-separated list of pairs.
112 // For example: "tag1,id,tag1,height,tag2,foo" - this will collect elements with
113 // tag "tag1" that have attribute "id" or "height" set, and elements of tag
114 // "tag2" if they have attribute "foo" set. All tag names and attributes should
115 // be lower case.
116 extern const base::Feature kThreatDomDetailsTagAndAttributeFeature;
117 
118 // Controls the daily quota for data collection triggers. It's a single param
119 // containing a comma-separated list of pairs. The format of the param is
120 // "T1,Q1,T2,Q2,...Tn,Qn", where Tx is a TriggerType and Qx is how many reports
121 // that trigger is allowed to send per day.
122 // TODO(crbug.com/744869): This param should be deprecated after ad sampler
123 // launch in favour of having a unique quota feature and param per trigger.
124 // Having a single shared feature makes it impossible to run multiple trigger
125 // trials simultaneously.
126 extern const base::Feature kTriggerThrottlerDailyQuotaFeature;
127 
128 // Controls whether Chrome uses new download warning UX.
129 extern const base::Feature kUseNewDownloadWarnings;
130 
131 // Controls whether the delayed warning experiment is enabled.
132 extern const base::Feature kDelayedWarnings;
133 
134 base::ListValue GetFeatureStatusList();
135 
136 // Returns whether or not to stop filling in the SyncAccountType and
137 // ReusedPasswordType enums. This is used in the
138 // |kPasswordProtectionForSignedInUsers| experiment.
139 bool GetShouldFillOldPhishGuardProto();
140 
141 }  // namespace safe_browsing
142 #endif  // COMPONENTS_SAFE_BROWSING_CORE_FEATURES_H_
143