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

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: Address avi's comments 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1056
1057 WebFrame* frame = frame_; 1057 WebFrame* frame = frame_;
1058 if (!commit_params.frame_to_navigate.empty()) { 1058 if (!commit_params.frame_to_navigate.empty()) {
1059 // TODO(nasko): Move this lookup to the browser process. 1059 // TODO(nasko): Move this lookup to the browser process.
1060 frame = render_view_->webview()->findFrameByName( 1060 frame = render_view_->webview()->findFrameByName(
1061 WebString::fromUTF8(commit_params.frame_to_navigate)); 1061 WebString::fromUTF8(commit_params.frame_to_navigate));
1062 CHECK(frame) << "Invalid frame name passed: " 1062 CHECK(frame) << "Invalid frame name passed: "
1063 << commit_params.frame_to_navigate; 1063 << commit_params.frame_to_navigate;
1064 } 1064 }
1065 1065
1066 if (ui::PageTransitionCoreTypeIs(params.common_params.transition,
Charlie Reis 2015/03/12 22:54:18 This needs a comment since it's non-obvious. I'm
Nate Chapin 2015/03/13 21:48:36 Yep. Added a comment to this effect.
1067 ui::PAGE_TRANSITION_MANUAL_SUBFRAME)) {
1068 CHECK(frame_->parent());
1069 if (frame_->parent()->isWebRemoteFrame()) {
1070 CHECK_EQ(frame, frame_);
Charlie Reis 2015/03/12 22:54:18 nit: Wrong indent.
Nate Chapin 2015/03/13 21:48:35 Done.
1071 frame_->setCommittedFirstRealLoad();
1072 }
1073 }
1074
1066 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { 1075 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) {
1067 // We cannot reload if we do not have any history state. This happens, for 1076 // We cannot reload if we do not have any history state. This happens, for
1068 // example, when recovering from a crash. 1077 // example, when recovering from a crash.
1069 is_reload = false; 1078 is_reload = false;
1070 cache_policy = WebURLRequest::ReloadIgnoringCacheData; 1079 cache_policy = WebURLRequest::ReloadIgnoringCacheData;
1071 } 1080 }
1072 1081
1073 render_view_->pending_navigation_params_.reset(new NavigationParams( 1082 render_view_->pending_navigation_params_.reset(new NavigationParams(
1074 common_params, start_params, commit_params, history_params)); 1083 common_params, start_params, commit_params, history_params));
1075 1084
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 if (is_top_most) { 2345 if (is_top_most) {
2337 render_view_->set_navigation_gesture( 2346 render_view_->set_navigation_gesture(
2338 WebUserGestureIndicator::isProcessingUserGesture() ? 2347 WebUserGestureIndicator::isProcessingUserGesture() ?
2339 NavigationGestureUser : NavigationGestureAuto); 2348 NavigationGestureUser : NavigationGestureAuto);
2340 } else if (ds->replacesCurrentHistoryItem()) { 2349 } else if (ds->replacesCurrentHistoryItem()) {
2341 // Subframe navigations that don't add session history items must be 2350 // Subframe navigations that don't add session history items must be
2342 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 2351 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
2343 // handle loading of error pages. 2352 // handle loading of error pages.
2344 document_state->navigation_state()->set_transition_type( 2353 document_state->navigation_state()->set_transition_type(
2345 ui::PAGE_TRANSITION_AUTO_SUBFRAME); 2354 ui::PAGE_TRANSITION_AUTO_SUBFRAME);
2355 } else if (ui::PageTransitionCoreTypeIs(
2356 document_state->navigation_state()->transition_type(),
2357 ui::PAGE_TRANSITION_LINK)) {
2358 document_state->navigation_state()->set_transition_type(
2359 ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
Charlie Reis 2015/03/12 22:54:18 This is not obvious from reading the code. Avi an
Nate Chapin 2015/03/13 21:48:36 Commented.
2346 } 2360 }
2347 2361
2348 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2362 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2349 DidStartProvisionalLoad(frame)); 2363 DidStartProvisionalLoad(frame));
2350 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); 2364 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad());
2351 2365
2352 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( 2366 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
2353 routing_id_, ds->request().url(), is_transition_navigation)); 2367 routing_id_, ds->request().url(), is_transition_navigation));
2354 } 2368 }
2355 2369
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 } 2988 }
2975 } 2989 }
2976 } 2990 }
2977 2991
2978 WebFrame* top_frame = frame->top(); 2992 WebFrame* top_frame = frame->top();
2979 // TODO(nasko): Hack around asking about top-frame data source. This means 2993 // TODO(nasko): Hack around asking about top-frame data source. This means
2980 // for out-of-process iframes we are treating the current frame as the 2994 // for out-of-process iframes we are treating the current frame as the
2981 // top-level frame, which is wrong. 2995 // top-level frame, which is wrong.
2982 if (!top_frame || top_frame->isWebRemoteFrame()) 2996 if (!top_frame || top_frame->isWebRemoteFrame())
2983 top_frame = frame; 2997 top_frame = frame;
2984 WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); 2998 WebDataSource* provisional_data_source = frame->provisionalDataSource();
2985 WebDataSource* top_data_source = top_frame->dataSource(); 2999 WebDataSource* top_data_source = top_frame->dataSource();
2986 WebDataSource* data_source = 3000 WebDataSource* data_source =
2987 provisional_data_source ? provisional_data_source : top_data_source; 3001 provisional_data_source ? provisional_data_source : top_data_source;
Charlie Reis 2015/03/12 22:54:18 I'm pretty confused by this whole block. Shouldn'
Nate Chapin 2015/03/13 21:48:35 Fair point. Converted to all this frame's data sou
2988 3002
2989 DocumentState* document_state = DocumentState::FromDataSource(data_source); 3003 DocumentState* document_state = DocumentState::FromDataSource(data_source);
2990 DCHECK(document_state); 3004 DCHECK(document_state);
2991 InternalDocumentStateData* internal_data = 3005 InternalDocumentStateData* internal_data =
2992 InternalDocumentStateData::FromDocumentState(document_state); 3006 InternalDocumentStateData::FromDocumentState(document_state);
2993 NavigationState* navigation_state = document_state->navigation_state(); 3007 NavigationState* navigation_state = document_state->navigation_state();
2994 ui::PageTransition transition_type = navigation_state->transition_type(); 3008 ui::PageTransition transition_type = navigation_state->transition_type();
2995 WebDataSource* frame_ds = frame->provisionalDataSource(); 3009 WebDataSource* frame_ds = frame->provisionalDataSource();
2996 if (frame_ds && frame_ds->isClientRedirect()) { 3010 if (frame_ds && frame_ds->isClientRedirect()) {
2997 transition_type = ui::PageTransitionFromInt( 3011 transition_type = ui::PageTransitionFromInt(
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 4529
4516 #if defined(ENABLE_BROWSER_CDMS) 4530 #if defined(ENABLE_BROWSER_CDMS)
4517 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4531 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4518 if (!cdm_manager_) 4532 if (!cdm_manager_)
4519 cdm_manager_ = new RendererCdmManager(this); 4533 cdm_manager_ = new RendererCdmManager(this);
4520 return cdm_manager_; 4534 return cdm_manager_;
4521 } 4535 }
4522 #endif // defined(ENABLE_BROWSER_CDMS) 4536 #endif // defined(ENABLE_BROWSER_CDMS)
4523 4537
4524 } // namespace content 4538 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698