Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 CONTENT_SETTING_ASK), | 166 CONTENT_SETTING_ASK), |
| 167 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, | 167 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, |
| 168 ContentSettingsInfo::INHERIT_IN_INCOGNITO); | 168 ContentSettingsInfo::INHERIT_IN_INCOGNITO); |
| 169 | 169 |
| 170 Register(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications", | 170 Register(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications", |
| 171 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, | 171 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, |
| 172 WhitelistedSchemes(), | 172 WhitelistedSchemes(), |
| 173 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, | 173 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, |
| 174 CONTENT_SETTING_ASK), | 174 CONTENT_SETTING_ASK), |
| 175 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, | 175 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, |
| 176 ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW); | 176 ContentSettingsInfo::DENY_IN_INCOGNITO_AFTER_DELAY); |
| 177 | 177 |
| 178 Register(CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen", CONTENT_SETTING_ASK, | 178 Register(CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen", CONTENT_SETTING_ASK, |
| 179 WebsiteSettingsInfo::SYNCABLE, | 179 WebsiteSettingsInfo::SYNCABLE, |
| 180 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), | 180 WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), |
| 181 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK), | 181 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK), |
| 182 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, | 182 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, |
| 183 ContentSettingsInfo::INHERIT_IN_INCOGNITO); | 183 ContentSettingsInfo::INHERIT_IN_INCOGNITO); |
| 184 | 184 |
| 185 Register(CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock", CONTENT_SETTING_ASK, | 185 Register(CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock", CONTENT_SETTING_ASK, |
| 186 WebsiteSettingsInfo::SYNCABLE, | 186 WebsiteSettingsInfo::SYNCABLE, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 CONTENT_SETTING_ASK), | 229 CONTENT_SETTING_ASK), |
| 230 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, | 230 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, |
| 231 ContentSettingsInfo::INHERIT_IN_INCOGNITO); | 231 ContentSettingsInfo::INHERIT_IN_INCOGNITO); |
| 232 | 232 |
| 233 Register(CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging", | 233 Register(CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging", |
| 234 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, | 234 CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, |
| 235 WhitelistedSchemes(), | 235 WhitelistedSchemes(), |
| 236 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, | 236 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, |
| 237 CONTENT_SETTING_ASK), | 237 CONTENT_SETTING_ASK), |
| 238 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, | 238 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, |
| 239 ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW); | 239 ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW); |
|
raymes
2016/01/11 00:41:11
Should we change this to DENY_IN_INCOGNITO_AFTER_D
johnme
2016/01/11 13:53:52
Done (Push shouldn't be auto-denied directly, it n
| |
| 240 | 240 |
| 241 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 241 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 242 Register(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 242 Register(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
| 243 "protected-media-identifier", CONTENT_SETTING_ASK, | 243 "protected-media-identifier", CONTENT_SETTING_ASK, |
| 244 WebsiteSettingsInfo::UNSYNCABLE, WhitelistedSchemes(), | 244 WebsiteSettingsInfo::UNSYNCABLE, WhitelistedSchemes(), |
| 245 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, | 245 ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, |
| 246 CONTENT_SETTING_ASK), | 246 CONTENT_SETTING_ASK), |
| 247 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, | 247 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, |
| 248 ContentSettingsInfo::INHERIT_IN_INCOGNITO); | 248 ContentSettingsInfo::INHERIT_IN_INCOGNITO); |
| 249 #endif | 249 #endif |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 ContentSettingsType type, | 283 ContentSettingsType type, |
| 284 const std::string& name, | 284 const std::string& name, |
| 285 ContentSetting initial_default_value, | 285 ContentSetting initial_default_value, |
| 286 WebsiteSettingsInfo::SyncStatus sync_status, | 286 WebsiteSettingsInfo::SyncStatus sync_status, |
| 287 const std::vector<std::string>& whitelisted_schemes, | 287 const std::vector<std::string>& whitelisted_schemes, |
| 288 const std::set<ContentSetting>& valid_settings, | 288 const std::set<ContentSetting>& valid_settings, |
| 289 WebsiteSettingsInfo::ScopingType scoping_type, | 289 WebsiteSettingsInfo::ScopingType scoping_type, |
| 290 ContentSettingsInfo::IncognitoBehavior incognito_behavior) { | 290 ContentSettingsInfo::IncognitoBehavior incognito_behavior) { |
| 291 // Ensure that nothing has been registered yet for the given type. | 291 // Ensure that nothing has been registered yet for the given type. |
| 292 DCHECK(!website_settings_registry_->Get(type)); | 292 DCHECK(!website_settings_registry_->Get(type)); |
| 293 DCHECK(incognito_behavior | 293 DCHECK(incognito_behavior == ContentSettingsInfo::INHERIT_IN_INCOGNITO || |
| 294 != ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW | 294 ContainsKey(valid_settings, CONTENT_SETTING_ASK)) |
| 295 || ContainsKey(valid_settings, CONTENT_SETTING_ASK)) | 295 << "If INHERIT_IN_INCOGNITO_EXCEPT_ALLOW or DENY_IN_INCOGNITO_AFTER_DELAY" |
| 296 << "If INHERIT_IN_INCOGNITO_EXCEPT_ALLOW is set, ASK must be listed as a " | 296 " is set, ASK must be listed as a valid setting."; |
| 297 "valid setting."; | |
| 298 scoped_ptr<base::Value> default_value( | 297 scoped_ptr<base::Value> default_value( |
| 299 new base::FundamentalValue(static_cast<int>(initial_default_value))); | 298 new base::FundamentalValue(static_cast<int>(initial_default_value))); |
| 300 const WebsiteSettingsInfo* website_settings_info = | 299 const WebsiteSettingsInfo* website_settings_info = |
| 301 website_settings_registry_->Register( | 300 website_settings_registry_->Register( |
| 302 type, name, std::move(default_value), sync_status, | 301 type, name, std::move(default_value), sync_status, |
| 303 WebsiteSettingsInfo::NOT_LOSSY, scoping_type); | 302 WebsiteSettingsInfo::NOT_LOSSY, scoping_type); |
| 304 DCHECK(!ContainsKey(content_settings_info_, type)); | 303 DCHECK(!ContainsKey(content_settings_info_, type)); |
| 305 content_settings_info_[type] = make_scoped_ptr( | 304 content_settings_info_[type] = make_scoped_ptr( |
| 306 new ContentSettingsInfo(website_settings_info, whitelisted_schemes, | 305 new ContentSettingsInfo(website_settings_info, whitelisted_schemes, |
| 307 valid_settings, incognito_behavior)); | 306 valid_settings, incognito_behavior)); |
| 308 } | 307 } |
| 309 | 308 |
| 310 } // namespace content_settings | 309 } // namespace content_settings |
| OLD | NEW |