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

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

Issue 2190183002: Forward CSP violation reporting from RenderFrameProxy to RenderFrameImpl. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More safe-guards against navigation-vs-violation race. Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PROXY_HOST_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/browser/site_instance_impl.h" 13 #include "content/browser/site_instance_impl.h"
14 #include "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
15 #include "ipc/ipc_sender.h" 15 #include "ipc/ipc_sender.h"
16 #include "third_party/WebKit/public/platform/WebFocusType.h" 16 #include "third_party/WebKit/public/platform/WebFocusType.h"
17 17
18 struct FrameHostMsg_OpenURL_Params; 18 struct FrameHostMsg_OpenURL_Params;
19 struct FrameMsg_PostMessage_Params; 19 struct FrameMsg_PostMessage_Params;
20 20
21 namespace url {
22 class Origin;
23 } // namespace url
24
21 namespace content { 25 namespace content {
22 26
23 class CrossProcessFrameConnector; 27 class CrossProcessFrameConnector;
24 class FrameTreeNode; 28 class FrameTreeNode;
25 class RenderProcessHost; 29 class RenderProcessHost;
26 class RenderFrameHostImpl; 30 class RenderFrameHostImpl;
27 class RenderViewHostImpl; 31 class RenderViewHostImpl;
28 class RenderWidgetHostView; 32 class RenderWidgetHostView;
33 struct ContentSecurityPolicyViolation;
29 34
30 // When a page's frames are rendered by multiple processes, each renderer has a 35 // When a page's frames are rendered by multiple processes, each renderer has a
31 // full copy of the frame tree. It has full RenderFrames for the frames it is 36 // full copy of the frame tree. It has full RenderFrames for the frames it is
32 // responsible for rendering and placeholder objects (i.e., RenderFrameProxies) 37 // responsible for rendering and placeholder objects (i.e., RenderFrameProxies)
33 // for frames rendered by other processes. 38 // for frames rendered by other processes.
34 // 39 //
35 // This class is the browser-side host object for the placeholder. Each node in 40 // This class is the browser-side host object for the placeholder. Each node in
36 // the frame tree has a RenderFrameHost for the active SiteInstance and a set 41 // the frame tree has a RenderFrameHost for the active SiteInstance and a set
37 // of RenderFrameProxyHost objects - one for all other SiteInstances with 42 // of RenderFrameProxyHost objects - one for all other SiteInstances with
38 // references to this frame. The proxies allow us to keep existing window 43 // references to this frame. The proxies allow us to keep existing window
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 render_frame_proxy_created_ = created; 117 render_frame_proxy_created_ = created;
113 } 118 }
114 119
115 // Returns if the RenderFrameProxy for this host is alive. 120 // Returns if the RenderFrameProxy for this host is alive.
116 bool is_render_frame_proxy_live() { return render_frame_proxy_created_; } 121 bool is_render_frame_proxy_live() { return render_frame_proxy_created_; }
117 122
118 private: 123 private:
119 // IPC Message handlers. 124 // IPC Message handlers.
120 void OnDetach(); 125 void OnDetach();
121 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params); 126 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params);
127 void OnForwardContentSecurityPolicyViolation(
128 const url::Origin& origin_declaring_violated_csp,
129 const ContentSecurityPolicyViolation& violation);
122 void OnRouteMessageEvent(const FrameMsg_PostMessage_Params& params); 130 void OnRouteMessageEvent(const FrameMsg_PostMessage_Params& params);
123 void OnDidChangeOpener(int32_t opener_routing_id); 131 void OnDidChangeOpener(int32_t opener_routing_id);
124 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id); 132 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id);
125 void OnFrameFocused(); 133 void OnFrameFocused();
126 134
135 // Helper for figuring out if it is okay to process
136 // FrameHostMsg_ForwardContentSecurityPolicyViolation message.
137 // Note that this function is not 100% accurate - please see a comment in
138 // OnForwardContentSecurityPolicyViolation for more details.
139 bool CanForwardViolationToCurrentDocument(
140 const url::Origin& origin_declaring_violated_csp,
141 const std::string& violated_csp_header);
142
127 // This RenderFrameProxyHost's routing id. 143 // This RenderFrameProxyHost's routing id.
128 int routing_id_; 144 int routing_id_;
129 145
130 // The SiteInstance this proxy is associated with. 146 // The SiteInstance this proxy is associated with.
131 scoped_refptr<SiteInstance> site_instance_; 147 scoped_refptr<SiteInstance> site_instance_;
132 148
133 // The renderer process this RenderFrameHostProxy is associated with. It is 149 // The renderer process this RenderFrameHostProxy is associated with. It is
134 // equivalent to the result of site_instance_->GetProcess(), but that 150 // equivalent to the result of site_instance_->GetProcess(), but that
135 // method has the side effect of creating the process if it doesn't exist. 151 // method has the side effect of creating the process if it doesn't exist.
136 // Cache a pointer to avoid unnecessary process creation. 152 // Cache a pointer to avoid unnecessary process creation.
(...skipping 15 matching lines...) Expand all
152 // kept alive as long as any RenderFrameHosts or RenderFrameProxyHosts 168 // kept alive as long as any RenderFrameHosts or RenderFrameProxyHosts
153 // are associated with it. 169 // are associated with it.
154 RenderViewHostImpl* render_view_host_; 170 RenderViewHostImpl* render_view_host_;
155 171
156 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxyHost); 172 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxyHost);
157 }; 173 };
158 174
159 } // namespace 175 } // namespace
160 176
161 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ 177 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698