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

Side by Side Diff: components/content_settings/core/browser/content_settings_registry.cc

Issue 2075103002: Change ContentSettingsType's scoping type and hookup migration code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@do_migration_after_sync
Patch Set: revise test Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/content_settings/core/browser/content_settings_registry.h" 5 #include "components/content_settings/core/browser/content_settings_registry.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // associated with it. 116 // associated with it.
117 117
118 // WARNING: The string names of the permissions passed in below are used to 118 // WARNING: The string names of the permissions passed in below are used to
119 // generate preference names and should never be changed! 119 // generate preference names and should never be changed!
120 120
121 Register(CONTENT_SETTINGS_TYPE_COOKIES, "cookies", CONTENT_SETTING_ALLOW, 121 Register(CONTENT_SETTINGS_TYPE_COOKIES, "cookies", CONTENT_SETTING_ALLOW,
122 WebsiteSettingsInfo::SYNCABLE, 122 WebsiteSettingsInfo::SYNCABLE,
123 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), 123 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme),
124 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, 124 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
125 CONTENT_SETTING_SESSION_ONLY), 125 CONTENT_SETTING_SESSION_ONLY),
126 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE, 126 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE,
127 WebsiteSettingsRegistry::ALL_PLATFORMS, 127 WebsiteSettingsRegistry::ALL_PLATFORMS,
128 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 128 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
129 129
130 Register(CONTENT_SETTINGS_TYPE_IMAGES, "images", CONTENT_SETTING_ALLOW, 130 Register(CONTENT_SETTINGS_TYPE_IMAGES, "images", CONTENT_SETTING_ALLOW,
131 WebsiteSettingsInfo::SYNCABLE, 131 WebsiteSettingsInfo::SYNCABLE,
132 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme, 132 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme,
133 kExtensionScheme), 133 kExtensionScheme),
134 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), 134 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK),
135 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 135 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
136 WebsiteSettingsRegistry::DESKTOP, 136 WebsiteSettingsRegistry::DESKTOP,
137 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 137 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
138 138
139 Register(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript", 139 Register(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript",
140 CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::SYNCABLE, 140 CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::SYNCABLE,
141 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme, 141 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme,
142 kExtensionScheme), 142 kExtensionScheme),
143 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), 143 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK),
144 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 144 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
145 WebsiteSettingsRegistry::DESKTOP | 145 WebsiteSettingsRegistry::DESKTOP |
146 WebsiteSettingsRegistry::PLATFORM_ANDROID, 146 WebsiteSettingsRegistry::PLATFORM_ANDROID,
147 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 147 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
148 148
149 Register(CONTENT_SETTINGS_TYPE_PLUGINS, "plugins", 149 Register(CONTENT_SETTINGS_TYPE_PLUGINS, "plugins",
150 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, 150 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
151 WebsiteSettingsInfo::SYNCABLE, 151 WebsiteSettingsInfo::SYNCABLE,
152 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), 152 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme),
153 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, 153 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
154 CONTENT_SETTING_ASK, 154 CONTENT_SETTING_ASK,
155 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT), 155 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT),
156 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 156 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
157 WebsiteSettingsRegistry::DESKTOP, 157 WebsiteSettingsRegistry::DESKTOP,
158 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 158 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
159 159
160 Register(CONTENT_SETTINGS_TYPE_POPUPS, "popups", CONTENT_SETTING_BLOCK, 160 Register(CONTENT_SETTINGS_TYPE_POPUPS, "popups", CONTENT_SETTING_BLOCK,
161 WebsiteSettingsInfo::SYNCABLE, 161 WebsiteSettingsInfo::SYNCABLE,
162 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme, 162 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme,
163 kExtensionScheme), 163 kExtensionScheme),
164 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), 164 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK),
165 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 165 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
166 WebsiteSettingsRegistry::ALL_PLATFORMS, 166 WebsiteSettingsRegistry::ALL_PLATFORMS,
167 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 167 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
168 168
169 Register(CONTENT_SETTINGS_TYPE_GEOLOCATION, "geolocation", 169 Register(CONTENT_SETTINGS_TYPE_GEOLOCATION, "geolocation",
170 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, 170 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE,
171 WhitelistedSchemes(), 171 WhitelistedSchemes(),
172 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, 172 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
173 CONTENT_SETTING_ASK), 173 CONTENT_SETTING_ASK),
174 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, 174 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE,
175 WebsiteSettingsRegistry::DESKTOP | 175 WebsiteSettingsRegistry::DESKTOP |
(...skipping 19 matching lines...) Expand all
195 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, 195 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE,
196 WebsiteSettingsRegistry::DESKTOP | 196 WebsiteSettingsRegistry::DESKTOP |
197 WebsiteSettingsRegistry::PLATFORM_ANDROID, 197 WebsiteSettingsRegistry::PLATFORM_ANDROID,
198 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 198 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
199 199
200 Register(CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock", CONTENT_SETTING_ASK, 200 Register(CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock", CONTENT_SETTING_ASK,
201 WebsiteSettingsInfo::SYNCABLE, 201 WebsiteSettingsInfo::SYNCABLE,
202 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), 202 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme),
203 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, 203 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
204 CONTENT_SETTING_ASK), 204 CONTENT_SETTING_ASK),
205 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 205 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
206 WebsiteSettingsRegistry::DESKTOP, 206 WebsiteSettingsRegistry::DESKTOP,
207 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 207 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
208 208
209 Register(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic", 209 Register(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic",
210 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, 210 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE,
211 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), 211 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme),
212 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, 212 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
213 CONTENT_SETTING_ASK), 213 CONTENT_SETTING_ASK),
214 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, 214 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE,
215 WebsiteSettingsRegistry::DESKTOP | 215 WebsiteSettingsRegistry::DESKTOP |
(...skipping 18 matching lines...) Expand all
234 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, 234 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE,
235 WebsiteSettingsRegistry::DESKTOP, 235 WebsiteSettingsRegistry::DESKTOP,
236 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 236 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
237 237
238 Register(CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automatic-downloads", 238 Register(CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automatic-downloads",
239 CONTENT_SETTING_ASK, WebsiteSettingsInfo::SYNCABLE, 239 CONTENT_SETTING_ASK, WebsiteSettingsInfo::SYNCABLE,
240 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme, 240 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme,
241 kExtensionScheme), 241 kExtensionScheme),
242 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, 242 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
243 CONTENT_SETTING_ASK), 243 CONTENT_SETTING_ASK),
244 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 244 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
245 WebsiteSettingsRegistry::DESKTOP | 245 WebsiteSettingsRegistry::DESKTOP |
246 WebsiteSettingsRegistry::PLATFORM_ANDROID, 246 WebsiteSettingsRegistry::PLATFORM_ANDROID,
247 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 247 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
248 248
249 Register(CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex", CONTENT_SETTING_ASK, 249 Register(CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex", CONTENT_SETTING_ASK,
250 WebsiteSettingsInfo::SYNCABLE, WhitelistedSchemes(), 250 WebsiteSettingsInfo::SYNCABLE, WhitelistedSchemes(),
251 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, 251 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
252 CONTENT_SETTING_ASK), 252 CONTENT_SETTING_ASK),
253 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, 253 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE,
254 WebsiteSettingsRegistry::DESKTOP | 254 WebsiteSettingsRegistry::DESKTOP |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 WebsiteSettingsRegistry::PLATFORM_ANDROID, 309 WebsiteSettingsRegistry::PLATFORM_ANDROID,
310 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 310 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
311 311
312 // Content settings that aren't used to store any data. TODO(raymes): use a 312 // Content settings that aren't used to store any data. TODO(raymes): use a
313 // different mechanism rather than content settings to represent these. 313 // different mechanism rather than content settings to represent these.
314 // Since nothing is stored in them, there is no real point in them being a 314 // Since nothing is stored in them, there is no real point in them being a
315 // content setting. 315 // content setting.
316 Register(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "protocol-handler", 316 Register(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "protocol-handler",
317 CONTENT_SETTING_DEFAULT, WebsiteSettingsInfo::UNSYNCABLE, 317 CONTENT_SETTING_DEFAULT, WebsiteSettingsInfo::UNSYNCABLE,
318 WhitelistedSchemes(), ValidSettings(), 318 WhitelistedSchemes(), ValidSettings(),
319 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 319 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
320 WebsiteSettingsRegistry::DESKTOP, 320 WebsiteSettingsRegistry::DESKTOP,
321 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 321 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
322 322
323 Register(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, "mixed-script", 323 Register(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, "mixed-script",
324 CONTENT_SETTING_DEFAULT, WebsiteSettingsInfo::UNSYNCABLE, 324 CONTENT_SETTING_DEFAULT, WebsiteSettingsInfo::UNSYNCABLE,
325 WhitelistedSchemes(), ValidSettings(), 325 WhitelistedSchemes(), ValidSettings(),
326 WebsiteSettingsInfo::TOP_LEVEL_DOMAIN_ONLY_SCOPE, 326 WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE,
327 WebsiteSettingsRegistry::DESKTOP, 327 WebsiteSettingsRegistry::DESKTOP,
328 ContentSettingsInfo::INHERIT_IN_INCOGNITO); 328 ContentSettingsInfo::INHERIT_IN_INCOGNITO);
329 329
330 Register(CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD, "bluetooth-guard", 330 Register(CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD, "bluetooth-guard",
331 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, 331 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE,
332 WhitelistedSchemes(), 332 WhitelistedSchemes(),
333 ValidSettings(CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), 333 ValidSettings(CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK),
334 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, 334 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE,
335 WebsiteSettingsRegistry::DESKTOP | 335 WebsiteSettingsRegistry::DESKTOP |
336 WebsiteSettingsRegistry::PLATFORM_ANDROID, 336 WebsiteSettingsRegistry::PLATFORM_ANDROID,
(...skipping 30 matching lines...) Expand all
367 if (!website_settings_info) 367 if (!website_settings_info)
368 return; 368 return;
369 369
370 DCHECK(!ContainsKey(content_settings_info_, type)); 370 DCHECK(!ContainsKey(content_settings_info_, type));
371 content_settings_info_[type] = base::WrapUnique( 371 content_settings_info_[type] = base::WrapUnique(
372 new ContentSettingsInfo(website_settings_info, whitelisted_schemes, 372 new ContentSettingsInfo(website_settings_info, whitelisted_schemes,
373 valid_settings, incognito_behavior)); 373 valid_settings, incognito_behavior));
374 } 374 }
375 375
376 } // namespace content_settings 376 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698