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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 692973005: Pass origin information for remote frame creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add EXPECT_TRUE to NavigateToURL in new tests; nits Created 6 years, 1 month 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 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/child/service_worker/service_worker_network_provider.h" 27 #include "content/child/service_worker/service_worker_network_provider.h"
28 #include "content/child/service_worker/service_worker_provider_context.h" 28 #include "content/child/service_worker/service_worker_provider_context.h"
29 #include "content/child/service_worker/web_service_worker_provider_impl.h" 29 #include "content/child/service_worker/web_service_worker_provider_impl.h"
30 #include "content/child/web_url_loader_impl.h" 30 #include "content/child/web_url_loader_impl.h"
31 #include "content/child/web_url_request_util.h" 31 #include "content/child/web_url_request_util.h"
32 #include "content/child/webmessageportchannel_impl.h" 32 #include "content/child/webmessageportchannel_impl.h"
33 #include "content/child/websocket_bridge.h" 33 #include "content/child/websocket_bridge.h"
34 #include "content/child/weburlresponse_extradata_impl.h" 34 #include "content/child/weburlresponse_extradata_impl.h"
35 #include "content/common/clipboard_messages.h" 35 #include "content/common/clipboard_messages.h"
36 #include "content/common/frame_messages.h" 36 #include "content/common/frame_messages.h"
37 #include "content/common/frame_replication_state.h"
37 #include "content/common/input_messages.h" 38 #include "content/common/input_messages.h"
38 #include "content/common/service_worker/service_worker_types.h" 39 #include "content/common/service_worker/service_worker_types.h"
39 #include "content/common/swapped_out_messages.h" 40 #include "content/common/swapped_out_messages.h"
40 #include "content/common/view_messages.h" 41 #include "content/common/view_messages.h"
41 #include "content/public/common/bindings_policy.h" 42 #include "content/public/common/bindings_policy.h"
42 #include "content/public/common/content_constants.h" 43 #include "content/public/common/content_constants.h"
43 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
44 #include "content/public/common/context_menu_params.h" 45 #include "content/public/common/context_menu_params.h"
45 #include "content/public/common/page_state.h" 46 #include "content/public/common/page_state.h"
46 #include "content/public/common/resource_response.h" 47 #include "content/public/common/resource_response.h"
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 CHECK(!frame_->parent()); 1116 CHECK(!frame_->parent());
1116 1117
1117 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); 1118 base::TimeTicks before_unload_start_time = base::TimeTicks::Now();
1118 bool proceed = frame_->dispatchBeforeUnloadEvent(); 1119 bool proceed = frame_->dispatchBeforeUnloadEvent();
1119 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); 1120 base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
1120 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed, 1121 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed,
1121 before_unload_start_time, 1122 before_unload_start_time,
1122 before_unload_end_time)); 1123 before_unload_end_time));
1123 } 1124 }
1124 1125
1125 void RenderFrameImpl::OnSwapOut(int proxy_routing_id) { 1126 void RenderFrameImpl::OnSwapOut(
1127 int proxy_routing_id,
1128 const FrameReplicationState& remote_frame_state) {
1126 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); 1129 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
1127 RenderFrameProxy* proxy = NULL; 1130 RenderFrameProxy* proxy = NULL;
1128 bool is_site_per_process = 1131 bool is_site_per_process =
1129 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess); 1132 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess);
1130 bool is_main_frame = !frame_->parent(); 1133 bool is_main_frame = !frame_->parent();
1131 1134
1132 // Only run unload if we're not swapped out yet, but send the ack either way. 1135 // Only run unload if we're not swapped out yet, but send the ack either way.
1133 if (!is_swapped_out_ || !render_view_->is_swapped_out_) { 1136 if (!is_swapped_out_ || !render_view_->is_swapped_out_) {
1134 // Swap this RenderFrame out so the frame can navigate to a page rendered by 1137 // Swap this RenderFrame out so the frame can navigate to a page rendered by
1135 // a different process. This involves running the unload handler and 1138 // a different process. This involves running the unload handler and
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 frame_->swap(proxy->web_frame()); 1204 frame_->swap(proxy->web_frame());
1202 if (is_site_per_process) { 1205 if (is_site_per_process) {
1203 // TODO(nasko): delete the frame here, since we've replaced it with a 1206 // TODO(nasko): delete the frame here, since we've replaced it with a
1204 // proxy. 1207 // proxy.
1205 } 1208 }
1206 } else { 1209 } else {
1207 set_render_frame_proxy(proxy); 1210 set_render_frame_proxy(proxy);
1208 } 1211 }
1209 } 1212 }
1210 1213
1214 // In --site-per-process, initialize the WebRemoteFrame with the replication
1215 // state passed by the process that is now rendering the frame.
1216 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because
1217 // in that case we leave the LocalFrame as the main frame visible to Blink
1218 // and don't call swap() above. Because swap() is what creates a RemoteFrame
nasko 2014/11/20 17:22:54 nit: The comment is not quite correct, as the Remo
alexmos 2014/11/20 21:09:10 I thought the proxy creation only creates the WebR
nasko 2014/11/20 21:21:21 Yes, you are correct. I was thinking of frames at
1219 // in proxy->web_frame(), the RemoteFrame will not exist for main frames.
1220 // When we do an unconditional swap for all frames, we can remove
1221 // !is_main_frame below.
1222 if (is_site_per_process && proxy && !is_main_frame)
1223 proxy->SetReplicatedState(remote_frame_state);
1224
1211 // Safe to exit if no one else is using the process. 1225 // Safe to exit if no one else is using the process.
1212 if (is_main_frame) 1226 if (is_main_frame)
1213 render_view_->WasSwappedOut(); 1227 render_view_->WasSwappedOut();
1214 } 1228 }
1215 1229
1216 void RenderFrameImpl::OnContextMenuClosed( 1230 void RenderFrameImpl::OnContextMenuClosed(
1217 const CustomContextMenuContext& custom_context) { 1231 const CustomContextMenuContext& custom_context) {
1218 if (custom_context.request_id) { 1232 if (custom_context.request_id) {
1219 // External request, should be in our map. 1233 // External request, should be in our map.
1220 ContextMenuClient* client = 1234 ContextMenuClient* client =
(...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response); 3492 WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response);
3479 if (extra_data) 3493 if (extra_data)
3480 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); 3494 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy();
3481 params.was_within_same_page = navigation_state->was_within_same_page(); 3495 params.was_within_same_page = navigation_state->was_within_same_page();
3482 params.security_info = response.securityInfo(); 3496 params.security_info = response.securityInfo();
3483 3497
3484 // Set the URL to be displayed in the browser UI to the user. 3498 // Set the URL to be displayed in the browser UI to the user.
3485 params.url = GetLoadingUrl(); 3499 params.url = GetLoadingUrl();
3486 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); 3500 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL));
3487 3501
3502 // Set the origin of the frame. This will be replicated to the corresponding
3503 // RenderFrameProxies in other processes.
3504 if (!is_swapped_out_) {
3505 params.origin =
3506 url::Origin(frame->document().securityOrigin().toString().utf8());
3507 }
3508
3488 if (frame->document().baseURL() != params.url) 3509 if (frame->document().baseURL() != params.url)
3489 params.base_url = frame->document().baseURL(); 3510 params.base_url = frame->document().baseURL();
3490 3511
3491 GetRedirectChain(ds, &params.redirects); 3512 GetRedirectChain(ds, &params.redirects);
3492 params.should_update_history = !ds->hasUnreachableURL() && 3513 params.should_update_history = !ds->hasUnreachableURL() &&
3493 !response.isMultipartPayload() && (response.httpStatusCode() != 404); 3514 !response.isMultipartPayload() && (response.httpStatusCode() != 404);
3494 3515
3495 params.searchable_form_url = internal_data->searchable_form_url(); 3516 params.searchable_form_url = internal_data->searchable_form_url();
3496 params.searchable_form_encoding = internal_data->searchable_form_encoding(); 3517 params.searchable_form_encoding = internal_data->searchable_form_encoding();
3497 3518
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
4243 4264
4244 #if defined(ENABLE_BROWSER_CDMS) 4265 #if defined(ENABLE_BROWSER_CDMS)
4245 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4266 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4246 if (!cdm_manager_) 4267 if (!cdm_manager_)
4247 cdm_manager_ = new RendererCdmManager(this); 4268 cdm_manager_ = new RendererCdmManager(this);
4248 return cdm_manager_; 4269 return cdm_manager_;
4249 } 4270 }
4250 #endif // defined(ENABLE_BROWSER_CDMS) 4271 #endif // defined(ENABLE_BROWSER_CDMS)
4251 4272
4252 } // namespace content 4273 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698