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

Unified Diff: chrome/renderer/chrome_render_process_observer.cc

Issue 8538004: Take script URLs into account when applying script content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: AllowScript -= cache 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/chrome_render_process_observer.cc
diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc
index db2e8f7b51f54018f6552c1e20835daa4a1409dd..bdf5ee462a7188fbeba8d0d9024863fdace48d0e 100644
--- a/chrome/renderer/chrome_render_process_observer.cc
+++ b/chrome/renderer/chrome_render_process_observer.cc
@@ -106,30 +106,6 @@ class RendererResourceDelegate : public content::ResourceDispatcherDelegate {
DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate);
};
-class RenderViewContentSettingsSetter : public content::RenderViewVisitor {
- public:
- RenderViewContentSettingsSetter(const GURL& url,
- const ContentSettings& content_settings)
- : url_(url),
- content_settings_(content_settings) {
- }
-
- virtual bool Visit(content::RenderView* render_view) {
- if (GURL(render_view->GetWebView()->mainFrame()->document().url()) ==
- url_) {
- ContentSettingsObserver::Get(render_view)->SetContentSettings(
- content_settings_);
- }
- return true;
- }
-
- private:
- GURL url_;
- ContentSettings content_settings_;
-
- DISALLOW_COPY_AND_ASSIGN(RenderViewContentSettingsSetter);
-};
-
#if defined(OS_WIN)
static base::win::IATPatchFunction g_iat_patch_createdca;
HDC WINAPI CreateDCAPatch(LPCSTR driver_name,
@@ -263,12 +239,6 @@ bool ChromeRenderProcessObserver::OnControlMessageReceived(
IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess,
OnSetIsIncognitoProcess)
- IPC_MESSAGE_HANDLER(ChromeViewMsg_SetDefaultContentSettings,
- OnSetDefaultContentSettings)
- IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingsForCurrentURL,
- OnSetContentSettingsForCurrentURL)
- IPC_MESSAGE_HANDLER(ChromeViewMsg_SetImageSettingRules,
- OnSetImageSettingRules)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities)
IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup)
@@ -284,6 +254,8 @@ bool ChromeRenderProcessObserver::OnControlMessageReceived(
IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats,
OnGetCacheResourceStats)
IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory)
+ IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules,
+ OnSetContentSettingRules)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -298,21 +270,9 @@ void ChromeRenderProcessObserver::OnSetIsIncognitoProcess(
is_incognito_process_ = is_incognito_process;
}
-void ChromeRenderProcessObserver::OnSetContentSettingsForCurrentURL(
- const GURL& url,
- const ContentSettings& content_settings) {
- RenderViewContentSettingsSetter setter(url, content_settings);
- content::RenderView::ForEach(&setter);
-}
-
-void ChromeRenderProcessObserver::OnSetDefaultContentSettings(
- const ContentSettings& content_settings) {
- default_content_settings_ = content_settings;
-}
-
-void ChromeRenderProcessObserver::OnSetImageSettingRules(
- const ContentSettingsForOneType& settings) {
- image_setting_rules_ = settings;
+void ChromeRenderProcessObserver::OnSetContentSettingRules(
+ const RendererContentSettingRules& rules) {
+ content_setting_rules_ = rules;
}
void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity,
@@ -425,12 +385,7 @@ void ChromeRenderProcessObserver::ExecutePendingClearCache() {
}
}
-const ContentSettingsForOneType*
-ChromeRenderProcessObserver::image_setting_rules() const {
- return &image_setting_rules_;
-}
-
-const ContentSettings*
-ChromeRenderProcessObserver::default_content_settings() const {
- return &default_content_settings_;
+const RendererContentSettingRules*
+ChromeRenderProcessObserver::content_setting_rules() const {
+ return &content_setting_rules_;
}

Powered by Google App Engine
This is Rietveld 408576698