| 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 |
| 11 #include "chrome/common/content_settings.h" | 11 #include "chrome/common/content_settings.h" |
| 12 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
| 13 #include "content/public/renderer/render_frame_observer.h" | 13 #include "content/public/renderer/render_frame_observer.h" |
| 14 #include "content/public/renderer/render_frame_observer_tracker.h" | 14 #include "content/public/renderer/render_frame_observer_tracker.h" |
| 15 #include "extensions/common/permissions/api_permission.h" | |
| 16 #include "third_party/WebKit/public/web/WebPermissionClient.h" | 15 #include "third_party/WebKit/public/web/WebPermissionClient.h" |
| 17 | 16 |
| 18 class GURL; | 17 class GURL; |
| 19 | 18 |
| 20 namespace blink { | 19 namespace blink { |
| 21 class WebFrame; | 20 class WebFrame; |
| 22 class WebSecurityOrigin; | 21 class WebSecurityOrigin; |
| 23 class WebURL; | 22 class WebURL; |
| 24 } | 23 } |
| 25 | 24 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void OnSetAsInterstitial(); | 96 void OnSetAsInterstitial(); |
| 98 void OnNPAPINotSupported(); | 97 void OnNPAPINotSupported(); |
| 99 void OnSetAllowDisplayingInsecureContent(bool allow); | 98 void OnSetAllowDisplayingInsecureContent(bool allow); |
| 100 void OnSetAllowRunningInsecureContent(bool allow); | 99 void OnSetAllowRunningInsecureContent(bool allow); |
| 101 void OnReloadFrame(); | 100 void OnReloadFrame(); |
| 102 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); | 101 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); |
| 103 | 102 |
| 104 // Resets the |content_blocked_| array. | 103 // Resets the |content_blocked_| array. |
| 105 void ClearBlockedContentSettings(); | 104 void ClearBlockedContentSettings(); |
| 106 | 105 |
| 106 #if defined(ENABLE_EXTENSIONS) |
| 107 // If |origin| corresponds to an installed extension, returns that extension. | 107 // If |origin| corresponds to an installed extension, returns that extension. |
| 108 // Otherwise returns NULL. | 108 // Otherwise returns NULL. |
| 109 const extensions::Extension* GetExtension( | 109 const extensions::Extension* GetExtension( |
| 110 const blink::WebSecurityOrigin& origin) const; | 110 const blink::WebSecurityOrigin& origin) const; |
| 111 #endif |
| 111 | 112 |
| 112 // Helpers. | 113 // Helpers. |
| 113 // True if |frame| contains content that is white-listed for content settings. | 114 // True if |frame| contains content that is white-listed for content settings. |
| 114 static bool IsWhitelistedForContentSettings(content::RenderFrame* frame); | 115 static bool IsWhitelistedForContentSettings(content::RenderFrame* frame); |
| 115 static bool IsWhitelistedForContentSettings( | 116 static bool IsWhitelistedForContentSettings( |
| 116 const blink::WebSecurityOrigin& origin, | 117 const blink::WebSecurityOrigin& origin, |
| 117 const GURL& document_url); | 118 const GURL& document_url); |
| 118 | 119 |
| 120 #if defined(ENABLE_EXTENSIONS) |
| 119 // Owned by ChromeContentRendererClient and outlive us. | 121 // Owned by ChromeContentRendererClient and outlive us. |
| 120 extensions::Dispatcher* extension_dispatcher_; | 122 extensions::Dispatcher* extension_dispatcher_; |
| 123 #endif |
| 121 | 124 |
| 122 // Insecure content may be permitted for the duration of this render view. | 125 // Insecure content may be permitted for the duration of this render view. |
| 123 bool allow_displaying_insecure_content_; | 126 bool allow_displaying_insecure_content_; |
| 124 bool allow_running_insecure_content_; | 127 bool allow_running_insecure_content_; |
| 125 | 128 |
| 126 // A pointer to content setting rules stored by the renderer. Normally, the | 129 // A pointer to content setting rules stored by the renderer. Normally, the |
| 127 // |RendererContentSettingRules| object is owned by | 130 // |RendererContentSettingRules| object is owned by |
| 128 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of | 131 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of |
| 129 // |SetContentSettingRules|. | 132 // |SetContentSettingRules|. |
| 130 const RendererContentSettingRules* content_setting_rules_; | 133 const RendererContentSettingRules* content_setting_rules_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 144 bool npapi_plugins_blocked_; | 147 bool npapi_plugins_blocked_; |
| 145 | 148 |
| 146 int current_request_id_; | 149 int current_request_id_; |
| 147 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; | 150 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; |
| 148 PermissionRequestMap permission_requests_; | 151 PermissionRequestMap permission_requests_; |
| 149 | 152 |
| 150 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 153 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 151 }; | 154 }; |
| 152 | 155 |
| 153 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 156 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |