| 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 content::RenderFrameObserverTracker<ContentSettingsObserver>, | 35 public content::RenderFrameObserverTracker<ContentSettingsObserver>, |
| 36 public blink::WebContentSettingsClient { | 36 public blink::WebContentSettingsClient { |
| 37 public: | 37 public: |
| 38 // Set |should_whitelist| to true if |render_frame()| contains content that | 38 // Set |should_whitelist| to true if |render_frame()| contains content that |
| 39 // should be whitelisted for content settings. | 39 // should be whitelisted for content settings. |
| 40 ContentSettingsObserver(content::RenderFrame* render_frame, | 40 ContentSettingsObserver(content::RenderFrame* render_frame, |
| 41 extensions::Dispatcher* extension_dispatcher, | 41 extensions::Dispatcher* extension_dispatcher, |
| 42 bool should_whitelist); | 42 bool should_whitelist); |
| 43 ~ContentSettingsObserver() override; | 43 ~ContentSettingsObserver() override; |
| 44 | 44 |
| 45 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, | 45 // Sets the content setting rules which back |allowImage()|, |allowScript()|, |
| 46 // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this | 46 // |allowScriptFromSource()| and |allowAutoplay()|. |content_setting_rules| |
| 47 // |ContentSettingsObserver|. | 47 // must outlive this |ContentSettingsObserver|. |
| 48 void SetContentSettingRules( | 48 void SetContentSettingRules( |
| 49 const RendererContentSettingRules* content_setting_rules); | 49 const RendererContentSettingRules* content_setting_rules); |
| 50 | 50 |
| 51 bool IsPluginTemporarilyAllowed(const std::string& identifier); | 51 bool IsPluginTemporarilyAllowed(const std::string& identifier); |
| 52 | 52 |
| 53 // Sends an IPC notification that the specified content type was blocked. | 53 // Sends an IPC notification that the specified content type was blocked. |
| 54 void DidBlockContentType(ContentSettingsType settings_type); | 54 void DidBlockContentType(ContentSettingsType settings_type); |
| 55 | 55 |
| 56 // Sends an IPC notification that the specified content type was blocked | 56 // Sends an IPC notification that the specified content type was blocked |
| 57 // with additional metadata. | 57 // with additional metadata. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 77 bool allowWriteToClipboard(bool default_value) override; | 77 bool allowWriteToClipboard(bool default_value) override; |
| 78 bool allowMutationEvents(bool default_value) override; | 78 bool allowMutationEvents(bool default_value) override; |
| 79 void didNotAllowPlugins() override; | 79 void didNotAllowPlugins() override; |
| 80 void didNotAllowScript() override; | 80 void didNotAllowScript() override; |
| 81 void didUseKeygen() override; | 81 void didUseKeygen() override; |
| 82 bool allowDisplayingInsecureContent(bool allowed_per_settings, | 82 bool allowDisplayingInsecureContent(bool allowed_per_settings, |
| 83 const blink::WebURL& url) override; | 83 const blink::WebURL& url) override; |
| 84 bool allowRunningInsecureContent(bool allowed_per_settings, | 84 bool allowRunningInsecureContent(bool allowed_per_settings, |
| 85 const blink::WebSecurityOrigin& context, | 85 const blink::WebSecurityOrigin& context, |
| 86 const blink::WebURL& url) override; | 86 const blink::WebURL& url) override; |
| 87 bool allowAutoplay(bool default_value) override; |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); | 90 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); |
| 90 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, | 91 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, |
| 91 ContentSettingsInterstitialPages); | 92 ContentSettingsInterstitialPages); |
| 92 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, PluginsTemporarilyAllowed); | 93 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, PluginsTemporarilyAllowed); |
| 93 | 94 |
| 94 // RenderFrameObserver implementation. | 95 // RenderFrameObserver implementation. |
| 95 bool OnMessageReceived(const IPC::Message& message) override; | 96 bool OnMessageReceived(const IPC::Message& message) override; |
| 96 void DidCommitProvisionalLoad(bool is_new_navigation, | 97 void DidCommitProvisionalLoad(bool is_new_navigation, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 typedef std::map<int, blink::WebContentSettingCallbacks> PermissionRequestMap; | 158 typedef std::map<int, blink::WebContentSettingCallbacks> PermissionRequestMap; |
| 158 PermissionRequestMap permission_requests_; | 159 PermissionRequestMap permission_requests_; |
| 159 | 160 |
| 160 // If true, IsWhitelistedForContentSettings will always return true. | 161 // If true, IsWhitelistedForContentSettings will always return true. |
| 161 const bool should_whitelist_; | 162 const bool should_whitelist_; |
| 162 | 163 |
| 163 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 164 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 167 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |