diff options
Diffstat (limited to 'chrome/browser')
4 files changed, 25 insertions, 7 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 365b2b2..84e598e 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -15,6 +15,7 @@ #include "chrome/browser/chrome_plugin_message_filter.h" #include "chrome/browser/chrome_quota_permission_context.h" #include "chrome/browser/chrome_worker_message_filter.h" +#include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/content_settings/cookie_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/download/download_util.h" @@ -317,10 +318,10 @@ void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( profile->IsOffTheRecord())); SendExtensionWebRequestStatusToHost(host); - ContentSettingsForOneType settings; - HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); - map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, "", &settings); - host->Send(new ChromeViewMsg_SetImageSettingRules(settings)); + + RendererContentSettingRules rules; + GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); + host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); } void ChromeContentBrowserClient::PluginProcessHostCreated( diff --git a/chrome/browser/content_settings/content_settings_utils.cc b/chrome/browser/content_settings/content_settings_utils.cc index 2338507..de814d9 100644 --- a/chrome/browser/content_settings/content_settings_utils.cc +++ b/chrome/browser/content_settings/content_settings_utils.cc @@ -14,8 +14,10 @@ #include "base/values.h" #include "chrome/browser/content_settings/content_settings_provider.h" #include "chrome/browser/content_settings/content_settings_rule.h" +#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_pattern.h" +#include "chrome/common/render_messages.h" #include "googleurl/src/gurl.h" namespace { @@ -194,4 +196,12 @@ ContentSetting GetContentSetting(const ProviderInterface* provider, return ValueToContentSetting(value.get()); } +void GetRendererContentSettingRules(const HostContentSettingsMap* map, + RendererContentSettingRules* rules) { + map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, "", + &(rules->image_rules)); + map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "", + &(rules->script_rules)); +} + } // namespace content_settings diff --git a/chrome/browser/content_settings/content_settings_utils.h b/chrome/browser/content_settings/content_settings_utils.h index 4fae58c..4b0e81b 100644 --- a/chrome/browser/content_settings/content_settings_utils.h +++ b/chrome/browser/content_settings/content_settings_utils.h @@ -17,6 +17,7 @@ class Value; } class GURL; +class HostContentSettingsMap; namespace content_settings { @@ -85,6 +86,11 @@ ContentSetting GetContentSetting( const std::string& resource_identifier, bool include_incognito); +// Populates |rules| with content setting rules for content types that are +// handled by the renderer. +void GetRendererContentSettingRules(const HostContentSettingsMap* map, + RendererContentSettingRules* rules); + } // namespace content_settings #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc index bee8f69..91948d5 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc @@ -16,6 +16,7 @@ #include "chrome/browser/browsing_data_indexed_db_helper.h" #include "chrome/browser/browsing_data_local_storage_helper.h" #include "chrome/browser/content_settings/content_settings_details.h" +#include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/cookies_tree_model.h" #include "chrome/browser/profiles/profile.h" @@ -490,9 +491,9 @@ void TabSpecificContentSettings::Observe( map->GetDefaultContentSettings())); Send(new ChromeViewMsg_SetContentSettingsForCurrentURL( entry_url, map->GetContentSettings(entry_url))); - ContentSettingsForOneType settings; - map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, "", &settings); - Send(new ChromeViewMsg_SetImageSettingRules(settings)); + RendererContentSettingRules rules; + GetRendererContentSettingRules(map, &rules); + Send(new ChromeViewMsg_SetContentSettingRules(rules)); } } |