| 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 19 matching lines...) Expand all Loading... |
| 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 virtual ~ContentSettingsObserver(); |
| 39 | 39 |
| 40 // Sets the content setting rules which back |AllowImage()|, |AllowScript()|, | 40 // Sets the content setting rules which back |AllowImage()|, |AllowMedia()|, |
| 41 // and |AllowScriptFromSource()|. |content_setting_rules| must outlive this | 41 // |AllowScript()|, and |AllowScriptFromSource()|. |content_setting_rules| |
| 42 // |ContentSettingsObserver|. | 42 // must outlive this |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. |
| 49 void DidBlockContentType(ContentSettingsType settings_type); | 49 void DidBlockContentType(ContentSettingsType settings_type); |
| 50 | 50 |
| 51 // blink::WebPermissionClient implementation. | 51 // blink::WebPermissionClient implementation. |
| 52 virtual bool allowDatabase(const blink::WebString& name, | 52 virtual bool allowDatabase(const blink::WebString& name, |
| 53 const blink::WebString& display_name, | 53 const blink::WebString& display_name, |
| 54 unsigned long estimated_size) OVERRIDE; | 54 unsigned long estimated_size) OVERRIDE; |
| 55 virtual void requestFileSystemAccessAsync( | 55 virtual void requestFileSystemAccessAsync( |
| 56 const blink::WebPermissionCallbacks& callbacks) OVERRIDE; | 56 const blink::WebPermissionCallbacks& callbacks) OVERRIDE; |
| 57 virtual bool allowImage(bool enabled_per_settings, | 57 virtual bool allowImage(bool enabled_per_settings, |
| 58 const blink::WebURL& image_url) OVERRIDE; | 58 const blink::WebURL& image_url) OVERRIDE; |
| 59 virtual bool allowIndexedDB(const blink::WebString& name, | 59 virtual bool allowIndexedDB(const blink::WebString& name, |
| 60 const blink::WebSecurityOrigin& origin) OVERRIDE; | 60 const blink::WebSecurityOrigin& origin) OVERRIDE; |
| 61 virtual bool allowMedia(const blink::WebURL& image_url) OVERRIDE; |
| 61 virtual bool allowPlugins(bool enabled_per_settings) OVERRIDE; | 62 virtual bool allowPlugins(bool enabled_per_settings) OVERRIDE; |
| 62 virtual bool allowScript(bool enabled_per_settings) OVERRIDE; | 63 virtual bool allowScript(bool enabled_per_settings) OVERRIDE; |
| 63 virtual bool allowScriptFromSource(bool enabled_per_settings, | 64 virtual bool allowScriptFromSource(bool enabled_per_settings, |
| 64 const blink::WebURL& script_url) OVERRIDE; | 65 const blink::WebURL& script_url) OVERRIDE; |
| 65 virtual bool allowStorage(bool local) OVERRIDE; | 66 virtual bool allowStorage(bool local) OVERRIDE; |
| 66 virtual bool allowReadFromClipboard(bool default_value) OVERRIDE; | 67 virtual bool allowReadFromClipboard(bool default_value) OVERRIDE; |
| 67 virtual bool allowWriteToClipboard(bool default_value) OVERRIDE; | 68 virtual bool allowWriteToClipboard(bool default_value) OVERRIDE; |
| 68 virtual bool allowWebComponents(bool default_value) OVERRIDE; | 69 virtual bool allowWebComponents(bool default_value) OVERRIDE; |
| 69 virtual bool allowMutationEvents(bool default_value) OVERRIDE; | 70 virtual bool allowMutationEvents(bool default_value) OVERRIDE; |
| 70 virtual bool allowPushState() OVERRIDE; | 71 virtual bool allowPushState() OVERRIDE; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 bool npapi_plugins_blocked_; | 145 bool npapi_plugins_blocked_; |
| 145 | 146 |
| 146 int current_request_id_; | 147 int current_request_id_; |
| 147 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; | 148 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; |
| 148 PermissionRequestMap permission_requests_; | 149 PermissionRequestMap permission_requests_; |
| 149 | 150 |
| 150 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 151 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 154 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |