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

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

Issue 1002953004: Ensure we properly set PageTransition for iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 GetContentClient()->SetActiveURL(params.common_params.url); 1052 GetContentClient()->SetActiveURL(params.common_params.url);
1053 1053
1054 WebFrame* frame = frame_; 1054 WebFrame* frame = frame_;
1055 if (!params.frame_to_navigate.empty()) { 1055 if (!params.frame_to_navigate.empty()) {
1056 // TODO(nasko): Move this lookup to the browser process. 1056 // TODO(nasko): Move this lookup to the browser process.
1057 frame = render_view_->webview()->findFrameByName( 1057 frame = render_view_->webview()->findFrameByName(
1058 WebString::fromUTF8(params.frame_to_navigate)); 1058 WebString::fromUTF8(params.frame_to_navigate));
1059 CHECK(frame) << "Invalid frame name passed: " << params.frame_to_navigate; 1059 CHECK(frame) << "Invalid frame name passed: " << params.frame_to_navigate;
1060 } 1060 }
1061 1061
1062 if (ui::PageTransitionCoreTypeIs(params.common_params.transition,
1063 ui::PAGE_TRANSITION_MANUAL_SUBFRAME)) {
Nate Chapin 2015/03/12 20:31:56 Propagate the state back into blink.
1064 CHECK(frame_->parent());
1065 if (frame_->parent()->isWebRemoteFrame()) {
1066 CHECK_EQ(frame, frame_);
1067 frame_->setCommittedFirstRealLoad();
1068 }
1069 }
1070
1062 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { 1071 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) {
1063 // We cannot reload if we do not have any history state. This happens, for 1072 // We cannot reload if we do not have any history state. This happens, for
1064 // example, when recovering from a crash. 1073 // example, when recovering from a crash.
1065 is_reload = false; 1074 is_reload = false;
1066 cache_policy = WebURLRequest::ReloadIgnoringCacheData; 1075 cache_policy = WebURLRequest::ReloadIgnoringCacheData;
1067 } 1076 }
1068 1077
1069 render_view_->pending_navigation_params_.reset( 1078 render_view_->pending_navigation_params_.reset(
1070 new FrameMsg_Navigate_Params(params)); 1079 new FrameMsg_Navigate_Params(params));
1071 1080
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 if (is_top_most) { 2343 if (is_top_most) {
2335 render_view_->set_navigation_gesture( 2344 render_view_->set_navigation_gesture(
2336 WebUserGestureIndicator::isProcessingUserGesture() ? 2345 WebUserGestureIndicator::isProcessingUserGesture() ?
2337 NavigationGestureUser : NavigationGestureAuto); 2346 NavigationGestureUser : NavigationGestureAuto);
2338 } else if (ds->replacesCurrentHistoryItem()) { 2347 } else if (ds->replacesCurrentHistoryItem()) {
2339 // Subframe navigations that don't add session history items must be 2348 // Subframe navigations that don't add session history items must be
2340 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 2349 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
2341 // handle loading of error pages. 2350 // handle loading of error pages.
2342 document_state->navigation_state()->set_transition_type( 2351 document_state->navigation_state()->set_transition_type(
2343 ui::PAGE_TRANSITION_AUTO_SUBFRAME); 2352 ui::PAGE_TRANSITION_AUTO_SUBFRAME);
2353 } else if (ui::PageTransitionCoreTypeIs(
2354 document_state->navigation_state()->transition_type(),
2355 ui::PAGE_TRANSITION_LINK)) {
2356 document_state->navigation_state()->set_transition_type(
2357 ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
Nate Chapin 2015/03/12 20:31:56 Set the transition type correctly in the case we'r
2344 } 2358 }
2345 2359
2346 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2360 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2347 DidStartProvisionalLoad(frame)); 2361 DidStartProvisionalLoad(frame));
2348 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); 2362 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad());
2349 2363
2350 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( 2364 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
2351 routing_id_, ds->request().url(), is_transition_navigation)); 2365 routing_id_, ds->request().url(), is_transition_navigation));
2352 } 2366 }
2353 2367
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 } 2985 }
2972 } 2986 }
2973 } 2987 }
2974 2988
2975 WebFrame* top_frame = frame->top(); 2989 WebFrame* top_frame = frame->top();
2976 // TODO(nasko): Hack around asking about top-frame data source. This means 2990 // TODO(nasko): Hack around asking about top-frame data source. This means
2977 // for out-of-process iframes we are treating the current frame as the 2991 // for out-of-process iframes we are treating the current frame as the
2978 // top-level frame, which is wrong. 2992 // top-level frame, which is wrong.
2979 if (!top_frame || top_frame->isWebRemoteFrame()) 2993 if (!top_frame || top_frame->isWebRemoteFrame())
2980 top_frame = frame; 2994 top_frame = frame;
2981 WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); 2995 WebDataSource* provisional_data_source = frame->provisionalDataSource();
Nate Chapin 2015/03/12 20:31:56 I have no idea why we use the top frame here, but
2982 WebDataSource* top_data_source = top_frame->dataSource(); 2996 WebDataSource* top_data_source = top_frame->dataSource();
2983 WebDataSource* data_source = 2997 WebDataSource* data_source =
2984 provisional_data_source ? provisional_data_source : top_data_source; 2998 provisional_data_source ? provisional_data_source : top_data_source;
2985 2999
2986 DocumentState* document_state = DocumentState::FromDataSource(data_source); 3000 DocumentState* document_state = DocumentState::FromDataSource(data_source);
2987 DCHECK(document_state); 3001 DCHECK(document_state);
2988 InternalDocumentStateData* internal_data = 3002 InternalDocumentStateData* internal_data =
2989 InternalDocumentStateData::FromDocumentState(document_state); 3003 InternalDocumentStateData::FromDocumentState(document_state);
2990 NavigationState* navigation_state = document_state->navigation_state(); 3004 NavigationState* navigation_state = document_state->navigation_state();
2991 ui::PageTransition transition_type = navigation_state->transition_type(); 3005 ui::PageTransition transition_type = navigation_state->transition_type();
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
4510 4524
4511 #if defined(ENABLE_BROWSER_CDMS) 4525 #if defined(ENABLE_BROWSER_CDMS)
4512 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4526 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4513 if (!cdm_manager_) 4527 if (!cdm_manager_)
4514 cdm_manager_ = new RendererCdmManager(this); 4528 cdm_manager_ = new RendererCdmManager(this);
4515 return cdm_manager_; 4529 return cdm_manager_;
4516 } 4530 }
4517 #endif // defined(ENABLE_BROWSER_CDMS) 4531 #endif // defined(ENABLE_BROWSER_CDMS)
4518 4532
4519 } // namespace content 4533 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698