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

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

Issue 8539004: Replace SetContentSetting method of the content_settings::Provider interface with GetWebsiteSetting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " 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/content_settings_utils.h" 5 #include "chrome/browser/content_settings/content_settings_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 *setting = CONTENT_SETTING_DEFAULT; 114 *setting = CONTENT_SETTING_DEFAULT;
115 return true; 115 return true;
116 } 116 }
117 int int_value = -1; 117 int int_value = -1;
118 if (!value->GetAsInteger(&int_value)) 118 if (!value->GetAsInteger(&int_value))
119 return false; 119 return false;
120 *setting = IntToContentSetting(int_value); 120 *setting = IntToContentSetting(int_value);
121 return *setting != CONTENT_SETTING_DEFAULT; 121 return *setting != CONTENT_SETTING_DEFAULT;
122 } 122 }
123 123
124 bool ValueEqualsContentSetting(const base::Value* value,
125 ContentSetting setting) {
Bernhard Bauer 2011/11/11 14:00:40 Couldn't you just implement this in terms of |Valu
markusheintz_ 2011/11/14 11:15:10 I removed this method again. Since using ValueToCo
126 if (value) {
127 DCHECK(value->GetType() == base::Value::TYPE_INTEGER);
Bernhard Bauer 2011/11/11 14:00:40 This method DCHECKS if |value| is not an integer F
markusheintz_ 2011/11/14 11:15:10 Ahhh... these last minute code changes. Anyway thi
128 int int_value;
129 bool success = value->GetAsInteger(&int_value);
130 if (success)
131 return ContentSetting(int_value == setting);
Bernhard Bauer 2011/11/11 14:00:40 Ooooooh. I'm going to pretend I didn't see this li
markusheintz_ 2011/11/14 11:15:10 No No No I did not write this :(. This was a chang
132 NOTREACHED();
133 }
134 return false;
135 }
136
124 base::Value* GetContentSettingValueAndPatterns( 137 base::Value* GetContentSettingValueAndPatterns(
125 const ProviderInterface* provider, 138 const ProviderInterface* provider,
126 const GURL& primary_url, 139 const GURL& primary_url,
127 const GURL& secondary_url, 140 const GURL& secondary_url,
128 ContentSettingsType content_type, 141 ContentSettingsType content_type,
129 const std::string& resource_identifier, 142 const std::string& resource_identifier,
130 bool include_incognito, 143 bool include_incognito,
131 ContentSettingsPattern* primary_pattern, 144 ContentSettingsPattern* primary_pattern,
132 ContentSettingsPattern* secondary_pattern) { 145 ContentSettingsPattern* secondary_pattern) {
133 if (include_incognito) { 146 if (include_incognito) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 const std::string& resource_identifier, 201 const std::string& resource_identifier,
189 bool include_incognito) { 202 bool include_incognito) {
190 scoped_ptr<base::Value> value( 203 scoped_ptr<base::Value> value(
191 GetContentSettingValue(provider, primary_url, secondary_url, 204 GetContentSettingValue(provider, primary_url, secondary_url,
192 content_type, resource_identifier, 205 content_type, resource_identifier,
193 include_incognito)); 206 include_incognito));
194 return ValueToContentSetting(value.get()); 207 return ValueToContentSetting(value.get());
195 } 208 }
196 209
197 } // namespace content_settings 210 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698