Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 5 #ifndef CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| 6 #define CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 6 #define CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 class Dispatcher; | 26 class Dispatcher; |
| 27 class Extension; | 27 class Extension; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Handles blocking content per content settings for each RenderFrame. | 30 // Handles blocking content per content settings for each RenderFrame. |
| 31 class ContentSettingsObserver | 31 class ContentSettingsObserver |
| 32 : public content::RenderFrameObserver, | 32 : public content::RenderFrameObserver, |
| 33 public content::RenderFrameObserverTracker<ContentSettingsObserver>, | 33 public content::RenderFrameObserverTracker<ContentSettingsObserver>, |
| 34 public blink::WebPermissionClient { | 34 public blink::WebPermissionClient { |
| 35 public: | 35 public: |
| 36 ContentSettingsObserver(content::RenderFrame* render_frame, | 36 ContentSettingsObserver(content::RenderFrame* render_frame, |
|
jochen (gone - plz use gerrit)
2014/12/12 14:58:20
please add a comment what should_whitelist means
| |
| 37 extensions::Dispatcher* extension_dispatcher); | 37 extensions::Dispatcher* extension_dispatcher, |
| 38 bool should_whitelist); | |
| 38 ~ContentSettingsObserver() override; | 39 ~ContentSettingsObserver() override; |
| 39 | 40 |
| 40 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, | 41 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, |
| 41 // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this | 42 // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this |
| 42 // |ContentSettingsObserver|. | 43 // |ContentSettingsObserver|. |
| 43 void SetContentSettingRules( | 44 void SetContentSettingRules( |
| 44 const RendererContentSettingRules* content_setting_rules); | 45 const RendererContentSettingRules* content_setting_rules); |
| 45 | 46 |
| 46 bool IsPluginTemporarilyAllowed(const std::string& identifier); | 47 bool IsPluginTemporarilyAllowed(const std::string& identifier); |
| 47 | 48 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 bool IsPlatformApp(); | 113 bool IsPlatformApp(); |
| 113 | 114 |
| 114 #if defined(ENABLE_EXTENSIONS) | 115 #if defined(ENABLE_EXTENSIONS) |
| 115 // If |origin| corresponds to an installed extension, returns that extension. | 116 // If |origin| corresponds to an installed extension, returns that extension. |
| 116 // Otherwise returns NULL. | 117 // Otherwise returns NULL. |
| 117 const extensions::Extension* GetExtension( | 118 const extensions::Extension* GetExtension( |
| 118 const blink::WebSecurityOrigin& origin) const; | 119 const blink::WebSecurityOrigin& origin) const; |
| 119 #endif | 120 #endif |
| 120 | 121 |
| 121 // Helpers. | 122 // Helpers. |
| 122 // True if |frame| contains content that is white-listed for content settings. | 123 // True if |render_frame()| contains content that is white-listed for content |
| 123 static bool IsWhitelistedForContentSettings(content::RenderFrame* frame); | 124 // settings. |
| 125 bool IsWhitelistedForContentSettings() const; | |
| 124 static bool IsWhitelistedForContentSettings( | 126 static bool IsWhitelistedForContentSettings( |
| 125 const blink::WebSecurityOrigin& origin, | 127 const blink::WebSecurityOrigin& origin, |
| 126 const GURL& document_url); | 128 const GURL& document_url); |
| 127 | 129 |
| 128 #if defined(ENABLE_EXTENSIONS) | 130 #if defined(ENABLE_EXTENSIONS) |
| 129 // Owned by ChromeContentRendererClient and outlive us. | 131 // Owned by ChromeContentRendererClient and outlive us. |
| 130 extensions::Dispatcher* extension_dispatcher_; | 132 extensions::Dispatcher* extension_dispatcher_; |
| 131 #endif | 133 #endif |
| 132 | 134 |
| 133 // Insecure content may be permitted for the duration of this render view. | 135 // Insecure content may be permitted for the duration of this render view. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 151 std::map<blink::WebFrame*, bool> cached_script_permissions_; | 153 std::map<blink::WebFrame*, bool> cached_script_permissions_; |
| 152 | 154 |
| 153 std::set<std::string> temporarily_allowed_plugins_; | 155 std::set<std::string> temporarily_allowed_plugins_; |
| 154 bool is_interstitial_page_; | 156 bool is_interstitial_page_; |
| 155 bool npapi_plugins_blocked_; | 157 bool npapi_plugins_blocked_; |
| 156 | 158 |
| 157 int current_request_id_; | 159 int current_request_id_; |
| 158 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; | 160 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; |
| 159 PermissionRequestMap permission_requests_; | 161 PermissionRequestMap permission_requests_; |
| 160 | 162 |
| 163 // If true, IsWhitelistedForContentSettings will always return true. | |
| 164 const bool should_whitelist_; | |
| 165 | |
| 161 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 166 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 162 }; | 167 }; |
| 163 | 168 |
| 164 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 169 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |