Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Addressed comments @alexmos. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 12 matching lines...) Expand all
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "build/build_config.h" 24 #include "build/build_config.h"
25 #include "content/browser/accessibility/browser_accessibility_manager.h" 25 #include "content/browser/accessibility/browser_accessibility_manager.h"
26 #include "content/browser/bad_message.h" 26 #include "content/browser/bad_message.h"
27 #include "content/browser/loader/global_routing_id.h" 27 #include "content/browser/loader/global_routing_id.h"
28 #include "content/browser/site_instance_impl.h" 28 #include "content/browser/site_instance_impl.h"
29 #include "content/browser/webui/web_ui_impl.h" 29 #include "content/browser/webui/web_ui_impl.h"
30 #include "content/common/accessibility_mode_enums.h" 30 #include "content/common/accessibility_mode_enums.h"
31 #include "content/common/ax_content_node_data.h" 31 #include "content/common/ax_content_node_data.h"
32 #include "content/common/content_export.h" 32 #include "content/common/content_export.h"
33 #include "content/common/content_security_policy/content_security_policy.h" 33 #include "content/common/content_security_policy/csp_context.h"
34 #include "content/common/download/mhtml_save_status.h" 34 #include "content/common/download/mhtml_save_status.h"
35 #include "content/common/frame.mojom.h" 35 #include "content/common/frame.mojom.h"
36 #include "content/common/frame_message_enums.h" 36 #include "content/common/frame_message_enums.h"
37 #include "content/common/frame_replication_state.h" 37 #include "content/common/frame_replication_state.h"
38 #include "content/common/image_downloader/image_downloader.mojom.h" 38 #include "content/common/image_downloader/image_downloader.mojom.h"
39 #include "content/common/navigation_params.h" 39 #include "content/common/navigation_params.h"
40 #include "content/public/browser/render_frame_host.h" 40 #include "content/public/browser/render_frame_host.h"
41 #include "content/public/common/javascript_dialog_type.h" 41 #include "content/public/common/javascript_dialog_type.h"
42 #include "content/public/common/previews_state.h" 42 #include "content/public/common/previews_state.h"
43 #include "media/mojo/interfaces/interface_factory.mojom.h" 43 #include "media/mojo/interfaces/interface_factory.mojom.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 namespace mojom { 109 namespace mojom {
110 class CreateNewWindowParams; 110 class CreateNewWindowParams;
111 } 111 }
112 112
113 class CONTENT_EXPORT RenderFrameHostImpl 113 class CONTENT_EXPORT RenderFrameHostImpl
114 : public RenderFrameHost, 114 : public RenderFrameHost,
115 NON_EXPORTED_BASE(public mojom::FrameHost), 115 NON_EXPORTED_BASE(public mojom::FrameHost),
116 public BrowserAccessibilityDelegate, 116 public BrowserAccessibilityDelegate,
117 public SiteInstanceImpl::Observer, 117 public SiteInstanceImpl::Observer,
118 public NON_EXPORTED_BASE( 118 public NON_EXPORTED_BASE(
119 service_manager::InterfaceFactory<media::mojom::InterfaceFactory>) { 119 service_manager::InterfaceFactory<media::mojom::InterfaceFactory>),
120 public CSPContext {
120 public: 121 public:
121 using AXTreeSnapshotCallback = 122 using AXTreeSnapshotCallback =
122 base::Callback<void( 123 base::Callback<void(
123 const ui::AXTreeUpdate&)>; 124 const ui::AXTreeUpdate&)>;
124 using SmartClipCallback = base::Callback<void(const base::string16& text, 125 using SmartClipCallback = base::Callback<void(const base::string16& text,
125 const base::string16& html)>; 126 const base::string16& html)>;
126 127
127 // An accessibility reset is only allowed to prevent very rare corner cases 128 // An accessibility reset is only allowed to prevent very rare corner cases
128 // or race conditions where the browser and renderer get out of sync. If 129 // or race conditions where the browser and renderer get out of sync. If
129 // this happens more than this many times, kill the renderer. 130 // this happens more than this many times, kill the renderer.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 gfx::Rect AccessibilityGetViewBounds() const override; 203 gfx::Rect AccessibilityGetViewBounds() const override;
203 gfx::Point AccessibilityOriginInScreen( 204 gfx::Point AccessibilityOriginInScreen(
204 const gfx::Rect& bounds) const override; 205 const gfx::Rect& bounds) const override;
205 void AccessibilityFatalError() override; 206 void AccessibilityFatalError() override;
206 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override; 207 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override;
207 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override; 208 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override;
208 209
209 // SiteInstanceImpl::Observer 210 // SiteInstanceImpl::Observer
210 void RenderProcessGone(SiteInstanceImpl* site_instance) override; 211 void RenderProcessGone(SiteInstanceImpl* site_instance) override;
211 212
213 // CSPContext
214 void LogToConsole(const std::string& message) override;
215 void ReportContentSecurityPolicyViolation(
216 const CSPViolationParams& violation_params) override;
217 bool SchemeShouldBypassCSP(const base::StringPiece& scheme) override;
218
212 // Creates a RenderFrame in the renderer process. 219 // Creates a RenderFrame in the renderer process.
213 bool CreateRenderFrame(int proxy_routing_id, 220 bool CreateRenderFrame(int proxy_routing_id,
214 int opener_routing_id, 221 int opener_routing_id,
215 int parent_routing_id, 222 int parent_routing_id,
216 int previous_sibling_routing_id); 223 int previous_sibling_routing_id);
217 224
218 // Tracks whether the RenderFrame for this RenderFrameHost has been created in 225 // Tracks whether the RenderFrame for this RenderFrameHost has been created in
219 // the renderer process. This is currently only used for subframes. 226 // the renderer process. This is currently only used for subframes.
220 // TODO(creis): Use this for main frames as well when RVH goes away. 227 // TODO(creis): Use this for main frames as well when RVH goes away.
221 void SetRenderFrameCreated(bool created); 228 void SetRenderFrameCreated(bool created);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // The most recent non-net-error URL to commit in this frame. In almost all 270 // The most recent non-net-error URL to commit in this frame. In almost all
264 // cases, use GetLastCommittedURL instead. 271 // cases, use GetLastCommittedURL instead.
265 const GURL& last_successful_url() { return last_successful_url_; } 272 const GURL& last_successful_url() { return last_successful_url_; }
266 void set_last_successful_url(const GURL& url) { 273 void set_last_successful_url(const GURL& url) {
267 last_successful_url_ = url; 274 last_successful_url_ = url;
268 } 275 }
269 276
270 // Update this frame's last committed origin. 277 // Update this frame's last committed origin.
271 void set_last_committed_origin(const url::Origin& origin) { 278 void set_last_committed_origin(const url::Origin& origin) {
272 last_committed_origin_ = origin; 279 last_committed_origin_ = origin;
280 CSPContext::SetSelf(origin);
273 } 281 }
274 282
275 // Returns the associated WebUI or null if none applies. 283 // Returns the associated WebUI or null if none applies.
276 WebUIImpl* web_ui() const { return web_ui_.get(); } 284 WebUIImpl* web_ui() const { return web_ui_.get(); }
277 285
278 // Returns the pending WebUI, or null if none applies. 286 // Returns the pending WebUI, or null if none applies.
279 WebUIImpl* pending_web_ui() const { 287 WebUIImpl* pending_web_ui() const {
280 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); 288 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get();
281 } 289 }
282 290
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 1159
1152 // NOTE: This must be the last member. 1160 // NOTE: This must be the last member.
1153 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 1161 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
1154 1162
1155 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 1163 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
1156 }; 1164 };
1157 1165
1158 } // namespace content 1166 } // namespace content
1159 1167
1160 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 1168 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698