| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 const WebKit::WebSecurityOrigin& origin); | 59 const WebKit::WebSecurityOrigin& origin); |
| 60 bool AllowPlugins(WebKit::WebFrame* frame, bool enabled_per_settings); | 60 bool AllowPlugins(WebKit::WebFrame* frame, bool enabled_per_settings); |
| 61 bool AllowScript(WebKit::WebFrame* frame, bool enabled_per_settings); | 61 bool AllowScript(WebKit::WebFrame* frame, bool enabled_per_settings); |
| 62 bool AllowScriptFromSource(WebKit::WebFrame* frame, bool enabled_per_settings, | 62 bool AllowScriptFromSource(WebKit::WebFrame* frame, bool enabled_per_settings, |
| 63 const WebKit::WebURL& script_url); | 63 const WebKit::WebURL& script_url); |
| 64 bool AllowStorage(WebKit::WebFrame* frame, bool local); | 64 bool AllowStorage(WebKit::WebFrame* frame, bool local); |
| 65 void DidNotAllowPlugins(WebKit::WebFrame* frame); | 65 void DidNotAllowPlugins(WebKit::WebFrame* frame); |
| 66 void DidNotAllowScript(WebKit::WebFrame* frame); | 66 void DidNotAllowScript(WebKit::WebFrame* frame); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, |
| 70 ContentSettingsAllowInterstitialScripts); |
| 69 // RenderViewObserver implementation. | 71 // RenderViewObserver implementation. |
| 70 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 71 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, | 73 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 72 bool is_new_navigation) OVERRIDE; | 74 bool is_new_navigation) OVERRIDE; |
| 73 | 75 |
| 74 // Message handlers. | 76 // Message handlers. |
| 75 void OnLoadBlockedPlugins(); | 77 void OnLoadBlockedPlugins(); |
| 78 void OnSetAsInterstitial(); |
| 76 | 79 |
| 77 // Resets the |content_blocked_| array. | 80 // Resets the |content_blocked_| array. |
| 78 void ClearBlockedContentSettings(); | 81 void ClearBlockedContentSettings(); |
| 79 | 82 |
| 80 // A pointer to content setting rules stored by the renderer. Normally, the | 83 // A pointer to content setting rules stored by the renderer. Normally, the |
| 81 // |RendererContentSettingRules| object is owned by | 84 // |RendererContentSettingRules| object is owned by |
| 82 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of | 85 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of |
| 83 // |SetContentSettingRules|. | 86 // |SetContentSettingRules|. |
| 84 const RendererContentSettingRules* content_setting_rules_; | 87 const RendererContentSettingRules* content_setting_rules_; |
| 85 | 88 |
| 86 // Stores if images, scripts, and plugins have actually been blocked. | 89 // Stores if images, scripts, and plugins have actually been blocked. |
| 87 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES]; | 90 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES]; |
| 88 | 91 |
| 89 // Caches the result of AllowStorage. | 92 // Caches the result of AllowStorage. |
| 90 typedef std::pair<GURL, bool> StoragePermissionsKey; | 93 typedef std::pair<GURL, bool> StoragePermissionsKey; |
| 91 std::map<StoragePermissionsKey, bool> cached_storage_permissions_; | 94 std::map<StoragePermissionsKey, bool> cached_storage_permissions_; |
| 92 | 95 |
| 93 // Caches the result of |AllowScript|. | 96 // Caches the result of |AllowScript|. |
| 94 std::map<WebKit::WebFrame*, bool> cached_script_permissions_; | 97 std::map<WebKit::WebFrame*, bool> cached_script_permissions_; |
| 95 | 98 |
| 96 bool plugins_temporarily_allowed_; | 99 bool plugins_temporarily_allowed_; |
| 100 bool is_interstitial_page_; |
| 97 | 101 |
| 98 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 102 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 99 }; | 103 }; |
| 100 | 104 |
| 101 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 105 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |