OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 void HostContentSettingsMap::SetDefaultContentSetting( | 207 void HostContentSettingsMap::SetDefaultContentSetting( |
208 ContentSettingsType content_type, | 208 ContentSettingsType content_type, |
209 ContentSetting setting) { | 209 ContentSetting setting) { |
210 DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE); | 210 DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE); |
211 DCHECK(IsSettingAllowedForType(setting, content_type)); | 211 DCHECK(IsSettingAllowedForType(setting, content_type)); |
212 | 212 |
213 base::Value* value = Value::CreateIntegerValue(setting); | 213 base::Value* value = Value::CreateIntegerValue(setting); |
214 content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting( | 214 if (!content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting( |
215 ContentSettingsPattern::Wildcard(), | 215 ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), |
216 ContentSettingsPattern::Wildcard(), | 216 content_type, std::string(), value)) { |
217 content_type, | 217 delete value; |
218 std::string(), | 218 } |
219 value); | |
220 } | 219 } |
221 | 220 |
222 void HostContentSettingsMap::SetWebsiteSetting( | 221 void HostContentSettingsMap::SetWebsiteSetting( |
223 const ContentSettingsPattern& primary_pattern, | 222 const ContentSettingsPattern& primary_pattern, |
224 const ContentSettingsPattern& secondary_pattern, | 223 const ContentSettingsPattern& secondary_pattern, |
225 ContentSettingsType content_type, | 224 ContentSettingsType content_type, |
226 const std::string& resource_identifier, | 225 const std::string& resource_identifier, |
227 base::Value* value) { | 226 base::Value* value) { |
228 DCHECK(IsValueAllowedForType(value, content_type)); | 227 DCHECK(IsValueAllowedForType(value, content_type)); |
229 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || | 228 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 441 } |
443 } | 442 } |
444 | 443 |
445 if (info) { | 444 if (info) { |
446 info->source = content_settings::SETTING_SOURCE_NONE; | 445 info->source = content_settings::SETTING_SOURCE_NONE; |
447 info->primary_pattern = ContentSettingsPattern(); | 446 info->primary_pattern = ContentSettingsPattern(); |
448 info->secondary_pattern = ContentSettingsPattern(); | 447 info->secondary_pattern = ContentSettingsPattern(); |
449 } | 448 } |
450 return NULL; | 449 return NULL; |
451 } | 450 } |
OLD | NEW |