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 // Whether the observed RenderFrame is for a platform app. |
| 107 bool IsPlatformApp(); |
| 108 |
| 109 #if defined(ENABLE_EXTENSIONS) |
107 // If |origin| corresponds to an installed extension, returns that extension. | 110 // If |origin| corresponds to an installed extension, returns that extension. |
108 // Otherwise returns NULL. | 111 // Otherwise returns NULL. |
109 const extensions::Extension* GetExtension( | 112 const extensions::Extension* GetExtension( |
110 const blink::WebSecurityOrigin& origin) const; | 113 const blink::WebSecurityOrigin& origin) const; |
111 | 114 |
| 115 #endif |
| 116 |
112 // Helpers. | 117 // Helpers. |
113 // True if |frame| contains content that is white-listed for content settings. | 118 // True if |frame| contains content that is white-listed for content settings. |
114 static bool IsWhitelistedForContentSettings(content::RenderFrame* frame); | 119 static bool IsWhitelistedForContentSettings(content::RenderFrame* frame); |
115 static bool IsWhitelistedForContentSettings( | 120 static bool IsWhitelistedForContentSettings( |
116 const blink::WebSecurityOrigin& origin, | 121 const blink::WebSecurityOrigin& origin, |
117 const GURL& document_url); | 122 const GURL& document_url); |
118 | 123 |
| 124 #if defined(ENABLE_EXTENSIONS) |
119 // Owned by ChromeContentRendererClient and outlive us. | 125 // Owned by ChromeContentRendererClient and outlive us. |
120 extensions::Dispatcher* extension_dispatcher_; | 126 extensions::Dispatcher* extension_dispatcher_; |
| 127 #endif |
121 | 128 |
122 // Insecure content may be permitted for the duration of this render view. | 129 // Insecure content may be permitted for the duration of this render view. |
123 bool allow_displaying_insecure_content_; | 130 bool allow_displaying_insecure_content_; |
124 bool allow_running_insecure_content_; | 131 bool allow_running_insecure_content_; |
125 | 132 |
126 // A pointer to content setting rules stored by the renderer. Normally, the | 133 // A pointer to content setting rules stored by the renderer. Normally, the |
127 // |RendererContentSettingRules| object is owned by | 134 // |RendererContentSettingRules| object is owned by |
128 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of | 135 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of |
129 // |SetContentSettingRules|. | 136 // |SetContentSettingRules|. |
130 const RendererContentSettingRules* content_setting_rules_; | 137 const RendererContentSettingRules* content_setting_rules_; |
(...skipping 13 matching lines...) Expand all Loading... |
144 bool npapi_plugins_blocked_; | 151 bool npapi_plugins_blocked_; |
145 | 152 |
146 int current_request_id_; | 153 int current_request_id_; |
147 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; | 154 typedef std::map<int, blink::WebPermissionCallbacks> PermissionRequestMap; |
148 PermissionRequestMap permission_requests_; | 155 PermissionRequestMap permission_requests_; |
149 | 156 |
150 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 157 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
151 }; | 158 }; |
152 | 159 |
153 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 160 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
OLD | NEW |