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 24 matching lines...) Expand all Loading... | |
| 35 public blink::WebContentSettingsClient { | 35 public blink::WebContentSettingsClient { |
| 36 public: | 36 public: |
| 37 // Set |should_whitelist| to true if |render_frame()| contains content that | 37 // Set |should_whitelist| to true if |render_frame()| contains content that |
| 38 // should be whitelisted for content settings. | 38 // should be whitelisted for content settings. |
| 39 ContentSettingsObserver(content::RenderFrame* render_frame, | 39 ContentSettingsObserver(content::RenderFrame* render_frame, |
| 40 extensions::Dispatcher* extension_dispatcher, | 40 extensions::Dispatcher* extension_dispatcher, |
| 41 bool should_whitelist); | 41 bool should_whitelist); |
| 42 ~ContentSettingsObserver() override; | 42 ~ContentSettingsObserver() override; |
| 43 | 43 |
| 44 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, | 44 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, |
| 45 // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this | 45 // |AllowScriptFromSource()|, and |AllowKeygen()|. |content_setting_rules| |
|
Bernhard Bauer
2015/11/05 17:17:33
Revert this?
svaldez
2015/11/05 17:40:12
Done.
| |
| 46 // |ContentSettingsObserver|. | 46 // must outlive this |ContentSettingsObserver|. |
| 47 void SetContentSettingRules( | 47 void SetContentSettingRules( |
| 48 const RendererContentSettingRules* content_setting_rules); | 48 const RendererContentSettingRules* content_setting_rules); |
| 49 | 49 |
| 50 bool IsPluginTemporarilyAllowed(const std::string& identifier); | 50 bool IsPluginTemporarilyAllowed(const std::string& identifier); |
| 51 | 51 |
| 52 // Sends an IPC notification that the specified content type was blocked. | 52 // Sends an IPC notification that the specified content type was blocked. |
| 53 void DidBlockContentType(ContentSettingsType settings_type); | 53 void DidBlockContentType(ContentSettingsType settings_type); |
| 54 | 54 |
| 55 // Sends an IPC notification that the specified content type was blocked | 55 // Sends an IPC notification that the specified content type was blocked |
| 56 // with additional metadata. | 56 // with additional metadata. |
| 57 void DidBlockContentType(ContentSettingsType settings_type, | 57 void DidBlockContentType(ContentSettingsType settings_type, |
| 58 const base::string16& details); | 58 const base::string16& details); |
| 59 | 59 |
| 60 // blink::WebContentSettingsClient implementation. | 60 // blink::WebContentSettingsClient implementation. |
| 61 bool allowDatabase(const blink::WebString& name, | 61 bool allowDatabase(const blink::WebString& name, |
| 62 const blink::WebString& display_name, | 62 const blink::WebString& display_name, |
| 63 unsigned long estimated_size) override; | 63 unsigned long estimated_size) override; |
| 64 void requestFileSystemAccessAsync( | 64 void requestFileSystemAccessAsync( |
| 65 const blink::WebContentSettingCallbacks& callbacks) override; | 65 const blink::WebContentSettingCallbacks& callbacks) override; |
| 66 bool allowImage(bool enabled_per_settings, | 66 bool allowImage(bool enabled_per_settings, |
| 67 const blink::WebURL& image_url) override; | 67 const blink::WebURL& image_url) override; |
| 68 bool allowIndexedDB(const blink::WebString& name, | 68 bool allowIndexedDB(const blink::WebString& name, |
| 69 const blink::WebSecurityOrigin& origin) override; | 69 const blink::WebSecurityOrigin& origin) override; |
| 70 bool allowKeygen() override; | |
| 70 bool allowPlugins(bool enabled_per_settings) override; | 71 bool allowPlugins(bool enabled_per_settings) override; |
| 71 bool allowScript(bool enabled_per_settings) override; | 72 bool allowScript(bool enabled_per_settings) override; |
| 72 bool allowScriptFromSource(bool enabled_per_settings, | 73 bool allowScriptFromSource(bool enabled_per_settings, |
| 73 const blink::WebURL& script_url) override; | 74 const blink::WebURL& script_url) override; |
| 74 bool allowStorage(bool local) override; | 75 bool allowStorage(bool local) override; |
| 75 bool allowReadFromClipboard(bool default_value) override; | 76 bool allowReadFromClipboard(bool default_value) override; |
| 76 bool allowWriteToClipboard(bool default_value) override; | 77 bool allowWriteToClipboard(bool default_value) override; |
| 77 bool allowMutationEvents(bool default_value) override; | 78 bool allowMutationEvents(bool default_value) override; |
| 79 void didNotAllowKeygen() override; | |
| 78 void didNotAllowPlugins() override; | 80 void didNotAllowPlugins() override; |
| 79 void didNotAllowScript() override; | 81 void didNotAllowScript() override; |
| 80 bool allowDisplayingInsecureContent(bool allowed_per_settings, | 82 bool allowDisplayingInsecureContent(bool allowed_per_settings, |
| 81 const blink::WebSecurityOrigin& context, | 83 const blink::WebSecurityOrigin& context, |
| 82 const blink::WebURL& url) override; | 84 const blink::WebURL& url) override; |
| 83 bool allowRunningInsecureContent(bool allowed_per_settings, | 85 bool allowRunningInsecureContent(bool allowed_per_settings, |
| 84 const blink::WebSecurityOrigin& context, | 86 const blink::WebSecurityOrigin& context, |
| 85 const blink::WebURL& url) override; | 87 const blink::WebURL& url) override; |
| 86 | 88 |
| 87 // This is used for cases when the NPAPI plugins malfunction if used. | 89 // This is used for cases when the NPAPI plugins malfunction if used. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 // Insecure content may be permitted for the duration of this render view. | 138 // Insecure content may be permitted for the duration of this render view. |
| 137 bool allow_displaying_insecure_content_; | 139 bool allow_displaying_insecure_content_; |
| 138 bool allow_running_insecure_content_; | 140 bool allow_running_insecure_content_; |
| 139 | 141 |
| 140 // A pointer to content setting rules stored by the renderer. Normally, the | 142 // A pointer to content setting rules stored by the renderer. Normally, the |
| 141 // |RendererContentSettingRules| object is owned by | 143 // |RendererContentSettingRules| object is owned by |
| 142 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of | 144 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of |
| 143 // |SetContentSettingRules|. | 145 // |SetContentSettingRules|. |
| 144 const RendererContentSettingRules* content_setting_rules_; | 146 const RendererContentSettingRules* content_setting_rules_; |
| 145 | 147 |
| 146 // Stores if images, scripts, and plugins have actually been blocked. | 148 // Stores if images, scripts, keygen, and plugins have actually been blocked. |
| 147 std::map<ContentSettingsType, bool> content_blocked_; | 149 std::map<ContentSettingsType, bool> content_blocked_; |
| 148 | 150 |
| 149 // Caches the result of AllowStorage. | 151 // Caches the result of AllowStorage. |
| 150 typedef std::pair<GURL, bool> StoragePermissionsKey; | 152 typedef std::pair<GURL, bool> StoragePermissionsKey; |
| 151 std::map<StoragePermissionsKey, bool> cached_storage_permissions_; | 153 std::map<StoragePermissionsKey, bool> cached_storage_permissions_; |
| 152 | 154 |
| 153 // Caches the result of |AllowScript|. | 155 // Caches the result of AllowScript. |
| 154 std::map<blink::WebFrame*, bool> cached_script_permissions_; | 156 std::map<blink::WebFrame*, bool> cached_script_permissions_; |
| 155 | 157 |
| 158 // Caches the result of AllowKeygen. | |
| 159 std::map<blink::WebFrame*, bool> cached_keygen_permissions_; | |
| 160 | |
| 156 std::set<std::string> temporarily_allowed_plugins_; | 161 std::set<std::string> temporarily_allowed_plugins_; |
| 157 bool is_interstitial_page_; | 162 bool is_interstitial_page_; |
| 158 bool npapi_plugins_blocked_; | 163 bool npapi_plugins_blocked_; |
| 159 | 164 |
| 160 int current_request_id_; | 165 int current_request_id_; |
| 161 typedef std::map<int, blink::WebContentSettingCallbacks> PermissionRequestMap; | 166 typedef std::map<int, blink::WebContentSettingCallbacks> PermissionRequestMap; |
| 162 PermissionRequestMap permission_requests_; | 167 PermissionRequestMap permission_requests_; |
| 163 | 168 |
| 164 // If true, IsWhitelistedForContentSettings will always return true. | 169 // If true, IsWhitelistedForContentSettings will always return true. |
| 165 const bool should_whitelist_; | 170 const bool should_whitelist_; |
| 166 | 171 |
| 167 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 172 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 168 }; | 173 }; |
| 169 | 174 |
| 170 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 175 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |