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

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

Issue 1360123006: Introduce RenderFrame::IsMainFrame and clean up a few things. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed content_browsertests failure. Created 5 years, 2 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 #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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 *opener_view_routing_id = opener_frame->render_view()->GetRoutingID(); 673 *opener_view_routing_id = opener_frame->render_view()->GetRoutingID();
674 return opener_frame->GetWebFrame(); 674 return opener_frame->GetWebFrame();
675 } 675 }
676 676
677 return nullptr; 677 return nullptr;
678 } 678 }
679 679
680 // RenderFrameImpl ---------------------------------------------------------- 680 // RenderFrameImpl ----------------------------------------------------------
681 RenderFrameImpl::RenderFrameImpl(const CreateParams& params) 681 RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
682 : frame_(NULL), 682 : frame_(NULL),
683 is_subframe_(false), 683 is_main_frame_(false),
Charlie Reis 2015/09/26 00:08:04 Maybe this should default to true, to match the pr
dglazkov 2015/09/28 04:03:35 Done.
684 is_local_root_(false), 684 is_local_root_(false),
685 render_view_(params.render_view->AsWeakPtr()), 685 render_view_(params.render_view->AsWeakPtr()),
686 routing_id_(params.routing_id), 686 routing_id_(params.routing_id),
687 is_swapped_out_(false), 687 is_swapped_out_(false),
688 render_frame_proxy_(NULL), 688 render_frame_proxy_(NULL),
689 is_detaching_(false), 689 is_detaching_(false),
690 proxy_routing_id_(MSG_ROUTING_NONE), 690 proxy_routing_id_(MSG_ROUTING_NONE),
691 #if defined(ENABLE_PLUGINS) 691 #if defined(ENABLE_PLUGINS)
692 plugin_power_saver_helper_(nullptr), 692 plugin_power_saver_helper_(nullptr),
693 #endif 693 #endif
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); 746 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone());
747 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); 747 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct());
748 748
749 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_); 749 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_);
750 750
751 #if defined(VIDEO_HOLE) 751 #if defined(VIDEO_HOLE)
752 if (contains_media_player_) 752 if (contains_media_player_)
753 render_view_->UnregisterVideoHoleFrame(this); 753 render_view_->UnregisterVideoHoleFrame(this);
754 #endif 754 #endif
755 755
756 if (!is_subframe_) { 756 if (is_main_frame_) {
757 // When using swapped out frames, RenderFrameProxy is owned by 757 // When using swapped out frames, RenderFrameProxy is owned by
758 // RenderFrameImpl in the case it is the main frame. Ensure it is deleted 758 // RenderFrameImpl in the case it is the main frame. Ensure it is deleted
759 // along with this object. 759 // along with this object.
760 if (render_frame_proxy_ && 760 if (render_frame_proxy_ &&
761 !SiteIsolationPolicy::IsSwappedOutStateForbidden()) { 761 !SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
762 // The following method calls back into this object and clears 762 // The following method calls back into this object and clears
763 // |render_frame_proxy_|. 763 // |render_frame_proxy_|.
764 render_frame_proxy_->frameDetached( 764 render_frame_proxy_->frameDetached(
765 blink::WebRemoteFrameClient::DetachType::Remove); 765 blink::WebRemoteFrameClient::DetachType::Remove);
766 } 766 }
(...skipping 14 matching lines...) Expand all
781 DCHECK(!frame_); 781 DCHECK(!frame_);
782 782
783 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert( 783 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert(
784 std::make_pair(web_frame, this)); 784 std::make_pair(web_frame, this));
785 CHECK(result.second) << "Inserting a duplicate item."; 785 CHECK(result.second) << "Inserting a duplicate item.";
786 786
787 frame_ = web_frame; 787 frame_ = web_frame;
788 } 788 }
789 789
790 void RenderFrameImpl::Initialize() { 790 void RenderFrameImpl::Initialize() {
791 is_subframe_ = !!frame_->parent(); 791 is_main_frame_ = !frame_->parent();
792 is_local_root_ = !frame_->parent() || frame_->parent()->isWebRemoteFrame(); 792 is_local_root_ = is_main_frame_ || frame_->parent()->isWebRemoteFrame();
793 793
794 bool is_tracing = false; 794 bool is_tracing = false;
795 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing); 795 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing);
796 if (is_tracing) { 796 if (is_tracing) {
797 int parent_id = MSG_ROUTING_NONE; 797 int parent_id = MSG_ROUTING_NONE;
798 if (is_subframe_) { 798 if (!is_main_frame_) {
799 if (frame_->parent()->isWebRemoteFrame()) { 799 if (frame_->parent()->isWebRemoteFrame()) {
800 RenderFrameProxy* parent_proxy = RenderFrameProxy::FromWebFrame( 800 RenderFrameProxy* parent_proxy = RenderFrameProxy::FromWebFrame(
801 frame_->parent()); 801 frame_->parent());
802 if (parent_proxy) 802 if (parent_proxy)
803 parent_id = parent_proxy->routing_id(); 803 parent_id = parent_proxy->routing_id();
804 } else { 804 } else {
805 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( 805 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame(
806 frame_->parent()); 806 frame_->parent());
807 if (parent_frame) 807 if (parent_frame)
808 parent_id = parent_frame->GetRoutingID(); 808 parent_id = parent_frame->GetRoutingID();
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 } 1201 }
1202 1202
1203 void RenderFrameImpl::OnSwapOut( 1203 void RenderFrameImpl::OnSwapOut(
1204 int proxy_routing_id, 1204 int proxy_routing_id,
1205 bool is_loading, 1205 bool is_loading,
1206 const FrameReplicationState& replicated_frame_state) { 1206 const FrameReplicationState& replicated_frame_state) {
1207 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); 1207 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
1208 RenderFrameProxy* proxy = NULL; 1208 RenderFrameProxy* proxy = NULL;
1209 bool swapped_out_forbidden = 1209 bool swapped_out_forbidden =
1210 SiteIsolationPolicy::IsSwappedOutStateForbidden(); 1210 SiteIsolationPolicy::IsSwappedOutStateForbidden();
1211 bool is_main_frame = !frame_->parent();
1212 1211
1213 // This codepath should only be hit for subframes when in --site-per-process. 1212 // This codepath should only be hit for subframes when in --site-per-process.
1214 CHECK_IMPLIES(!is_main_frame, 1213 CHECK_IMPLIES(!is_main_frame_,
1215 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 1214 SiteIsolationPolicy::AreCrossProcessFramesPossible());
1216 1215
1217 // Only run unload if we're not swapped out yet, but send the ack either way. 1216 // Only run unload if we're not swapped out yet, but send the ack either way.
1218 if (!is_swapped_out_) { 1217 if (!is_swapped_out_) {
1219 // Swap this RenderFrame out so the frame can navigate to a page rendered by 1218 // Swap this RenderFrame out so the frame can navigate to a page rendered by
1220 // a different process. This involves running the unload handler and 1219 // a different process. This involves running the unload handler and
1221 // clearing the page. We also allow this process to exit if there are no 1220 // clearing the page. We also allow this process to exit if there are no
1222 // other active RenderFrames in it. 1221 // other active RenderFrames in it.
1223 1222
1224 // Send an UpdateState message before we get swapped out. 1223 // Send an UpdateState message before we get swapped out.
1225 render_view_->SendUpdateState(); 1224 render_view_->SendUpdateState();
1226 1225
1227 // If we need a proxy to replace this, create it now so its routing id is 1226 // If we need a proxy to replace this, create it now so its routing id is
1228 // registered for receiving IPC messages. 1227 // registered for receiving IPC messages.
1229 if (proxy_routing_id != MSG_ROUTING_NONE) { 1228 if (proxy_routing_id != MSG_ROUTING_NONE) {
1230 proxy = RenderFrameProxy::CreateProxyToReplaceFrame( 1229 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
1231 this, proxy_routing_id, replicated_frame_state.scope); 1230 this, proxy_routing_id, replicated_frame_state.scope);
1232 } 1231 }
1233 1232
1234 // Synchronously run the unload handler before sending the ACK. 1233 // Synchronously run the unload handler before sending the ACK.
1235 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support 1234 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support
1236 // unload on subframes as well. 1235 // unload on subframes as well.
1237 if (is_main_frame) 1236 if (is_main_frame_)
1238 frame_->dispatchUnloadEvent(); 1237 frame_->dispatchUnloadEvent();
1239 1238
1240 // Swap out and stop sending any IPC messages that are not ACKs. 1239 // Swap out and stop sending any IPC messages that are not ACKs.
1241 if (is_main_frame) 1240 if (is_main_frame_)
1242 render_view_->SetSwappedOut(true); 1241 render_view_->SetSwappedOut(true);
1243 is_swapped_out_ = true; 1242 is_swapped_out_ = true;
1244 1243
1245 // Set the proxy here, since OnStop() below could cause an onload event 1244 // Set the proxy here, since OnStop() below could cause an onload event
1246 // handler to execute, which could trigger code such as 1245 // handler to execute, which could trigger code such as
1247 // willCheckAndDispatchMessageEvent() that needs the proxy. 1246 // willCheckAndDispatchMessageEvent() that needs the proxy.
1248 if (proxy) 1247 if (proxy)
1249 set_render_frame_proxy(proxy); 1248 set_render_frame_proxy(proxy);
1250 1249
1251 // Now that we're swapped out and filtering IPC messages, stop loading to 1250 // Now that we're swapped out and filtering IPC messages, stop loading to
1252 // ensure that no other in-progress navigation continues. We do this here 1251 // ensure that no other in-progress navigation continues. We do this here
1253 // to avoid sending a DidStopLoading message to the browser process. 1252 // to avoid sending a DidStopLoading message to the browser process.
1254 // TODO(creis): Should we be stopping all frames here and using 1253 // TODO(creis): Should we be stopping all frames here and using
1255 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this 1254 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this
1256 // frame? 1255 // frame?
1257 if (!swapped_out_forbidden) 1256 if (!swapped_out_forbidden)
1258 OnStop(); 1257 OnStop();
1259 1258
1260 // Transfer settings such as initial drawing parameters to the remote frame, 1259 // Transfer settings such as initial drawing parameters to the remote frame,
1261 // if one is created, that will replace this frame. 1260 // if one is created, that will replace this frame.
1262 if (!is_main_frame && proxy) 1261 if (!is_main_frame_ && proxy)
1263 proxy->web_frame()->initializeFromFrame(frame_); 1262 proxy->web_frame()->initializeFromFrame(frame_);
1264 1263
1265 // Replace the page with a blank dummy URL. The unload handler will not be 1264 // Replace the page with a blank dummy URL. The unload handler will not be
1266 // run a second time, thanks to a check in FrameLoader::stopLoading. 1265 // run a second time, thanks to a check in FrameLoader::stopLoading.
1267 // TODO(creis): Need to add a better way to do this that avoids running the 1266 // TODO(creis): Need to add a better way to do this that avoids running the
1268 // beforeunload handler. For now, we just run it a second time silently. 1267 // beforeunload handler. For now, we just run it a second time silently.
1269 if (!swapped_out_forbidden) 1268 if (!swapped_out_forbidden)
1270 NavigateToSwappedOutURL(); 1269 NavigateToSwappedOutURL();
1271 1270
1272 // Let WebKit know that this view is hidden so it can drop resources and 1271 // Let WebKit know that this view is hidden so it can drop resources and
1273 // stop compositing. 1272 // stop compositing.
1274 // TODO(creis): Support this for subframes as well. 1273 // TODO(creis): Support this for subframes as well.
1275 if (is_main_frame) { 1274 if (is_main_frame_) {
1276 render_view_->webview()->setVisibilityState( 1275 render_view_->webview()->setVisibilityState(
1277 blink::WebPageVisibilityStateHidden, false); 1276 blink::WebPageVisibilityStateHidden, false);
1278 } 1277 }
1279 } 1278 }
1280 1279
1281 // It is now safe to show modal dialogs again. 1280 // It is now safe to show modal dialogs again.
1282 // TODO(creis): Deal with modal dialogs from subframes. 1281 // TODO(creis): Deal with modal dialogs from subframes.
1283 if (is_main_frame) 1282 if (is_main_frame_)
1284 render_view_->suppress_dialogs_until_swap_out_ = false; 1283 render_view_->suppress_dialogs_until_swap_out_ = false;
1285 1284
1286 Send(new FrameHostMsg_SwapOut_ACK(routing_id_)); 1285 Send(new FrameHostMsg_SwapOut_ACK(routing_id_));
1287 1286
1288 RenderViewImpl* render_view = render_view_.get(); 1287 RenderViewImpl* render_view = render_view_.get();
1289 1288
1290 // Now that all of the cleanup is complete and the browser side is notified, 1289 // Now that all of the cleanup is complete and the browser side is notified,
1291 // start using the RenderFrameProxy, if one is created. 1290 // start using the RenderFrameProxy, if one is created.
1292 if (proxy && swapped_out_forbidden) { 1291 if (proxy && swapped_out_forbidden) {
1293 frame_->swap(proxy->web_frame()); 1292 frame_->swap(proxy->web_frame());
1294 1293
1295 if (is_loading) 1294 if (is_loading)
1296 proxy->OnDidStartLoading(); 1295 proxy->OnDidStartLoading();
1297 } 1296 }
1298 1297
1299 // In --site-per-process, initialize the WebRemoteFrame with the replication 1298 // In --site-per-process, initialize the WebRemoteFrame with the replication
1300 // state passed by the process that is now rendering the frame. 1299 // state passed by the process that is now rendering the frame.
1301 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because 1300 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because
1302 // in that case we leave the LocalFrame as the main frame visible to Blink 1301 // in that case we leave the LocalFrame as the main frame visible to Blink
1303 // and don't call swap() above. Because swap() is what creates a RemoteFrame 1302 // and don't call swap() above. Because swap() is what creates a RemoteFrame
1304 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. 1303 // in proxy->web_frame(), the RemoteFrame will not exist for main frames.
1305 // When we do an unconditional swap for all frames, we can remove 1304 // When we do an unconditional swap for all frames, we can remove
1306 // !is_main_frame below. 1305 // !is_main_frame below.
1307 if (proxy && swapped_out_forbidden) 1306 if (proxy && swapped_out_forbidden)
1308 proxy->SetReplicatedState(replicated_frame_state); 1307 proxy->SetReplicatedState(replicated_frame_state);
1309 1308
1310 // Safe to exit if no one else is using the process. 1309 // Safe to exit if no one else is using the process.
1311 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count 1310 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count
1312 // the process based on the lifetime of this RenderFrameImpl object. 1311 // the process based on the lifetime of this RenderFrameImpl object.
1313 if (is_main_frame) { 1312 if (is_main_frame_) {
1314 render_view->WasSwappedOut(); 1313 render_view->WasSwappedOut();
1315 } 1314 }
1316 } 1315 }
1317 1316
1318 void RenderFrameImpl::OnContextMenuClosed( 1317 void RenderFrameImpl::OnContextMenuClosed(
1319 const CustomContextMenuContext& custom_context) { 1318 const CustomContextMenuContext& custom_context) {
1320 if (custom_context.request_id) { 1319 if (custom_context.request_id) {
1321 // External request, should be in our map. 1320 // External request, should be in our map.
1322 ContextMenuClient* client = 1321 ContextMenuClient* client =
1323 pending_context_menus_.Lookup(custom_context.request_id); 1322 pending_context_menus_.Lookup(custom_context.request_id);
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 // containing RenderViewHost (so that they have the same lifetime), so only 2293 // containing RenderViewHost (so that they have the same lifetime), so only
2295 // removal from the map is needed and no deletion. 2294 // removal from the map is needed and no deletion.
2296 FrameMap::iterator it = g_frame_map.Get().find(frame); 2295 FrameMap::iterator it = g_frame_map.Get().find(frame);
2297 CHECK(it != g_frame_map.Get().end()); 2296 CHECK(it != g_frame_map.Get().end());
2298 CHECK_EQ(it->second, this); 2297 CHECK_EQ(it->second, this);
2299 g_frame_map.Get().erase(it); 2298 g_frame_map.Get().erase(it);
2300 2299
2301 // Only remove the frame from the renderer's frame tree if the frame is 2300 // Only remove the frame from the renderer's frame tree if the frame is
2302 // being detached for removal. In the case of a swap, the frame needs to 2301 // being detached for removal. In the case of a swap, the frame needs to
2303 // remain in the tree so WebFrame::swap() can replace it with the new frame. 2302 // remain in the tree so WebFrame::swap() can replace it with the new frame.
2304 if (is_subframe_ && type == DetachType::Remove) 2303 if (!is_main_frame_ && type == DetachType::Remove)
2305 frame->parent()->removeChild(frame); 2304 frame->parent()->removeChild(frame);
2306 2305
2307 // |frame| is invalid after here. Be sure to clear frame_ as well, since this 2306 // |frame| is invalid after here. Be sure to clear frame_ as well, since this
2308 // object may not be deleted immediately and other methods may try to access 2307 // object may not be deleted immediately and other methods may try to access
2309 // it. 2308 // it.
2310 frame->close(); 2309 frame->close();
2311 frame_ = nullptr; 2310 frame_ = nullptr;
2312 2311
2313 delete this; 2312 delete this;
2314 // Object is invalid after this point. 2313 // Object is invalid after this point.
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 if (proxy_routing_id_ != MSG_ROUTING_NONE) { 2718 if (proxy_routing_id_ != MSG_ROUTING_NONE) {
2720 RenderFrameProxy* proxy = 2719 RenderFrameProxy* proxy =
2721 RenderFrameProxy::FromRoutingID(proxy_routing_id_); 2720 RenderFrameProxy::FromRoutingID(proxy_routing_id_);
2722 CHECK(proxy); 2721 CHECK(proxy);
2723 proxy->web_frame()->swap(frame_); 2722 proxy->web_frame()->swap(frame_);
2724 proxy_routing_id_ = MSG_ROUTING_NONE; 2723 proxy_routing_id_ = MSG_ROUTING_NONE;
2725 2724
2726 // If this is the main frame going from a remote frame to a local frame, 2725 // If this is the main frame going from a remote frame to a local frame,
2727 // it needs to set RenderViewImpl's pointer for the main frame to itself 2726 // it needs to set RenderViewImpl's pointer for the main frame to itself
2728 // and ensure RenderWidget is no longer in swapped out mode. 2727 // and ensure RenderWidget is no longer in swapped out mode.
2729 if (!is_subframe_) { 2728 if (is_main_frame_) {
2730 CHECK(!render_view_->main_render_frame_); 2729 CHECK(!render_view_->main_render_frame_);
2731 render_view_->main_render_frame_ = this; 2730 render_view_->main_render_frame_ = this;
2732 if (render_view_->is_swapped_out()) 2731 if (render_view_->is_swapped_out())
2733 render_view_->SetSwappedOut(false); 2732 render_view_->SetSwappedOut(false);
2734 } 2733 }
2735 } 2734 }
2736 2735
2737 // When we perform a new navigation, we need to update the last committed 2736 // When we perform a new navigation, we need to update the last committed
2738 // session history entry with state for the page we are leaving. Do this 2737 // session history entry with state for the page we are leaving. Do this
2739 // before updating the HistoryController state. 2738 // before updating the HistoryController state.
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3923 static_cast<blink::WebFrameWidget*>(render_widget_->webwidget())-> 3922 static_cast<blink::WebFrameWidget*>(render_widget_->webwidget())->
3924 setVisibilityState(blink::WebPageVisibilityStateVisible, false); 3923 setVisibilityState(blink::WebPageVisibilityStateVisible, false);
3925 } 3924 }
3926 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown()); 3925 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown());
3927 } 3926 }
3928 3927
3929 void RenderFrameImpl::WidgetWillClose() { 3928 void RenderFrameImpl::WidgetWillClose() {
3930 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WidgetWillClose()); 3929 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WidgetWillClose());
3931 } 3930 }
3932 3931
3932 bool RenderFrameImpl::IsMainFrame() {
3933 return is_main_frame_;
3934 }
3935
3933 bool RenderFrameImpl::IsHidden() { 3936 bool RenderFrameImpl::IsHidden() {
3934 return GetRenderWidget()->is_hidden(); 3937 return GetRenderWidget()->is_hidden();
3935 } 3938 }
3936 3939
3937 // Tell the embedding application that the URL of the active page has changed. 3940 // Tell the embedding application that the URL of the active page has changed.
3938 void RenderFrameImpl::SendDidCommitProvisionalLoad( 3941 void RenderFrameImpl::SendDidCommitProvisionalLoad(
3939 blink::WebFrame* frame, 3942 blink::WebFrame* frame,
3940 blink::WebHistoryCommitType commit_type, 3943 blink::WebHistoryCommitType commit_type,
3941 const blink::WebHistoryItem& item) { 3944 const blink::WebHistoryItem& item) {
3942 DCHECK(!frame_ || frame_ == frame); 3945 DCHECK(!frame_ || frame_ == frame);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
4244 common_params.url == GetLoadingUrl(); 4247 common_params.url == GetLoadingUrl();
4245 LoadNavigationErrorPage(failed_request, error, replace); 4248 LoadNavigationErrorPage(failed_request, error, replace);
4246 } 4249 }
4247 4250
4248 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( 4251 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
4249 RenderFrame* render_frame, 4252 RenderFrame* render_frame,
4250 const NavigationPolicyInfo& info) { 4253 const NavigationPolicyInfo& info) {
4251 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, 4254 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame,
4252 info.urlRequest)); 4255 info.urlRequest));
4253 4256
4254 // TODO(nick): Is consulting |is_subframe_| here correct? 4257 // TODO(nick): Is consulting |is_main_frame| here correct?
4255 if (SiteIsolationPolicy::IsSwappedOutStateForbidden() && is_subframe_) { 4258 if (SiteIsolationPolicy::IsSwappedOutStateForbidden() && !is_main_frame_) {
4256 // There's no reason to ignore navigations on subframes, since the swap out 4259 // There's no reason to ignore navigations on subframes, since the swap out
4257 // logic no longer applies. 4260 // logic no longer applies.
4258 } else { 4261 } else {
4259 if (is_swapped_out_) { 4262 if (is_swapped_out_) {
4260 if (info.urlRequest.url() != GURL(kSwappedOutURL)) { 4263 if (info.urlRequest.url() != GURL(kSwappedOutURL)) {
4261 // Targeted links may try to navigate a swapped out frame. Allow the 4264 // Targeted links may try to navigate a swapped out frame. Allow the
4262 // browser process to navigate the tab instead. Note that it is also 4265 // browser process to navigate the tab instead. Note that it is also
4263 // possible for non-targeted navigations (from this view) to arrive 4266 // possible for non-targeted navigations (from this view) to arrive
4264 // here just after we are swapped out. It's ok to send them to the 4267 // here just after we are swapped out. It's ok to send them to the
4265 // browser, as long as they're for the top level frame. 4268 // browser, as long as they're for the top level frame.
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
5138 mojo::ServiceProviderPtr service_provider; 5141 mojo::ServiceProviderPtr service_provider;
5139 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5142 mojo::URLRequestPtr request(mojo::URLRequest::New());
5140 request->url = mojo::String::From(url); 5143 request->url = mojo::String::From(url);
5141 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5144 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5142 nullptr, nullptr, 5145 nullptr, nullptr,
5143 base::Bind(&OnGotContentHandlerID)); 5146 base::Bind(&OnGotContentHandlerID));
5144 return service_provider.Pass(); 5147 return service_provider.Pass();
5145 } 5148 }
5146 5149
5147 } // namespace content 5150 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698