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

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

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 void FrameLoader::clearProvisionalHistoryItem() { 388 void FrameLoader::clearProvisionalHistoryItem() {
389 m_provisionalItem.clear(); 389 m_provisionalItem.clear();
390 } 390 }
391 391
392 void FrameLoader::setHistoryItemStateForCommit( 392 void FrameLoader::setHistoryItemStateForCommit(
393 FrameLoadType loadType, 393 FrameLoadType loadType,
394 HistoryCommitType historyCommitType, 394 HistoryCommitType historyCommitType,
395 HistoryNavigationType navigationType) { 395 HistoryNavigationType navigationType) {
396 if (m_frame->settings()->historyEntryRequiresUserGesture() && 396 if (m_frame->settings()->historyEntryRequiresUserGesture() &&
397 historyCommitType == StandardCommit) 397 historyCommitType == StandardCommit)
398 UserGestureIndicator::clearProcessedUserGestureSinceLoad(); 398 m_frame->document()->clearHasReceivedUserGesture();
Nate Chapin 2016/10/21 18:11:04 I moved this to updateForSameDocumentNavigation().
399 399
400 HistoryItem* oldItem = m_currentItem; 400 HistoryItem* oldItem = m_currentItem;
401 if (isBackForwardLoadType(loadType) && m_provisionalItem) 401 if (isBackForwardLoadType(loadType) && m_provisionalItem)
402 m_currentItem = m_provisionalItem.release(); 402 m_currentItem = m_provisionalItem.release();
403 else 403 else
404 m_currentItem = HistoryItem::create(); 404 m_currentItem = HistoryItem::create();
405 m_currentItem->setURL(m_documentLoader->urlForHistory()); 405 m_currentItem->setURL(m_documentLoader->urlForHistory());
406 m_currentItem->setDocumentState(m_frame->document()->formElementsState()); 406 m_currentItem->setDocumentState(m_frame->document()->formElementsState());
407 m_currentItem->setTarget(m_frame->tree().uniqueName()); 407 m_currentItem->setTarget(m_frame->tree().uniqueName());
408 m_currentItem->setReferrer(SecurityPolicy::generateReferrer( 408 m_currentItem->setReferrer(SecurityPolicy::generateReferrer(
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 // Generate start and stop notifications only when loader is completed so that 783 // Generate start and stop notifications only when loader is completed so that
784 // we don't fire them for fragment redirection that happens in window.onload 784 // we don't fire them for fragment redirection that happens in window.onload
785 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 785 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838
786 if (m_frame->document()->loadEventFinished()) 786 if (m_frame->document()->loadEventFinished())
787 client()->didStartLoading(NavigationWithinSameDocument); 787 client()->didStartLoading(NavigationWithinSameDocument);
788 788
789 HistoryCommitType historyCommitType = loadTypeToCommitType(type); 789 HistoryCommitType historyCommitType = loadTypeToCommitType(type);
790 if (!m_currentItem) 790 if (!m_currentItem)
791 historyCommitType = HistoryInertCommit; 791 historyCommitType = HistoryInertCommit;
792 if (m_frame->settings()->historyEntryRequiresUserGesture() && 792 if (m_frame->settings()->historyEntryRequiresUserGesture() &&
793 !UserGestureIndicator::processedUserGestureSinceLoad() && 793 initiatingDocument && !initiatingDocument->hasReceivedUserGesture()) {
794 initiatingDocument)
795 historyCommitType = HistoryInertCommit; 794 historyCommitType = HistoryInertCommit;
795 }
796 796
797 setHistoryItemStateForCommit( 797 setHistoryItemStateForCommit(
798 type, historyCommitType, 798 type, historyCommitType,
799 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi 799 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi
800 ? HistoryNavigationType::HistoryApi 800 ? HistoryNavigationType::HistoryApi
801 : HistoryNavigationType::Fragment); 801 : HistoryNavigationType::Fragment);
802 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { 802 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) {
803 m_currentItem->setStateObject(std::move(data)); 803 m_currentItem->setStateObject(std::move(data));
804 m_currentItem->setScrollRestorationType(scrollRestorationType); 804 m_currentItem->setScrollRestorationType(scrollRestorationType);
805 } 805 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 ? FrameLoadTypeStandard 930 ? FrameLoadTypeStandard
931 : FrameLoadTypeReplaceCurrentItem; 931 : FrameLoadTypeReplaceCurrentItem;
932 } 932 }
933 933
934 if (request.substituteData().failingURL() == 934 if (request.substituteData().failingURL() ==
935 m_documentLoader->urlForHistory() && 935 m_documentLoader->urlForHistory() &&
936 m_loadType == FrameLoadTypeReload) 936 m_loadType == FrameLoadTypeReload)
937 return FrameLoadTypeReload; 937 return FrameLoadTypeReload;
938 938
939 if (m_frame->settings()->historyEntryRequiresUserGesture() && 939 if (m_frame->settings()->historyEntryRequiresUserGesture() &&
940 !UserGestureIndicator::processedUserGestureSinceLoad() && 940 request.originDocument() &&
941 request.originDocument()) 941 !request.originDocument()->hasReceivedUserGesture())
942 return FrameLoadTypeReplaceCurrentItem; 942 return FrameLoadTypeReplaceCurrentItem;
943 943
944 return FrameLoadTypeStandard; 944 return FrameLoadTypeStandard;
945 } 945 }
946 946
947 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) { 947 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) {
948 // If no origin Document* was specified, skip remaining security checks and 948 // If no origin Document* was specified, skip remaining security checks and
949 // assume the caller has fully initialized the FrameLoadRequest. 949 // assume the caller has fully initialized the FrameLoadRequest.
950 if (!request.originDocument()) 950 if (!request.originDocument())
951 return true; 951 return true;
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 m_documentLoader ? m_documentLoader->url() : String()); 1947 m_documentLoader ? m_documentLoader->url() : String());
1948 return tracedValue; 1948 return tracedValue;
1949 } 1949 }
1950 1950
1951 inline void FrameLoader::takeObjectSnapshot() const { 1951 inline void FrameLoader::takeObjectSnapshot() const {
1952 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1952 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1953 toTracedValue()); 1953 toTracedValue());
1954 } 1954 }
1955 1955
1956 } // namespace blink 1956 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp ('k') | third_party/WebKit/Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698