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

Side by Side Diff: components/safe_browsing_db/safe_browsing_prefs.h

Issue 2505153002: Add support for scout to 'ext' param when creating SafeBrowsing ping URLs. (Closed)
Patch Set: Go back to IsExtendedReportingEnabled where level doesn't matter Created 4 years, 1 month 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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // Safe Browsing preferences and some basic utility functions for using them. 5 // Safe Browsing preferences and some basic utility functions for using them.
6 6
7 #ifndef COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_PREFS_H_ 7 #ifndef COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_PREFS_H_
8 #define COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_PREFS_H_ 8 #define COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_PREFS_H_
9 9
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 24 matching lines...) Expand all
35 // When this feature is enabled, the Scout opt-in text will be displayed as of 35 // When this feature is enabled, the Scout opt-in text will be displayed as of
36 // the next security incident. Until then, the legacy SBER text will appear. 36 // the next security incident. Until then, the legacy SBER text will appear.
37 // TODO: this is temporary (crbug.com/662944) 37 // TODO: this is temporary (crbug.com/662944)
38 extern const base::Feature kCanShowScoutOptIn; 38 extern const base::Feature kCanShowScoutOptIn;
39 39
40 // When this feature is enabled, the Scout opt-in text will immediately be 40 // When this feature is enabled, the Scout opt-in text will immediately be
41 // displayed everywhere. 41 // displayed everywhere.
42 // TODO: this is temporary (crbug.com/662944) 42 // TODO: this is temporary (crbug.com/662944)
43 extern const base::Feature kOnlyShowScoutOptIn; 43 extern const base::Feature kOnlyShowScoutOptIn;
44 44
45 // Enumerates the level of Safe Browsing Extended Reporting that is currently
46 // available.
47 enum ExtendedReportingLevel {
48 // Extended reporting is off.
49 SBER_LEVEL_OFF = 0,
50 // The Legacy level of extended reporting is available, reporting happens in
51 // response to security incidents.
52 SBER_LEVEL_LEGACY = 1,
53 // The Scout level of extended reporting is available, some data can be
54 // collected to actively detect dangerous apps and sites.
55 SBER_LEVEL_SCOUT = 2,
56 };
57
45 // Determines which opt-in text should be used based on the currently active 58 // Determines which opt-in text should be used based on the currently active
46 // preference. Will return either |extended_reporting_resource| if the legacy 59 // preference. Will return either |extended_reporting_resource| if the legacy
47 // Extended Reporting pref is active, or |scout_resource| if the Scout pref is 60 // Extended Reporting pref is active, or |scout_resource| if the Scout pref is
48 // active. 61 // active.
49 int ChooseOptInTextResource(const PrefService& prefs, 62 int ChooseOptInTextResource(const PrefService& prefs,
50 int extended_reporting_resource, 63 int extended_reporting_resource,
51 int scout_resource); 64 int scout_resource);
52 65
53 // Returns whether the currently active Safe Browsing Extended Reporting 66 // Returns whether the currently active Safe Browsing Extended Reporting
54 // preference exists (eg: has been set before). 67 // preference exists (eg: has been set before).
55 bool ExtendedReportingPrefExists(const PrefService& prefs); 68 bool ExtendedReportingPrefExists(const PrefService& prefs);
56 69
70 // Returns the level of reporting available for the current user.
71 ExtendedReportingLevel GetExtendedReportingLevel(const PrefService& prefs);
72
57 // Returns the name of the Safe Browsing Extended Reporting pref that is 73 // Returns the name of the Safe Browsing Extended Reporting pref that is
58 // currently in effect. The specific pref in-use may change through experiments. 74 // currently in effect. The specific pref in-use may change through experiments.
59 const char* GetExtendedReportingPrefName(const PrefService& prefs); 75 const char* GetExtendedReportingPrefName(const PrefService& prefs);
60 76
61 // Initializes Safe Browsing preferences based on data such as experiment state, 77 // Initializes Safe Browsing preferences based on data such as experiment state,
62 // command line flags, etc. 78 // command line flags, etc.
63 // TODO: this is temporary (crbug.com/662944) 79 // TODO: this is temporary (crbug.com/662944)
64 void InitializeSafeBrowsingPrefs(PrefService* prefs); 80 void InitializeSafeBrowsingPrefs(PrefService* prefs);
65 81
66 // Returns whether Safe Browsing Extended Reporting is currently enabled. 82 // Returns whether Safe Browsing Extended Reporting is currently enabled.
67 // This should be used to decide if any of the reporting preferences are set, 83 // This should be used to decide if any of the reporting preferences are set,
68 // regardless of which specific one is set. 84 // regardless of which specific one is set.
69 bool IsExtendedReportingEnabled(const PrefService& prefs); 85 bool IsExtendedReportingEnabled(const PrefService& prefs);
70 86
71 // Updates UMA metrics about Safe Browsing Extended Reporting states. 87 // Updates UMA metrics about Safe Browsing Extended Reporting states.
72 void RecordExtendedReportingMetrics(const PrefService& prefs); 88 void RecordExtendedReportingMetrics(const PrefService& prefs);
73 89
74 // Sets the currently active Safe Browsing Extended Reporting preference to the 90 // Sets the currently active Safe Browsing Extended Reporting preference to the
75 // specified value. 91 // specified value.
76 void SetExtendedReportingPref(PrefService* prefs, bool value); 92 void SetExtendedReportingPref(PrefService* prefs, bool value);
77 93
78 // Called to indicate that a security interstitial is about to be shown to the 94 // Called to indicate that a security interstitial is about to be shown to the
79 // user. This may trigger the user to begin seeing the Scout opt-in text 95 // user. This may trigger the user to begin seeing the Scout opt-in text
80 // depending on their experiment state. 96 // depending on their experiment state.
81 void UpdatePrefsBeforeSecurityInterstitial(PrefService* prefs); 97 void UpdatePrefsBeforeSecurityInterstitial(PrefService* prefs);
82 98
83 } // namespace safe_browsing 99 } // namespace safe_browsing
84 100
85 #endif // COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_PREFS_H_ 101 #endif // COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_PREFS_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/hit_report.h ('k') | components/safe_browsing_db/safe_browsing_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698