Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map.cc

Issue 8528031: Fix memory leak in SetDefaultContentSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove Valgrind suppressions. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 false); 203 false);
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 = NULL;
214 if (!content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting( 214 if (setting != CONTENT_SETTING_DEFAULT)
215 ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), 215 value = Value::CreateIntegerValue(setting);
216 content_type, std::string(), value)) { 216 SetWebsiteSetting(
217 delete value; 217 ContentSettingsPattern::Wildcard(),
218 } 218 ContentSettingsPattern::Wildcard(),
219 content_type,
220 std::string(),
221 value);
219 } 222 }
220 223
221 void HostContentSettingsMap::SetWebsiteSetting( 224 void HostContentSettingsMap::SetWebsiteSetting(
222 const ContentSettingsPattern& primary_pattern, 225 const ContentSettingsPattern& primary_pattern,
223 const ContentSettingsPattern& secondary_pattern, 226 const ContentSettingsPattern& secondary_pattern,
224 ContentSettingsType content_type, 227 ContentSettingsType content_type,
225 const std::string& resource_identifier, 228 const std::string& resource_identifier,
226 base::Value* value) { 229 base::Value* value) {
227 DCHECK(IsValueAllowedForType(value, content_type)); 230 DCHECK(IsValueAllowedForType(value, content_type));
228 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || 231 DCHECK(content_settings::SupportsResourceIdentifier(content_type) ||
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 450 }
448 } 451 }
449 452
450 if (info) { 453 if (info) {
451 info->source = content_settings::SETTING_SOURCE_NONE; 454 info->source = content_settings::SETTING_SOURCE_NONE;
452 info->primary_pattern = ContentSettingsPattern(); 455 info->primary_pattern = ContentSettingsPattern();
453 info->secondary_pattern = ContentSettingsPattern(); 456 info->secondary_pattern = ContentSettingsPattern();
454 } 457 }
455 return NULL; 458 return NULL;
456 } 459 }
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/content_settings_default_provider.cc ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698