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

Unified Diff: chrome/renderer/content_settings_observer.h

Issue 8538004: Take script URLs into account when applying script content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup + rebase. 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/content_settings_observer.h
diff --git a/chrome/renderer/content_settings_observer.h b/chrome/renderer/content_settings_observer.h
index acff53b001feaecb51afdc3ac6f3cdb2aa7b3f18..6c3d3f5ac2595c4d4b6cb8ee650155411f2a8856 100644
--- a/chrome/renderer/content_settings_observer.h
+++ b/chrome/renderer/content_settings_observer.h
@@ -27,21 +27,11 @@ class ContentSettingsObserver
explicit ContentSettingsObserver(content::RenderView* render_view);
virtual ~ContentSettingsObserver();
- // Sets the content settings that back allowScripts() and allowPlugins().
- void SetContentSettings(const ContentSettings& settings);
-
- // Sets the default content settings that back allowScripts() and
- // allowPlugins().
- void SetDefaultContentSettings(const ContentSettings* settings);
-
- // Sets the image setting rules which back |allowImage()|. The
- // |ContentSettingsForOneType| object must outlive this
+ // Sets the content setting rules which back |AllowImage()|, |AllowScript()|,
+ // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this
// |ContentSettingsObserver|.
- void SetImageSettingRules(
- const ContentSettingsForOneType* image_setting_rules);
-
- // Returns the setting for the given type.
- ContentSetting GetContentSetting(ContentSettingsType type);
+ void SetContentSettingRules(
+ const RendererContentSettingRules* content_setting_rules);
bool plugins_temporarily_allowed() {
return plugins_temporarily_allowed_;
@@ -68,6 +58,8 @@ class ContentSettingsObserver
const WebKit::WebSecurityOrigin& origin);
bool AllowPlugins(WebKit::WebFrame* frame, bool enabled_per_settings);
bool AllowScript(WebKit::WebFrame* frame, bool enabled_per_settings);
+ bool AllowScriptFromSource(WebKit::WebFrame* frame, bool enabled_per_settings,
+ const WebKit::WebURL& script_url);
bool AllowStorage(WebKit::WebFrame* frame, bool local);
void DidNotAllowPlugins(WebKit::WebFrame* frame);
void DidNotAllowScript(WebKit::WebFrame* frame);
@@ -79,33 +71,16 @@ class ContentSettingsObserver
bool is_new_navigation);
// Message handlers.
- void OnSetContentSettingsForLoadingURL(
- const GURL& url,
- const ContentSettings& content_settings);
void OnLoadBlockedPlugins();
- // Helper method that returns if the user wants to block content of type
- // |content_type|.
- bool AllowContentType(ContentSettingsType settings_type);
-
// Resets the |content_blocked_| array.
void ClearBlockedContentSettings();
- typedef std::map<GURL, ContentSettings> HostContentSettings;
- HostContentSettings host_content_settings_;
-
- // A pointer to the most up-to-date view of the default content
- // settings. Normally, they are owned by |ChromeRenderProcessObserver|. In the
- // tests they are owned by the caller of |SetDefaultContentSettings|.
- const ContentSettings* default_content_settings_;
-
- // Stores if loading of scripts and plugins is allowed.
- ContentSettings current_content_settings_;
-
- // Stores the rules for image content settings. Normally, they are owned by
- // |ChromeRenderProcessObserver|. In the tests they are owned by the caller of
- // |SetImageSettingRules|.
- const ContentSettingsForOneType* image_setting_rules_;
+ // A pointer to content setting rules stored by the renderer. Normally, the
+ // |RendererContentSettingRules| object is owned by
+ // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of
+ // |SetContentSettingRules|.
+ const RendererContentSettingRules* content_setting_rules_;
// Stores if images, scripts, and plugins have actually been blocked.
bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES];

Powered by Google App Engine
This is Rietveld 408576698