| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/host_content_settings_map.h" | 5 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 | 323 |
| 324 void HostContentSettingsMap::SetDefaultContentSetting( | 324 void HostContentSettingsMap::SetDefaultContentSetting( |
| 325 ContentSettingsType content_type, | 325 ContentSettingsType content_type, |
| 326 ContentSetting setting) { | 326 ContentSetting setting) { |
| 327 std::unique_ptr<base::Value> value; | 327 std::unique_ptr<base::Value> value; |
| 328 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. | 328 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. |
| 329 if (setting != CONTENT_SETTING_DEFAULT) { | 329 if (setting != CONTENT_SETTING_DEFAULT) { |
| 330 DCHECK(IsDefaultSettingAllowedForType(setting, content_type)); | 330 DCHECK(IsDefaultSettingAllowedForType(setting, content_type)); |
| 331 value.reset(new base::FundamentalValue(setting)); | 331 value.reset(new base::Value(setting)); |
| 332 } | 332 } |
| 333 SetWebsiteSettingCustomScope(ContentSettingsPattern::Wildcard(), | 333 SetWebsiteSettingCustomScope(ContentSettingsPattern::Wildcard(), |
| 334 ContentSettingsPattern::Wildcard(), content_type, | 334 ContentSettingsPattern::Wildcard(), content_type, |
| 335 std::string(), std::move(value)); | 335 std::string(), std::move(value)); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void HostContentSettingsMap::SetWebsiteSettingDefaultScope( | 338 void HostContentSettingsMap::SetWebsiteSettingDefaultScope( |
| 339 const GURL& primary_url, | 339 const GURL& primary_url, |
| 340 const GURL& secondary_url, | 340 const GURL& secondary_url, |
| 341 ContentSettingsType content_type, | 341 ContentSettingsType content_type, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS)) { | 431 content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS)) { |
| 432 UpdateLastUsageByPattern(primary_pattern, secondary_pattern, content_type); | 432 UpdateLastUsageByPattern(primary_pattern, secondary_pattern, content_type); |
| 433 } | 433 } |
| 434 | 434 |
| 435 std::unique_ptr<base::Value> value; | 435 std::unique_ptr<base::Value> value; |
| 436 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. | 436 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. |
| 437 if (setting != CONTENT_SETTING_DEFAULT) { | 437 if (setting != CONTENT_SETTING_DEFAULT) { |
| 438 DCHECK(content_settings::ContentSettingsRegistry::GetInstance() | 438 DCHECK(content_settings::ContentSettingsRegistry::GetInstance() |
| 439 ->Get(content_type) | 439 ->Get(content_type) |
| 440 ->IsSettingValid(setting)); | 440 ->IsSettingValid(setting)); |
| 441 value.reset(new base::FundamentalValue(setting)); | 441 value.reset(new base::Value(setting)); |
| 442 } | 442 } |
| 443 SetWebsiteSettingCustomScope(primary_pattern, secondary_pattern, content_type, | 443 SetWebsiteSettingCustomScope(primary_pattern, secondary_pattern, content_type, |
| 444 resource_identifier, std::move(value)); | 444 resource_identifier, std::move(value)); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void HostContentSettingsMap::SetContentSettingDefaultScope( | 447 void HostContentSettingsMap::SetContentSettingDefaultScope( |
| 448 const GURL& primary_url, | 448 const GURL& primary_url, |
| 449 const GURL& secondary_url, | 449 const GURL& secondary_url, |
| 450 ContentSettingsType content_type, | 450 ContentSettingsType content_type, |
| 451 const std::string& resource_identifier, | 451 const std::string& resource_identifier, |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 content_settings_info->whitelisted_schemes()) { | 869 content_settings_info->whitelisted_schemes()) { |
| 870 DCHECK(SchemeCanBeWhitelisted(scheme)); | 870 DCHECK(SchemeCanBeWhitelisted(scheme)); |
| 871 | 871 |
| 872 if (primary_url.SchemeIs(scheme.c_str())) { | 872 if (primary_url.SchemeIs(scheme.c_str())) { |
| 873 if (info) { | 873 if (info) { |
| 874 info->source = content_settings::SETTING_SOURCE_WHITELIST; | 874 info->source = content_settings::SETTING_SOURCE_WHITELIST; |
| 875 info->primary_pattern = ContentSettingsPattern::Wildcard(); | 875 info->primary_pattern = ContentSettingsPattern::Wildcard(); |
| 876 info->secondary_pattern = ContentSettingsPattern::Wildcard(); | 876 info->secondary_pattern = ContentSettingsPattern::Wildcard(); |
| 877 } | 877 } |
| 878 return std::unique_ptr<base::Value>( | 878 return std::unique_ptr<base::Value>( |
| 879 new base::FundamentalValue(CONTENT_SETTING_ALLOW)); | 879 new base::Value(CONTENT_SETTING_ALLOW)); |
| 880 } | 880 } |
| 881 } | 881 } |
| 882 } | 882 } |
| 883 | 883 |
| 884 return GetWebsiteSettingInternal(primary_url, | 884 return GetWebsiteSettingInternal(primary_url, |
| 885 secondary_url, | 885 secondary_url, |
| 886 content_type, | 886 content_type, |
| 887 resource_identifier, | 887 resource_identifier, |
| 888 info); | 888 info); |
| 889 } | 889 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 if (primary_pattern) | 989 if (primary_pattern) |
| 990 *primary_pattern = rule.primary_pattern; | 990 *primary_pattern = rule.primary_pattern; |
| 991 if (secondary_pattern) | 991 if (secondary_pattern) |
| 992 *secondary_pattern = rule.secondary_pattern; | 992 *secondary_pattern = rule.secondary_pattern; |
| 993 return base::WrapUnique(rule.value.get()->DeepCopy()); | 993 return base::WrapUnique(rule.value.get()->DeepCopy()); |
| 994 } | 994 } |
| 995 } | 995 } |
| 996 } | 996 } |
| 997 return std::unique_ptr<base::Value>(); | 997 return std::unique_ptr<base::Value>(); |
| 998 } | 998 } |
| OLD | NEW |