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/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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/content_settings/content_settings_provider.h" | 15 #include "chrome/browser/content_settings/content_settings_provider.h" |
16 #include "chrome/browser/content_settings/content_settings_rule.h" | 16 #include "chrome/browser/content_settings/content_settings_rule.h" |
17 #include "chrome/browser/content_settings/host_content_settings_map.h" | |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/content_settings_pattern.h" | 19 #include "chrome/common/content_settings_pattern.h" |
20 #include "chrome/common/render_messages.h" | |
19 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
20 | 22 |
21 namespace { | 23 namespace { |
22 | 24 |
23 // The names of the ContentSettingsType values, for use with dictionary prefs. | 25 // The names of the ContentSettingsType values, for use with dictionary prefs. |
24 const char* kTypeNames[] = { | 26 const char* kTypeNames[] = { |
25 "cookies", | 27 "cookies", |
26 "images", | 28 "images", |
27 "javascript", | 29 "javascript", |
28 "plugins", | 30 "plugins", |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 ContentSettingsType content_type, | 189 ContentSettingsType content_type, |
188 const std::string& resource_identifier, | 190 const std::string& resource_identifier, |
189 bool include_incognito) { | 191 bool include_incognito) { |
190 scoped_ptr<base::Value> value( | 192 scoped_ptr<base::Value> value( |
191 GetContentSettingValue(provider, primary_url, secondary_url, | 193 GetContentSettingValue(provider, primary_url, secondary_url, |
192 content_type, resource_identifier, | 194 content_type, resource_identifier, |
193 include_incognito)); | 195 include_incognito)); |
194 return ValueToContentSetting(value.get()); | 196 return ValueToContentSetting(value.get()); |
195 } | 197 } |
196 | 198 |
199 void SendContentSettingRules(const HostContentSettingsMap* map, | |
200 IPC::Channel::Sender* sender) { | |
201 RendererContentSettingRules rules; | |
202 map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, "", | |
203 &(rules.image_rules)); | |
204 map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "", | |
205 &(rules.script_rules)); | |
206 sender->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | |
Bernhard Bauer
2011/11/03 22:18:38
Could you change this method so that it populates
marja
2011/11/07 09:32:48
Done.
| |
207 } | |
208 | |
197 } // namespace content_settings | 209 } // namespace content_settings |
OLD | NEW |