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/content_settings_utils.h" | 5 #include "components/content_settings/core/browser/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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 *setting = CONTENT_SETTING_DEFAULT; | 162 *setting = CONTENT_SETTING_DEFAULT; |
163 return true; | 163 return true; |
164 } | 164 } |
165 int int_value = -1; | 165 int int_value = -1; |
166 if (!value->GetAsInteger(&int_value)) | 166 if (!value->GetAsInteger(&int_value)) |
167 return false; | 167 return false; |
168 *setting = IntToContentSetting(int_value); | 168 *setting = IntToContentSetting(int_value); |
169 return *setting != CONTENT_SETTING_DEFAULT; | 169 return *setting != CONTENT_SETTING_DEFAULT; |
170 } | 170 } |
171 | 171 |
| 172 scoped_ptr<base::Value> ContentSettingToValue(ContentSetting setting) { |
| 173 if (setting <= CONTENT_SETTING_DEFAULT || |
| 174 setting >= CONTENT_SETTING_NUM_SETTINGS) { |
| 175 return nullptr; |
| 176 } |
| 177 return make_scoped_ptr(new base::FundamentalValue(setting)); |
| 178 } |
| 179 |
172 base::Value* GetContentSettingValueAndPatterns( | 180 base::Value* GetContentSettingValueAndPatterns( |
173 const ProviderInterface* provider, | 181 const ProviderInterface* provider, |
174 const GURL& primary_url, | 182 const GURL& primary_url, |
175 const GURL& secondary_url, | 183 const GURL& secondary_url, |
176 ContentSettingsType content_type, | 184 ContentSettingsType content_type, |
177 const std::string& resource_identifier, | 185 const std::string& resource_identifier, |
178 bool include_incognito, | 186 bool include_incognito, |
179 ContentSettingsPattern* primary_pattern, | 187 ContentSettingsPattern* primary_pattern, |
180 ContentSettingsPattern* secondary_pattern) { | 188 ContentSettingsPattern* secondary_pattern) { |
181 if (include_incognito) { | 189 if (include_incognito) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 228 |
221 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 229 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
222 RendererContentSettingRules* rules) { | 230 RendererContentSettingRules* rules) { |
223 map->GetSettingsForOneType( | 231 map->GetSettingsForOneType( |
224 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules)); | 232 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules)); |
225 map->GetSettingsForOneType( | 233 map->GetSettingsForOneType( |
226 CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules)); | 234 CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules)); |
227 } | 235 } |
228 | 236 |
229 } // namespace content_settings | 237 } // namespace content_settings |
OLD | NEW |