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 #include <string> | 10 #include <string> |
11 #include <unordered_map> | 11 #include <unordered_map> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "components/content_settings/core/common/content_settings.h" | 15 #include "components/content_settings/core/common/content_settings.h" |
16 #include "components/content_settings/core/common/content_settings_types.h" | 16 #include "components/content_settings/core/common/content_settings_types.h" |
17 #include "content/public/renderer/render_frame_observer.h" | 17 #include "content/public/renderer/render_frame_observer.h" |
18 #include "content/public/renderer/render_frame_observer_tracker.h" | 18 #include "content/public/renderer/render_frame_observer_tracker.h" |
| 19 #include "extensions/features/features.h" |
19 #include "third_party/WebKit/public/web/WebContentSettingsClient.h" | 20 #include "third_party/WebKit/public/web/WebContentSettingsClient.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 namespace blink { | 23 namespace blink { |
23 class WebFrame; | 24 class WebFrame; |
24 class WebSecurityOrigin; | 25 class WebSecurityOrigin; |
25 class WebURL; | 26 class WebURL; |
26 } | 27 } |
27 | 28 |
28 namespace extensions { | 29 namespace extensions { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void OnSetAllowRunningInsecureContent(bool allow); | 105 void OnSetAllowRunningInsecureContent(bool allow); |
105 void OnReloadFrame(); | 106 void OnReloadFrame(); |
106 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); | 107 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); |
107 | 108 |
108 // Resets the |content_blocked_| array. | 109 // Resets the |content_blocked_| array. |
109 void ClearBlockedContentSettings(); | 110 void ClearBlockedContentSettings(); |
110 | 111 |
111 // Whether the observed RenderFrame is for a platform app. | 112 // Whether the observed RenderFrame is for a platform app. |
112 bool IsPlatformApp(); | 113 bool IsPlatformApp(); |
113 | 114 |
114 #if defined(ENABLE_EXTENSIONS) | 115 #if BUILDFLAG(ENABLE_EXTENSIONS) |
115 // If |origin| corresponds to an installed extension, returns that extension. | 116 // If |origin| corresponds to an installed extension, returns that extension. |
116 // Otherwise returns NULL. | 117 // Otherwise returns NULL. |
117 const extensions::Extension* GetExtension( | 118 const extensions::Extension* GetExtension( |
118 const blink::WebSecurityOrigin& origin) const; | 119 const blink::WebSecurityOrigin& origin) const; |
119 #endif | 120 #endif |
120 | 121 |
121 // Helpers. | 122 // Helpers. |
122 // True if |render_frame()| contains content that is white-listed for content | 123 // True if |render_frame()| contains content that is white-listed for content |
123 // settings. | 124 // settings. |
124 bool IsWhitelistedForContentSettings() const; | 125 bool IsWhitelistedForContentSettings() const; |
125 static bool IsWhitelistedForContentSettings( | 126 static bool IsWhitelistedForContentSettings( |
126 const blink::WebSecurityOrigin& origin, | 127 const blink::WebSecurityOrigin& origin, |
127 const GURL& document_url); | 128 const GURL& document_url); |
128 | 129 |
129 #if defined(ENABLE_EXTENSIONS) | 130 #if BUILDFLAG(ENABLE_EXTENSIONS) |
130 // Owned by ChromeContentRendererClient and outlive us. | 131 // Owned by ChromeContentRendererClient and outlive us. |
131 extensions::Dispatcher* const extension_dispatcher_; | 132 extensions::Dispatcher* const extension_dispatcher_; |
132 #endif | 133 #endif |
133 | 134 |
134 // Insecure content may be permitted for the duration of this render view. | 135 // Insecure content may be permitted for the duration of this render view. |
135 bool allow_running_insecure_content_; | 136 bool allow_running_insecure_content_; |
136 | 137 |
137 // A pointer to content setting rules stored by the renderer. Normally, the | 138 // A pointer to content setting rules stored by the renderer. Normally, the |
138 // |RendererContentSettingRules| object is owned by | 139 // |RendererContentSettingRules| object is owned by |
139 // |ChromeRenderThreadObserver|. In the tests it is owned by the caller of | 140 // |ChromeRenderThreadObserver|. In the tests it is owned by the caller of |
(...skipping 18 matching lines...) Expand all Loading... |
158 std::unordered_map<int, blink::WebContentSettingCallbacks>; | 159 std::unordered_map<int, blink::WebContentSettingCallbacks>; |
159 PermissionRequestMap permission_requests_; | 160 PermissionRequestMap permission_requests_; |
160 | 161 |
161 // If true, IsWhitelistedForContentSettings will always return true. | 162 // If true, IsWhitelistedForContentSettings will always return true. |
162 const bool should_whitelist_; | 163 const bool should_whitelist_; |
163 | 164 |
164 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 165 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
165 }; | 166 }; |
166 | 167 |
167 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 168 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
OLD | NEW |