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

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: a Created 4 years, 2 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 /* 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();
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 // Generate start and stop notifications only when loader is completed so that 777 // Generate start and stop notifications only when loader is completed so that
778 // we don't fire them for fragment redirection that happens in window.onload 778 // we don't fire them for fragment redirection that happens in window.onload
779 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 779 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838
780 if (m_frame->document()->loadEventFinished()) 780 if (m_frame->document()->loadEventFinished())
781 client()->didStartLoading(NavigationWithinSameDocument); 781 client()->didStartLoading(NavigationWithinSameDocument);
782 782
783 HistoryCommitType historyCommitType = loadTypeToCommitType(type); 783 HistoryCommitType historyCommitType = loadTypeToCommitType(type);
784 if (!m_currentItem) 784 if (!m_currentItem)
785 historyCommitType = HistoryInertCommit; 785 historyCommitType = HistoryInertCommit;
786 if (m_frame->settings()->historyEntryRequiresUserGesture() && 786 if (m_frame->settings()->historyEntryRequiresUserGesture() &&
787 !UserGestureIndicator::processedUserGestureSinceLoad() && 787 !m_frame->document()->hasReceivedUserGesture() && initiatingDocument)
ojan 2016/10/18 16:39:49 What happens in this case? 1. Load a top-level pag
Nate Chapin 2016/10/18 23:26:33 Hrm. This should probably be using initiatingDocum
ojan 2016/10/18 23:40:25 Right. And that means it gets a history entry?
788 initiatingDocument)
789 historyCommitType = HistoryInertCommit; 788 historyCommitType = HistoryInertCommit;
790 789
791 setHistoryItemStateForCommit( 790 setHistoryItemStateForCommit(
792 type, historyCommitType, 791 type, historyCommitType,
793 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi 792 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi
794 ? HistoryNavigationType::HistoryApi 793 ? HistoryNavigationType::HistoryApi
795 : HistoryNavigationType::Fragment); 794 : HistoryNavigationType::Fragment);
796 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { 795 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) {
797 m_currentItem->setStateObject(std::move(data)); 796 m_currentItem->setStateObject(std::move(data));
798 m_currentItem->setScrollRestorationType(scrollRestorationType); 797 m_currentItem->setScrollRestorationType(scrollRestorationType);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 ? FrameLoadTypeStandard 923 ? FrameLoadTypeStandard
925 : FrameLoadTypeReplaceCurrentItem; 924 : FrameLoadTypeReplaceCurrentItem;
926 } 925 }
927 926
928 if (request.substituteData().failingURL() == 927 if (request.substituteData().failingURL() ==
929 m_documentLoader->urlForHistory() && 928 m_documentLoader->urlForHistory() &&
930 m_loadType == FrameLoadTypeReload) 929 m_loadType == FrameLoadTypeReload)
931 return FrameLoadTypeReload; 930 return FrameLoadTypeReload;
932 931
933 if (m_frame->settings()->historyEntryRequiresUserGesture() && 932 if (m_frame->settings()->historyEntryRequiresUserGesture() &&
934 !UserGestureIndicator::processedUserGestureSinceLoad() && 933 !m_frame->document()->hasReceivedUserGesture() &&
935 request.originDocument()) 934 request.originDocument())
936 return FrameLoadTypeReplaceCurrentItem; 935 return FrameLoadTypeReplaceCurrentItem;
937 936
938 return FrameLoadTypeStandard; 937 return FrameLoadTypeStandard;
939 } 938 }
940 939
941 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) { 940 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) {
942 // If no origin Document* was specified, skip remaining security checks and 941 // If no origin Document* was specified, skip remaining security checks and
943 // assume the caller has fully initialized the FrameLoadRequest. 942 // assume the caller has fully initialized the FrameLoadRequest.
944 if (!request.originDocument()) 943 if (!request.originDocument())
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 m_documentLoader ? m_documentLoader->url() : String()); 1905 m_documentLoader ? m_documentLoader->url() : String());
1907 return tracedValue; 1906 return tracedValue;
1908 } 1907 }
1909 1908
1910 inline void FrameLoader::takeObjectSnapshot() const { 1909 inline void FrameLoader::takeObjectSnapshot() const {
1911 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1910 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1912 toTracedValue()); 1911 toTracedValue());
1913 } 1912 }
1914 1913
1915 } // namespace blink 1914 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698