| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const WebKit::WebString& name, | 58 const WebKit::WebString& name, |
| 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 // Used for allowing scripts and images on views displaying interstitial | |
| 69 // pages. | |
| 70 void SetAsInterstitial(); | |
| 71 | |
| 72 private: | 68 private: |
| 73 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); | 69 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); |
| 70 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, |
| 71 ContentSettingsInterstitialPages); |
| 74 | 72 |
| 75 // RenderViewObserver implementation. | 73 // RenderViewObserver implementation. |
| 76 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 74 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 77 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, | 75 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 78 bool is_new_navigation) OVERRIDE; | 76 bool is_new_navigation) OVERRIDE; |
| 79 | 77 |
| 80 // Message handlers. | 78 // Message handlers. |
| 81 void OnLoadBlockedPlugins(); | 79 void OnLoadBlockedPlugins(); |
| 80 void OnSetAsInterstitial(); |
| 82 | 81 |
| 83 // Resets the |content_blocked_| array. | 82 // Resets the |content_blocked_| array. |
| 84 void ClearBlockedContentSettings(); | 83 void ClearBlockedContentSettings(); |
| 85 | 84 |
| 86 // Helpers. | 85 // Helpers. |
| 87 // True if |frame| contains content that is white-listed for content settings. | 86 // True if |frame| contains content that is white-listed for content settings. |
| 88 static bool IsWhitelistedForContentSettings(WebKit::WebFrame* frame); | 87 static bool IsWhitelistedForContentSettings(WebKit::WebFrame* frame); |
| 89 static bool IsWhitelistedForContentSettings( | 88 static bool IsWhitelistedForContentSettings( |
| 90 const WebKit::WebSecurityOrigin& origin, | 89 const WebKit::WebSecurityOrigin& origin, |
| 91 const GURL& document_url); | 90 const GURL& document_url); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 106 // Caches the result of |AllowScript|. | 105 // Caches the result of |AllowScript|. |
| 107 std::map<WebKit::WebFrame*, bool> cached_script_permissions_; | 106 std::map<WebKit::WebFrame*, bool> cached_script_permissions_; |
| 108 | 107 |
| 109 bool plugins_temporarily_allowed_; | 108 bool plugins_temporarily_allowed_; |
| 110 bool is_interstitial_page_; | 109 bool is_interstitial_page_; |
| 111 | 110 |
| 112 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 111 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 113 }; | 112 }; |
| 114 | 113 |
| 115 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 114 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |