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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 void HostContentSettingsMap::SetDefaultContentSetting( | 344 void HostContentSettingsMap::SetDefaultContentSetting( |
345 ContentSettingsType content_type, | 345 ContentSettingsType content_type, |
346 ContentSetting setting) { | 346 ContentSetting setting) { |
347 std::unique_ptr<base::Value> value; | 347 std::unique_ptr<base::Value> value; |
348 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. | 348 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. |
349 if (setting != CONTENT_SETTING_DEFAULT) { | 349 if (setting != CONTENT_SETTING_DEFAULT) { |
350 DCHECK(IsDefaultSettingAllowedForType(setting, content_type)); | 350 DCHECK(IsDefaultSettingAllowedForType(setting, content_type)); |
351 value.reset(new base::FundamentalValue(setting)); | 351 value.reset(new base::Value(setting)); |
352 } | 352 } |
353 SetWebsiteSettingCustomScope(ContentSettingsPattern::Wildcard(), | 353 SetWebsiteSettingCustomScope(ContentSettingsPattern::Wildcard(), |
354 ContentSettingsPattern::Wildcard(), content_type, | 354 ContentSettingsPattern::Wildcard(), content_type, |
355 std::string(), std::move(value)); | 355 std::string(), std::move(value)); |
356 } | 356 } |
357 | 357 |
358 void HostContentSettingsMap::SetWebsiteSettingDefaultScope( | 358 void HostContentSettingsMap::SetWebsiteSettingDefaultScope( |
359 const GURL& primary_url, | 359 const GURL& primary_url, |
360 const GURL& secondary_url, | 360 const GURL& secondary_url, |
361 ContentSettingsType content_type, | 361 ContentSettingsType content_type, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 ContentSetting setting) { | 464 ContentSetting setting) { |
465 DCHECK(content_settings::ContentSettingsRegistry::GetInstance()->Get( | 465 DCHECK(content_settings::ContentSettingsRegistry::GetInstance()->Get( |
466 content_type)); | 466 content_type)); |
467 | 467 |
468 std::unique_ptr<base::Value> value; | 468 std::unique_ptr<base::Value> value; |
469 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. | 469 // A value of CONTENT_SETTING_DEFAULT implies deleting the content setting. |
470 if (setting != CONTENT_SETTING_DEFAULT) { | 470 if (setting != CONTENT_SETTING_DEFAULT) { |
471 DCHECK(content_settings::ContentSettingsRegistry::GetInstance() | 471 DCHECK(content_settings::ContentSettingsRegistry::GetInstance() |
472 ->Get(content_type) | 472 ->Get(content_type) |
473 ->IsSettingValid(setting)); | 473 ->IsSettingValid(setting)); |
474 value.reset(new base::FundamentalValue(setting)); | 474 value.reset(new base::Value(setting)); |
475 } | 475 } |
476 SetWebsiteSettingCustomScope(primary_pattern, secondary_pattern, content_type, | 476 SetWebsiteSettingCustomScope(primary_pattern, secondary_pattern, content_type, |
477 resource_identifier, std::move(value)); | 477 resource_identifier, std::move(value)); |
478 } | 478 } |
479 | 479 |
480 void HostContentSettingsMap::SetContentSettingDefaultScope( | 480 void HostContentSettingsMap::SetContentSettingDefaultScope( |
481 const GURL& primary_url, | 481 const GURL& primary_url, |
482 const GURL& secondary_url, | 482 const GURL& secondary_url, |
483 ContentSettingsType content_type, | 483 ContentSettingsType content_type, |
484 const std::string& resource_identifier, | 484 const std::string& resource_identifier, |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 content_settings_info->whitelisted_schemes()) { | 794 content_settings_info->whitelisted_schemes()) { |
795 DCHECK(SchemeCanBeWhitelisted(scheme)); | 795 DCHECK(SchemeCanBeWhitelisted(scheme)); |
796 | 796 |
797 if (primary_url.SchemeIs(scheme.c_str())) { | 797 if (primary_url.SchemeIs(scheme.c_str())) { |
798 if (info) { | 798 if (info) { |
799 info->source = content_settings::SETTING_SOURCE_WHITELIST; | 799 info->source = content_settings::SETTING_SOURCE_WHITELIST; |
800 info->primary_pattern = ContentSettingsPattern::Wildcard(); | 800 info->primary_pattern = ContentSettingsPattern::Wildcard(); |
801 info->secondary_pattern = ContentSettingsPattern::Wildcard(); | 801 info->secondary_pattern = ContentSettingsPattern::Wildcard(); |
802 } | 802 } |
803 return std::unique_ptr<base::Value>( | 803 return std::unique_ptr<base::Value>( |
804 new base::FundamentalValue(CONTENT_SETTING_ALLOW)); | 804 new base::Value(CONTENT_SETTING_ALLOW)); |
805 } | 805 } |
806 } | 806 } |
807 } | 807 } |
808 | 808 |
809 return GetWebsiteSettingInternal(primary_url, | 809 return GetWebsiteSettingInternal(primary_url, |
810 secondary_url, | 810 secondary_url, |
811 content_type, | 811 content_type, |
812 resource_identifier, | 812 resource_identifier, |
813 info); | 813 info); |
814 } | 814 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 if (primary_pattern) | 914 if (primary_pattern) |
915 *primary_pattern = rule.primary_pattern; | 915 *primary_pattern = rule.primary_pattern; |
916 if (secondary_pattern) | 916 if (secondary_pattern) |
917 *secondary_pattern = rule.secondary_pattern; | 917 *secondary_pattern = rule.secondary_pattern; |
918 return base::WrapUnique(rule.value.get()->DeepCopy()); | 918 return base::WrapUnique(rule.value.get()->DeepCopy()); |
919 } | 919 } |
920 } | 920 } |
921 } | 921 } |
922 return std::unique_ptr<base::Value>(); | 922 return std::unique_ptr<base::Value>(); |
923 } | 923 } |
OLD | NEW |