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

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 1140153006: Remove Navigation Transitions from Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed layout tests. 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch rome(), didAllowNavigation)) 1185 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch rome(), didAllowNavigation))
1186 break; 1186 break;
1187 } 1187 }
1188 1188
1189 if (i == targetFrames.size()) 1189 if (i == targetFrames.size())
1190 shouldClose = true; 1190 shouldClose = true;
1191 } 1191 }
1192 return shouldClose; 1192 return shouldClose;
1193 } 1193 }
1194 1194
1195 bool FrameLoader::validateTransitionNavigationMode()
1196 {
1197 if (m_frame->document()->inQuirksMode()) {
1198 m_frame->document()->addConsoleMessage(ConsoleMessage::create(JSMessageS ource, ErrorMessageLevel, "Ignoring transition elements due to quirks mode."));
1199 return false;
1200 }
1201
1202 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc aling issues.
1203 return true;
1204 }
1205
1206 bool FrameLoader::dispatchNavigationTransitionData()
1207 {
1208 Vector<Document::TransitionElementData> elementData;
1209 m_frame->document()->getTransitionElementData(elementData);
1210 if (elementData.isEmpty() || !validateTransitionNavigationMode())
1211 return false;
1212
1213 for (auto& element : elementData)
1214 client()->dispatchAddNavigationTransitionData(element);
1215
1216 return true;
1217 }
1218 1195
1219 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty pe, NavigationPolicy navigationPolicy) 1196 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty pe, NavigationPolicy navigationPolicy)
1220 { 1197 {
1221 ASSERT(client()->hasWebView()); 1198 ASSERT(client()->hasWebView());
1222 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 1199 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
1223 return; 1200 return;
1224 1201
1225 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent()); 1202 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent());
1226 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType)); 1203 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType));
1227 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); 1204 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested);
1228 ResourceRequest& request = frameLoadRequest.resourceRequest(); 1205 ResourceRequest& request = frameLoadRequest.resourceRequest();
1229 1206
1230 // The current load should replace the history item if it is the first real 1207 // The current load should replace the history item if it is the first real
1231 // load of the frame. 1208 // load of the frame.
1232 bool replacesCurrentHistoryItem = false; 1209 bool replacesCurrentHistoryItem = false;
1233 if (type == FrameLoadTypeRedirectWithLockedBackForwardList 1210 if (type == FrameLoadTypeRedirectWithLockedBackForwardList
1234 || !m_stateMachine.committedFirstRealDocumentLoad()) { 1211 || !m_stateMachine.committedFirstRealDocumentLoad()) {
1235 replacesCurrentHistoryItem = true; 1212 replacesCurrentHistoryItem = true;
1236 } 1213 }
1237 1214
1238 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, fr ameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData() : defaultSubstituteDataForURL(request.url())); 1215 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, fr ameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData() : defaultSubstituteDataForURL(request.url()));
1239 m_policyDocumentLoader->setNavigationType(navigationType); 1216 m_policyDocumentLoader->setNavigationType(navigationType);
1240 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item); 1217 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item);
1241 m_policyDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedirect( ) == ClientRedirect); 1218 m_policyDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedirect( ) == ClientRedirect);
1242 1219
1243 bool isTransitionNavigation = false;
1244 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS ame)
1245 isTransitionNavigation = dispatchNavigationTransitionData();
1246
1247 // stopAllLoaders can detach the LocalFrame, so protect it. 1220 // stopAllLoaders can detach the LocalFrame, so protect it.
1248 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1221 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
1249 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, fra meLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationPolicy, isT ransitionNavigation) || !shouldClose()) && m_policyDocumentLoader) { 1222 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, fra meLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationPolicy) || !shouldClose()) && m_policyDocumentLoader) {
1250 m_policyDocumentLoader->detachFromFrame(); 1223 m_policyDocumentLoader->detachFromFrame();
1251 m_policyDocumentLoader = nullptr; 1224 m_policyDocumentLoader = nullptr;
1252 return; 1225 return;
1253 } 1226 }
1254 1227
1255 // FIXME: This is an odd set of steps to shut down parsing and it's unclear why it works. 1228 // FIXME: This is an odd set of steps to shut down parsing and it's unclear why it works.
1256 // It's also unclear why other steps don't work. 1229 // It's also unclear why other steps don't work.
1257 if (m_frame->document()->parsing()) { 1230 if (m_frame->document()->parsing()) {
1258 finishedParsing(); 1231 finishedParsing();
1259 m_frame->document()->setParsingState(Document::FinishedParsing); 1232 m_frame->document()->setParsingState(Document::FinishedParsing);
(...skipping 21 matching lines...) Expand all
1281 m_loadType = type; 1254 m_loadType = type;
1282 1255
1283 if (frameLoadRequest.form()) 1256 if (frameLoadRequest.form())
1284 client()->dispatchWillSubmitForm(frameLoadRequest.form()); 1257 client()->dispatchWillSubmitForm(frameLoadRequest.form());
1285 1258
1286 m_progressTracker->progressStarted(); 1259 m_progressTracker->progressStarted();
1287 if (m_provisionalDocumentLoader->isClientRedirect()) 1260 if (m_provisionalDocumentLoader->isClientRedirect())
1288 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); 1261 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url());
1289 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req uest().url()); 1262 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req uest().url());
1290 double triggeringEventTime = frameLoadRequest.triggeringEvent() ? convertDOM TimeStampToSeconds(frameLoadRequest.triggeringEvent()->timeStamp()) : 0; 1263 double triggeringEventTime = frameLoadRequest.triggeringEvent() ? convertDOM TimeStampToSeconds(frameLoadRequest.triggeringEvent()->timeStamp()) : 0;
1291 client()->dispatchDidStartProvisionalLoad(isTransitionNavigation, triggering EventTime); 1264 client()->dispatchDidStartProvisionalLoad(triggeringEventTime);
1292 ASSERT(m_provisionalDocumentLoader); 1265 ASSERT(m_provisionalDocumentLoader);
1293 m_provisionalDocumentLoader->startLoadingMainResource(); 1266 m_provisionalDocumentLoader->startLoadingMainResource();
1294 } 1267 }
1295 1268
1296 void FrameLoader::applyUserAgent(ResourceRequest& request) 1269 void FrameLoader::applyUserAgent(ResourceRequest& request)
1297 { 1270 {
1298 String userAgent = this->userAgent(request.url()); 1271 String userAgent = this->userAgent(request.url());
1299 ASSERT(!userAgent.isNull()); 1272 ASSERT(!userAgent.isNull());
1300 request.setHTTPUserAgent(AtomicString(userAgent)); 1273 request.setHTTPUserAgent(AtomicString(userAgent));
1301 } 1274 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 // FIXME: We need a way to propagate insecure requests policy flags to 1429 // FIXME: We need a way to propagate insecure requests policy flags to
1457 // out-of-process frames. For now, we'll always use default behavior. 1430 // out-of-process frames. For now, we'll always use default behavior.
1458 if (!parentFrame->isLocalFrame()) 1431 if (!parentFrame->isLocalFrame())
1459 return nullptr; 1432 return nullptr;
1460 1433
1461 ASSERT(toLocalFrame(parentFrame)->document()); 1434 ASSERT(toLocalFrame(parentFrame)->document());
1462 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1435 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1463 } 1436 }
1464 1437
1465 } // namespace blink 1438 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698