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

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

Issue 1108863002: Revert "Ensure we properly set PageTransition for iframes." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 7 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 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 WebURLRequest::UseProtocolCachePolicy; 1084 WebURLRequest::UseProtocolCachePolicy;
1085 if (!RenderFrameImpl::PrepareRenderViewForNavigation( 1085 if (!RenderFrameImpl::PrepareRenderViewForNavigation(
1086 common_params.url, is_history_navigation, request_params, &is_reload, 1086 common_params.url, is_history_navigation, request_params, &is_reload,
1087 &cache_policy)) { 1087 &cache_policy)) {
1088 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); 1088 Send(new FrameHostMsg_DidDropNavigation(routing_id_));
1089 return; 1089 return;
1090 } 1090 }
1091 1091
1092 GetContentClient()->SetActiveURL(common_params.url); 1092 GetContentClient()->SetActiveURL(common_params.url);
1093 1093
1094 // If this frame isn't in the same process as its parent, it will naively
1095 // assume that this is the first navigation in the iframe, but this may not
1096 // actually be the case. The PageTransition differentiates between the first
1097 // navigation in a subframe and subsequent navigations, so if this is a
1098 // subsequent navigation, force the frame's state machine forward.
1099 if (ui::PageTransitionCoreTypeIs(common_params.transition,
1100 ui::PAGE_TRANSITION_MANUAL_SUBFRAME)) {
1101 CHECK(frame_->parent());
1102 if (frame_->parent()->isWebRemoteFrame()) {
1103 frame_->setCommittedFirstRealLoad();
1104 }
1105 }
1106
1107 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { 1094 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) {
1108 // We cannot reload if we do not have any history state. This happens, for 1095 // We cannot reload if we do not have any history state. This happens, for
1109 // example, when recovering from a crash. 1096 // example, when recovering from a crash.
1110 is_reload = false; 1097 is_reload = false;
1111 cache_policy = WebURLRequest::ReloadIgnoringCacheData; 1098 cache_policy = WebURLRequest::ReloadIgnoringCacheData;
1112 } 1099 }
1113 1100
1114 pending_navigation_params_.reset( 1101 pending_navigation_params_.reset(
1115 new NavigationParams(common_params, start_params, request_params)); 1102 new NavigationParams(common_params, start_params, request_params));
1116 1103
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 // Update the request time if WebKit has better knowledge of it. 2538 // Update the request time if WebKit has better knowledge of it.
2552 if (document_state->request_time().is_null() && 2539 if (document_state->request_time().is_null() &&
2553 triggering_event_time != 0.0) { 2540 triggering_event_time != 0.0) {
2554 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); 2541 document_state->set_request_time(Time::FromDoubleT(triggering_event_time));
2555 } 2542 }
2556 2543
2557 // Start time is only set after request time. 2544 // Start time is only set after request time.
2558 document_state->set_start_load_time(Time::Now()); 2545 document_state->set_start_load_time(Time::Now());
2559 2546
2560 bool is_top_most = !frame->parent(); 2547 bool is_top_most = !frame->parent();
2561 NavigationStateImpl* navigation_state =
2562 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2563 if (is_top_most) { 2548 if (is_top_most) {
2564 render_view_->set_navigation_gesture( 2549 render_view_->set_navigation_gesture(
2565 WebUserGestureIndicator::isProcessingUserGesture() ? 2550 WebUserGestureIndicator::isProcessingUserGesture() ?
2566 NavigationGestureUser : NavigationGestureAuto); 2551 NavigationGestureUser : NavigationGestureAuto);
2567 } else if (ds->replacesCurrentHistoryItem()) { 2552 } else if (ds->replacesCurrentHistoryItem()) {
2568 // Subframe navigations that don't add session history items must be 2553 // Subframe navigations that don't add session history items must be
2569 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 2554 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
2570 // handle loading of error pages. 2555 // handle loading of error pages.
2571 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); 2556 static_cast<NavigationStateImpl*>(document_state->navigation_state())
2572 } else if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), 2557 ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME);
2573 ui::PAGE_TRANSITION_LINK)) {
2574 // Subframe navigations that are creating a new history item should be
2575 // marked MANUAL_SUBFRAME, unless it has already been marked as a
2576 // FORM_SUBMIT. This state will be attached to a main resource request
2577 // in the process that began the request. If the request is transferred
2578 // to a different process, this state will be used in
2579 // RenderFrameImpl::OnNavigate() in the new process (as well as in the
2580 // browser process).
2581 navigation_state->set_transition_type(ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
2582 } 2558 }
2583 2559
2584 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2560 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2585 DidStartProvisionalLoad(frame)); 2561 DidStartProvisionalLoad(frame));
2586 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); 2562 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad());
2587 2563
2588 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( 2564 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
2589 routing_id_, ds->request().url(), is_transition_navigation)); 2565 routing_id_, ds->request().url(), is_transition_navigation));
2590 } 2566 }
2591 2567
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 // TODO(nasko): When the top-level frame is remote, there is no document. 3131 // TODO(nasko): When the top-level frame is remote, there is no document.
3156 // This is broken and should be fixed to propagate the first party. 3132 // This is broken and should be fixed to propagate the first party.
3157 WebFrame* top = frame->top(); 3133 WebFrame* top = frame->top();
3158 if (top->isWebLocalFrame()) { 3134 if (top->isWebLocalFrame()) {
3159 request.setFirstPartyForCookies( 3135 request.setFirstPartyForCookies(
3160 frame->top()->document().firstPartyForCookies()); 3136 frame->top()->document().firstPartyForCookies());
3161 } 3137 }
3162 } 3138 }
3163 } 3139 }
3164 3140
3165 WebDataSource* provisional_data_source = frame->provisionalDataSource(); 3141 WebFrame* top_frame = frame->top();
3142 // TODO(nasko): Hack around asking about top-frame data source. This means
3143 // for out-of-process iframes we are treating the current frame as the
3144 // top-level frame, which is wrong.
3145 if (!top_frame || top_frame->isWebRemoteFrame())
3146 top_frame = frame;
3147 WebDataSource* provisional_data_source = top_frame->provisionalDataSource();
3148 WebDataSource* top_data_source = top_frame->dataSource();
3166 WebDataSource* data_source = 3149 WebDataSource* data_source =
3167 provisional_data_source ? provisional_data_source : frame->dataSource(); 3150 provisional_data_source ? provisional_data_source : top_data_source;
3168 3151
3169 DocumentState* document_state = DocumentState::FromDataSource(data_source); 3152 DocumentState* document_state = DocumentState::FromDataSource(data_source);
3170 DCHECK(document_state); 3153 DCHECK(document_state);
3171 InternalDocumentStateData* internal_data = 3154 InternalDocumentStateData* internal_data =
3172 InternalDocumentStateData::FromDocumentState(document_state); 3155 InternalDocumentStateData::FromDocumentState(document_state);
3173 NavigationStateImpl* navigation_state = 3156 NavigationStateImpl* navigation_state =
3174 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3157 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3175 ui::PageTransition transition_type = navigation_state->GetTransitionType(); 3158 ui::PageTransition transition_type = navigation_state->GetTransitionType();
3176 WebDataSource* frame_ds = frame->provisionalDataSource(); 3159 WebDataSource* frame_ds = frame->provisionalDataSource();
3177 if (frame_ds && frame_ds->isClientRedirect()) { 3160 if (frame_ds && frame_ds->isClientRedirect()) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3296 extra_data->set_transition_type(transition_type); 3279 extra_data->set_transition_type(transition_type);
3297 extra_data->set_should_replace_current_entry(should_replace_current_entry); 3280 extra_data->set_should_replace_current_entry(should_replace_current_entry);
3298 extra_data->set_transferred_request_child_id( 3281 extra_data->set_transferred_request_child_id(
3299 navigation_state->start_params().transferred_request_child_id); 3282 navigation_state->start_params().transferred_request_child_id);
3300 extra_data->set_transferred_request_request_id( 3283 extra_data->set_transferred_request_request_id(
3301 navigation_state->start_params().transferred_request_request_id); 3284 navigation_state->start_params().transferred_request_request_id);
3302 extra_data->set_service_worker_provider_id(provider_id); 3285 extra_data->set_service_worker_provider_id(provider_id);
3303 extra_data->set_stream_override(stream_override.Pass()); 3286 extra_data->set_stream_override(stream_override.Pass());
3304 request.setExtraData(extra_data); 3287 request.setExtraData(extra_data);
3305 3288
3306 WebFrame* top_frame = frame->top();
3307 // TODO(nasko): Hack around asking about top-frame data source. This means
3308 // for out-of-process iframes we are treating the current frame as the
3309 // top-level frame, which is wrong.
3310 if (!top_frame || top_frame->isWebRemoteFrame())
3311 top_frame = frame;
3312 DocumentState* top_document_state = 3289 DocumentState* top_document_state =
3313 DocumentState::FromDataSource(top_frame->dataSource()); 3290 DocumentState::FromDataSource(top_data_source);
3314 if (top_document_state) { 3291 if (top_document_state) {
3315 // TODO(gavinp): separate out prefetching and prerender field trials 3292 // TODO(gavinp): separate out prefetching and prerender field trials
3316 // if the rel=prerender rel type is sticking around. 3293 // if the rel=prerender rel type is sticking around.
3317 if (request.requestContext() == WebURLRequest::RequestContextPrefetch) 3294 if (request.requestContext() == WebURLRequest::RequestContextPrefetch)
3318 top_document_state->set_was_prefetcher(true); 3295 top_document_state->set_was_prefetcher(true);
3319 } 3296 }
3320 3297
3321 // This is an instance where we embed a copy of the routing id 3298 // This is an instance where we embed a copy of the routing id
3322 // into the data portion of the message. This can cause problems if we 3299 // into the data portion of the message. This can cause problems if we
3323 // don't register this id on the browser side, since the download manager 3300 // don't register this id on the browser side, since the download manager
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
4871 #elif defined(ENABLE_BROWSER_CDMS) 4848 #elif defined(ENABLE_BROWSER_CDMS)
4872 cdm_manager_, 4849 cdm_manager_,
4873 #endif 4850 #endif
4874 this); 4851 this);
4875 } 4852 }
4876 4853
4877 return cdm_factory_; 4854 return cdm_factory_;
4878 } 4855 }
4879 4856
4880 } // namespace content 4857 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/test/test_frame_navigation_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698