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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 const std::string& name, | 332 const std::string& name, |
333 ContentSetting initial_default_value, | 333 ContentSetting initial_default_value, |
334 WebsiteSettingsInfo::SyncStatus sync_status, | 334 WebsiteSettingsInfo::SyncStatus sync_status, |
335 const std::vector<std::string>& whitelisted_schemes, | 335 const std::vector<std::string>& whitelisted_schemes, |
336 const std::set<ContentSetting>& valid_settings, | 336 const std::set<ContentSetting>& valid_settings, |
337 WebsiteSettingsInfo::ScopingType scoping_type, | 337 WebsiteSettingsInfo::ScopingType scoping_type, |
338 Platforms platforms, | 338 Platforms platforms, |
339 ContentSettingsInfo::IncognitoBehavior incognito_behavior) { | 339 ContentSettingsInfo::IncognitoBehavior incognito_behavior) { |
340 // Ensure that nothing has been registered yet for the given type. | 340 // Ensure that nothing has been registered yet for the given type. |
341 DCHECK(!website_settings_registry_->Get(type)); | 341 DCHECK(!website_settings_registry_->Get(type)); |
342 DCHECK(incognito_behavior | 342 DCHECK(incognito_behavior != |
343 != ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW | 343 ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW || |
344 || ContainsKey(valid_settings, CONTENT_SETTING_ASK)) | 344 base::ContainsKey(valid_settings, CONTENT_SETTING_ASK)) |
345 << "If INHERIT_IN_INCOGNITO_EXCEPT_ALLOW is set, ASK must be listed as a " | 345 << "If INHERIT_IN_INCOGNITO_EXCEPT_ALLOW is set, ASK must be listed as a " |
346 "valid setting."; | 346 "valid setting."; |
347 std::unique_ptr<base::Value> default_value( | 347 std::unique_ptr<base::Value> default_value( |
348 new base::FundamentalValue(static_cast<int>(initial_default_value))); | 348 new base::FundamentalValue(static_cast<int>(initial_default_value))); |
349 const WebsiteSettingsInfo* website_settings_info = | 349 const WebsiteSettingsInfo* website_settings_info = |
350 website_settings_registry_->Register( | 350 website_settings_registry_->Register( |
351 type, name, std::move(default_value), sync_status, | 351 type, name, std::move(default_value), sync_status, |
352 WebsiteSettingsInfo::NOT_LOSSY, scoping_type, platforms, | 352 WebsiteSettingsInfo::NOT_LOSSY, scoping_type, platforms, |
353 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); | 353 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
354 | 354 |
355 // WebsiteSettingsInfo::Register() will return nullptr if content setting type | 355 // WebsiteSettingsInfo::Register() will return nullptr if content setting type |
356 // is not used on the current platform and doesn't need to be registered. | 356 // is not used on the current platform and doesn't need to be registered. |
357 if (!website_settings_info) | 357 if (!website_settings_info) |
358 return; | 358 return; |
359 | 359 |
360 DCHECK(!ContainsKey(content_settings_info_, type)); | 360 DCHECK(!base::ContainsKey(content_settings_info_, type)); |
361 content_settings_info_[type] = base::WrapUnique( | 361 content_settings_info_[type] = base::WrapUnique( |
362 new ContentSettingsInfo(website_settings_info, whitelisted_schemes, | 362 new ContentSettingsInfo(website_settings_info, whitelisted_schemes, |
363 valid_settings, incognito_behavior)); | 363 valid_settings, incognito_behavior)); |
364 } | 364 } |
365 | 365 |
366 } // namespace content_settings | 366 } // namespace content_settings |
OLD | NEW |