| 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 17 matching lines...) Expand all Loading... |
| 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, |
| 37 extensions::Dispatcher* extension_dispatcher); | 37 extensions::Dispatcher* extension_dispatcher); |
| 38 virtual ~ContentSettingsObserver(); | 38 ~ContentSettingsObserver() override; |
| 39 | 39 |
| 40 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, | 40 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, |
| 41 // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this | 41 // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this |
| 42 // |ContentSettingsObserver|. | 42 // |ContentSettingsObserver|. |
| 43 void SetContentSettingRules( | 43 void SetContentSettingRules( |
| 44 const RendererContentSettingRules* content_setting_rules); | 44 const RendererContentSettingRules* content_setting_rules); |
| 45 | 45 |
| 46 bool IsPluginTemporarilyAllowed(const std::string& identifier); | 46 bool IsPluginTemporarilyAllowed(const std::string& identifier); |
| 47 | 47 |
| 48 // Sends an IPC notification that the specified content type was blocked. | 48 // Sends an IPC notification that the specified content type was blocked. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // This is used for cases when the NPAPI plugins malfunction if used. | 81 // This is used for cases when the NPAPI plugins malfunction if used. |
| 82 bool AreNPAPIPluginsBlocked() const; | 82 bool AreNPAPIPluginsBlocked() const; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); | 85 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); |
| 86 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, | 86 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, |
| 87 ContentSettingsInterstitialPages); | 87 ContentSettingsInterstitialPages); |
| 88 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, PluginsTemporarilyAllowed); | 88 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, PluginsTemporarilyAllowed); |
| 89 | 89 |
| 90 // RenderFrameObserver implementation. | 90 // RenderFrameObserver implementation. |
| 91 virtual bool OnMessageReceived(const IPC::Message& message) override; | 91 bool OnMessageReceived(const IPC::Message& message) override; |
| 92 virtual void DidCommitProvisionalLoad(bool is_new_navigation) override; | 92 void DidCommitProvisionalLoad(bool is_new_navigation) override; |
| 93 | 93 |
| 94 // Message handlers. | 94 // Message handlers. |
| 95 void OnLoadBlockedPlugins(const std::string& identifier); | 95 void OnLoadBlockedPlugins(const std::string& identifier); |
| 96 void OnSetAsInterstitial(); | 96 void OnSetAsInterstitial(); |
| 97 void OnNPAPINotSupported(); | 97 void OnNPAPINotSupported(); |
| 98 void OnSetAllowDisplayingInsecureContent(bool allow); | 98 void OnSetAllowDisplayingInsecureContent(bool allow); |
| 99 void OnSetAllowRunningInsecureContent(bool allow); | 99 void OnSetAllowRunningInsecureContent(bool allow); |
| 100 void OnReloadFrame(); | 100 void OnReloadFrame(); |
| 101 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); | 101 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); |
| 102 | 102 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 bool npapi_plugins_blocked_; | 150 bool npapi_plugins_blocked_; |
| 151 | 151 |
| 152 int current_request_id_; | 152 int current_request_id_; |
| 153 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; | 153 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; |
| 154 PermissionRequestMap permission_requests_; | 154 PermissionRequestMap permission_requests_; |
| 155 | 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 156 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 159 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |