OLD | NEW |
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/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 // on the frame's unique name. If this can't be found, fall back to the | 1163 // on the frame's unique name. If this can't be found, fall back to the |
1164 // default params using RequestOpenURL below. | 1164 // default params using RequestOpenURL below. |
1165 if (frame_tree_node_->navigator()->NavigateNewChildFrame(this, | 1165 if (frame_tree_node_->navigator()->NavigateNewChildFrame(this, |
1166 validated_url)) | 1166 validated_url)) |
1167 return; | 1167 return; |
1168 } | 1168 } |
1169 | 1169 |
1170 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OpenURL", "url", | 1170 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OpenURL", "url", |
1171 validated_url.possibly_invalid_spec()); | 1171 validated_url.possibly_invalid_spec()); |
1172 | 1172 |
| 1173 // When |params.disposition| asks OpenURL to create new contents, it always |
| 1174 // happens because of an explicit user request for new content creation (i.e. |
| 1175 // opening a link using ctrl-click or middle click). In such cases, the new |
| 1176 // content should be created in a new renderer to break opener relationship |
| 1177 // (see https://crbug.com/658386) and to conserve memory per renderer (see |
| 1178 // https://crbug.com/23815). Note that new content creation that wasn't |
| 1179 // explicitly requested by the user (i.e. left-clicking a link with |
| 1180 // target=_blank) goes through a different code path (through |
| 1181 // WebViewClient::CreateView). |
| 1182 bool kUseNewRendererForNewContents = true; |
| 1183 |
1173 frame_tree_node_->navigator()->RequestOpenURL( | 1184 frame_tree_node_->navigator()->RequestOpenURL( |
1174 this, validated_url, params.uses_post, params.resource_request_body, | 1185 this, validated_url, params.uses_post, params.resource_request_body, |
1175 params.extra_headers, params.referrer, params.disposition, | 1186 params.extra_headers, params.referrer, params.disposition, |
1176 params.should_replace_current_entry, params.user_gesture); | 1187 kUseNewRendererForNewContents, params.should_replace_current_entry, |
| 1188 params.user_gesture); |
1177 } | 1189 } |
1178 | 1190 |
1179 void RenderFrameHostImpl::OnCancelInitialHistoryLoad() { | 1191 void RenderFrameHostImpl::OnCancelInitialHistoryLoad() { |
1180 // A Javascript navigation interrupted the initial history load. Check if an | 1192 // A Javascript navigation interrupted the initial history load. Check if an |
1181 // initial subframe cross-process navigation needs to be canceled as a result. | 1193 // initial subframe cross-process navigation needs to be canceled as a result. |
1182 // TODO(creis, clamy): Cancel any cross-process navigation in PlzNavigate. | 1194 // TODO(creis, clamy): Cancel any cross-process navigation in PlzNavigate. |
1183 if (GetParent() && !frame_tree_node_->has_committed_real_load() && | 1195 if (GetParent() && !frame_tree_node_->has_committed_real_load() && |
1184 frame_tree_node_->render_manager()->pending_frame_host()) { | 1196 frame_tree_node_->render_manager()->pending_frame_host()) { |
1185 frame_tree_node_->render_manager()->CancelPendingIfNecessary( | 1197 frame_tree_node_->render_manager()->CancelPendingIfNecessary( |
1186 frame_tree_node_->render_manager()->pending_frame_host()); | 1198 frame_tree_node_->render_manager()->pending_frame_host()); |
(...skipping 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3664 } | 3676 } |
3665 | 3677 |
3666 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 3678 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
3667 const std::string& interface_name, | 3679 const std::string& interface_name, |
3668 mojo::ScopedMessagePipeHandle pipe) { | 3680 mojo::ScopedMessagePipeHandle pipe) { |
3669 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 3681 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
3670 } | 3682 } |
3671 #endif | 3683 #endif |
3672 | 3684 |
3673 } // namespace content | 3685 } // namespace content |
OLD | NEW |