1 // Copyright 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_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_TYPES_H_ 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_TYPES_H_ 7 8 #include <stddef.h> 9 #include <stdint.h> 10 11 // A particular type of content to care about. We give the user various types 12 // of controls over each of these. 13 // When adding/removing values from this enum, be sure to update the 14 // kHistogramValue array in content_settings.cc as well. 15 // A Java counterpart will be generated for this enum. 16 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.content_settings 17 enum class ContentSettingsType : int32_t { 18 // "DEFAULT" is only used as an argument to the Content Settings Window 19 // opener; there it means "whatever was last shown". 20 DEFAULT = -1, 21 COOKIES = 0, 22 IMAGES, 23 JAVASCRIPT, 24 PLUGINS, 25 26 // This setting governs both popups and unwanted redirects like tab-unders and 27 // framebusting. 28 // TODO(csharrison): Consider renaming it to POPUPS_AND_REDIRECTS, but it 29 // might not be worth the trouble. 30 POPUPS, 31 32 GEOLOCATION, 33 NOTIFICATIONS, 34 AUTO_SELECT_CERTIFICATE, 35 MIXEDSCRIPT, 36 MEDIASTREAM_MIC, 37 MEDIASTREAM_CAMERA, 38 PROTOCOL_HANDLERS, 39 PPAPI_BROKER, 40 AUTOMATIC_DOWNLOADS, 41 MIDI_SYSEX, 42 SSL_CERT_DECISIONS, 43 PROTECTED_MEDIA_IDENTIFIER, 44 APP_BANNER, 45 SITE_ENGAGEMENT, 46 DURABLE_STORAGE, 47 USB_CHOOSER_DATA, 48 BLUETOOTH_GUARD, 49 BACKGROUND_SYNC, 50 AUTOPLAY, 51 IMPORTANT_SITE_INFO, 52 PERMISSION_AUTOBLOCKER_DATA, 53 ADS, 54 55 // Website setting which stores metadata for the subresource filter to aid in 56 // decisions for whether or not to show the UI. 57 ADS_DATA, 58 59 // This is special-cased in the permissions layer to always allow, and as 60 // such doesn't have associated prefs data. 61 MIDI, 62 63 // This content setting type is for caching password protection service's 64 // verdicts of each origin. 65 PASSWORD_PROTECTION, 66 67 // Website setting which stores engagement data for media related to a 68 // specific origin. 69 MEDIA_ENGAGEMENT, 70 71 // Content setting which stores whether or not the site can play audible 72 // sound. This will not block playback but instead the user will not hear it. 73 SOUND, 74 75 // Website setting which stores the list of client hints (and the preference 76 // expiration time for each of the client hints) that the origin requested 77 // the browser to remember. Spec: 78 // http://httpwg.org/http-extensions/client-hints.html#accept-ch-lifetime. 79 // The setting is stored as a dictionary that includes the mapping from 80 // different client hints to their respective expiration times (seconds since 81 // epoch). The browser is expected to send all the unexpired client hints in 82 // the HTTP request headers for every resource requested from that origin. 83 CLIENT_HINTS, 84 85 // Generic Sensor API covering ambient-light-sensor, accelerometer, gyroscope 86 // and magnetometer are all mapped to a single content_settings_type. 87 // Setting for the Generic Sensor API covering ambient-light-sensor, 88 // accelerometer, gyroscope and magnetometer. These are all mapped to a single 89 // ContentSettingsType. 90 SENSORS, 91 92 // Content setting which stores whether or not the user has granted the site 93 // permission to respond to accessibility events, which can be used to 94 // provide a custom accessibility experience. Requires explicit user consent 95 // because some users may not want sites to know they're using assistive 96 // technology. 97 ACCESSIBILITY_EVENTS, 98 99 // Used to store whether the user has ever changed the Flash permission for 100 // a site. 101 PLUGINS_DATA, 102 103 // Used to store whether to allow a website to install a payment handler. 104 PAYMENT_HANDLER, 105 106 // Content setting which stores whether to allow sites to ask for permission 107 // to access USB devices. If this is allowed specific device permissions are 108 // stored under USB_CHOOSER_DATA. 109 USB_GUARD, 110 111 // Nothing is stored in this setting at present. Please refer to 112 // BackgroundFetchPermissionContext for details on how this permission 113 // is ascertained. 114 BACKGROUND_FETCH, 115 116 // Website setting which stores the amount of times the user has dismissed 117 // intent picker UI without explicitly choosing an option. 118 INTENT_PICKER_DISPLAY, 119 120 // Used to store whether to allow a website to detect user active/idle state. 121 IDLE_DETECTION, 122 123 // Content settings for access to serial ports. The "guard" content setting 124 // stores whether to allow sites to ask for permission to access a port. The 125 // permissions granted to access particular ports are stored in the "chooser 126 // data" website setting. 127 SERIAL_GUARD, 128 SERIAL_CHOOSER_DATA, 129 130 // Nothing is stored in this setting at present. Please refer to 131 // PeriodicBackgroundSyncPermissionContext for details on how this permission 132 // is ascertained. 133 PERIODIC_BACKGROUND_SYNC, 134 135 // Content setting which stores whether to allow sites to ask for permission 136 // to do Bluetooth scanning. 137 BLUETOOTH_SCANNING, 138 139 // Content settings for access to HID devices. The "guard" content setting 140 // stores whether to allow sites to ask for permission to access a device. The 141 // permissions granted to access particular devices are stored in the "chooser 142 // data" website setting. 143 HID_GUARD, 144 HID_CHOOSER_DATA, 145 146 // Wake Lock API, which has two lock types: screen and system locks. 147 // Currently, screen locks do not need any additional permission, and system 148 // locks are always denied while the right UI is worked out. 149 WAKE_LOCK_SCREEN, 150 WAKE_LOCK_SYSTEM, 151 152 // Legacy SameSite cookie behavior. This disables SameSiteByDefaultCookies 153 // and CookiesWithoutSameSiteMustBeSecure, and forces the legacy behavior 154 // where cookies that don't specify SameSite are treated as SameSite=None and 155 // SameSite=None cookies are not required to be Secure. 156 // This will also be used to revert to legacy behavior when future changes 157 // in cookie handling are introduced. 158 LEGACY_COOKIE_ACCESS, 159 160 // Content settings which stores whether to allow sites to ask for permission 161 // to save changes to an original file selected by the user through the Native 162 // File System API. 163 NATIVE_FILE_SYSTEM_WRITE_GUARD, 164 165 // Content settings for installed web apps that browsing history may be 166 // inferred from e.g. last update check timestamp. 167 INSTALLED_WEB_APP_METADATA, 168 169 // Used to store whether to allow a website to exchange data with NFC devices. 170 NFC, 171 172 // Website setting to store permissions granted to access particular Bluetooth 173 // devices. 174 BLUETOOTH_CHOOSER_DATA, 175 176 // Full access to the system clipboard (sanitized read without user gesture, 177 // and unsanitized read and write with user gesture). 178 // TODO(https://crbug.com/1027225): Move CLIPBOARD_READ_WRITE uses to be 179 // ordered in the same order as listed in the enum. 180 CLIPBOARD_READ_WRITE, 181 182 // This is special-cased in the permissions layer to always allow, and as 183 // such doesn't have associated prefs data. 184 // TODO(https://crbug.com/1027225): Move CLIPBOARD_SANITIZED_WRITE uses to be 185 // ordered in the same order as listed in the enum. 186 CLIPBOARD_SANITIZED_WRITE, 187 188 // This content setting type is for caching safe browsing real time url 189 // check's verdicts of each origin. 190 SAFE_BROWSING_URL_CHECK_DATA, 191 192 // Used to store whether a site is allowed to request AR or VR sessions with 193 // the WebXr Device API. 194 VR, 195 AR, 196 197 // Content setting which stores whether to allow site to open and read files 198 // and directories selected through the Native File System API. 199 NATIVE_FILE_SYSTEM_READ_GUARD, 200 201 // Access to first party storage in a third-party context. Exceptions are 202 // scoped to the combination of requesting/top-level origin, and are managed 203 // through the Storage Access API. For the time being, this content setting 204 // exists in parallel to third-party cookie rules stored in COOKIES. 205 // TODO(https://crbug.com/989663): Reconcile the two. 206 STORAGE_ACCESS, 207 208 NUM_TYPES, 209 }; 210 211 struct ContentSettingsTypeHash { operatorContentSettingsTypeHash212 size_t operator()(ContentSettingsType type) const { 213 return static_cast<size_t>(type); 214 } 215 }; 216 217 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_TYPES_H_ 218