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

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: Rebased. 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
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.cc ('k') | chrome/renderer/content_settings_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..947333eff072653246d862650962a4f7013ed9fa 100644
--- a/chrome/renderer/content_settings_observer.h
+++ b/chrome/renderer/content_settings_observer.h
@@ -15,6 +15,7 @@
class GURL;
namespace WebKit {
+class WebFrame;
class WebSecurityOrigin;
class WebURL;
}
@@ -27,21 +28,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 +59,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 +72,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];
@@ -114,6 +90,9 @@ class ContentSettingsObserver
typedef std::pair<GURL, bool> StoragePermissionsKey;
std::map<StoragePermissionsKey, bool> cached_storage_permissions_;
+ // Caches the result of |AllowScript|.
+ std::map<WebKit::WebFrame*, bool> cached_script_permissions_;
+
bool plugins_temporarily_allowed_;
DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver);
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.cc ('k') | chrome/renderer/content_settings_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698