Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "content/browser/frame_host/render_frame_proxy_host.h" | 5 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "content/browser/bad_message.h" | 10 #include "content/browser/bad_message.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 128 |
| 129 bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) { | 129 bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) { |
| 130 if (cross_process_frame_connector_.get() && | 130 if (cross_process_frame_connector_.get() && |
| 131 cross_process_frame_connector_->OnMessageReceived(msg)) | 131 cross_process_frame_connector_->OnMessageReceived(msg)) |
| 132 return true; | 132 return true; |
| 133 | 133 |
| 134 bool handled = true; | 134 bool handled = true; |
| 135 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) | 135 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) |
| 136 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) | 136 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) |
| 137 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 137 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
| 138 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardContentSecurityPolicyViolation, | |
| 139 OnForwardContentSecurityPolicyViolation) | |
| 138 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 140 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
| 139 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) | 141 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) |
| 140 IPC_MESSAGE_HANDLER(FrameHostMsg_AdvanceFocus, OnAdvanceFocus) | 142 IPC_MESSAGE_HANDLER(FrameHostMsg_AdvanceFocus, OnAdvanceFocus) |
| 141 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) | 143 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) |
| 142 IPC_MESSAGE_UNHANDLED(handled = false) | 144 IPC_MESSAGE_UNHANDLED(handled = false) |
| 143 IPC_END_MESSAGE_MAP() | 145 IPC_END_MESSAGE_MAP() |
| 144 return handled; | 146 return handled; |
| 145 } | 147 } |
| 146 | 148 |
| 147 bool RenderFrameProxyHost::InitRenderFrameProxy() { | 149 bool RenderFrameProxyHost::InitRenderFrameProxy() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 | 263 |
| 262 // TODO(alexmos, creis): Figure out whether |params.user_gesture| needs to be | 264 // TODO(alexmos, creis): Figure out whether |params.user_gesture| needs to be |
| 263 // passed in as well. | 265 // passed in as well. |
| 264 frame_tree_node_->navigator()->RequestTransferURL( | 266 frame_tree_node_->navigator()->RequestTransferURL( |
| 265 current_rfh, validated_url, site_instance_.get(), std::vector<GURL>(), | 267 current_rfh, validated_url, site_instance_.get(), std::vector<GURL>(), |
| 266 params.referrer, ui::PAGE_TRANSITION_LINK, GlobalRequestID(), | 268 params.referrer, ui::PAGE_TRANSITION_LINK, GlobalRequestID(), |
| 267 params.should_replace_current_entry, params.uses_post ? "POST" : "GET", | 269 params.should_replace_current_entry, params.uses_post ? "POST" : "GET", |
| 268 params.resource_request_body); | 270 params.resource_request_body); |
| 269 } | 271 } |
| 270 | 272 |
| 273 void RenderFrameProxyHost::OnForwardContentSecurityPolicyViolation( | |
| 274 const ContentSecurityPolicyViolation& violation) { | |
| 275 // Verify that we are in the same BrowsingInstance as the current | |
| 276 // RenderFrameHost. | |
| 277 RenderFrameHostImpl* current_rfh = frame_tree_node_->current_frame_host(); | |
| 278 if (!site_instance_->IsRelatedSiteInstance(current_rfh->GetSiteInstance())) | |
|
alexmos
2016/08/09 18:01:19
What's the reason for this check?
Łukasz Anforowicz
2016/08/09 22:23:20
Thanks for asking this question - I blindly copied
Łukasz Anforowicz
2016/08/10 19:50:25
FWIW, I checked that the same condition in RenderF
alexmos
2016/08/10 20:34:33
Yes, I moved that check according to Charlie's TOD
Łukasz Anforowicz
2016/08/11 17:32:36
Hmmm... actually, I think that the check above mig
Łukasz Anforowicz
2016/08/11 18:04:35
I talked with Alex about this a little bit more an
Charlie Reis
2016/08/11 18:32:14
Sorry for chiming in late. I'll reply to Alex's q
Łukasz Anforowicz
2016/08/11 19:51:35
Today sending of this message is only triggered wh
Charlie Reis
2016/08/11 20:40:26
Hmm, I have some concerns about that, and no solut
| |
| 279 return; | |
| 280 | |
| 281 current_rfh->Send(new FrameMsg_ReportContentSecurityPolicyViolation( | |
| 282 current_rfh->GetRoutingID(), violation)); | |
| 283 } | |
| 284 | |
| 271 void RenderFrameProxyHost::OnRouteMessageEvent( | 285 void RenderFrameProxyHost::OnRouteMessageEvent( |
| 272 const FrameMsg_PostMessage_Params& params) { | 286 const FrameMsg_PostMessage_Params& params) { |
| 273 RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host(); | 287 RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host(); |
| 274 | 288 |
| 275 // Only deliver the message if the request came from a RenderFrameHost in the | 289 // Only deliver the message if the request came from a RenderFrameHost in the |
| 276 // same BrowsingInstance or if this WebContents is dedicated to a browser | 290 // same BrowsingInstance or if this WebContents is dedicated to a browser |
| 277 // plugin guest. | 291 // plugin guest. |
| 278 // | 292 // |
| 279 // TODO(alexmos, lazyboy): The check for browser plugin guest currently | 293 // TODO(alexmos, lazyboy): The check for browser plugin guest currently |
| 280 // requires going through the delegate. It should be refactored and | 294 // requires going through the delegate. It should be refactored and |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 target_rfh->Send(new FrameMsg_AdvanceFocus(target_rfh->GetRoutingID(), type, | 383 target_rfh->Send(new FrameMsg_AdvanceFocus(target_rfh->GetRoutingID(), type, |
| 370 source_proxy_routing_id)); | 384 source_proxy_routing_id)); |
| 371 } | 385 } |
| 372 | 386 |
| 373 void RenderFrameProxyHost::OnFrameFocused() { | 387 void RenderFrameProxyHost::OnFrameFocused() { |
| 374 frame_tree_node_->frame_tree()->SetFocusedFrame(frame_tree_node_, | 388 frame_tree_node_->frame_tree()->SetFocusedFrame(frame_tree_node_, |
| 375 GetSiteInstance()); | 389 GetSiteInstance()); |
| 376 } | 390 } |
| 377 | 391 |
| 378 } // namespace content | 392 } // namespace content |
| OLD | NEW |