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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 1890493002: PlzNavigate: properly execute BeforeUnload on renderer initiated navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 return WebDocument(frame()->document()); 680 return WebDocument(frame()->document());
681 } 681 }
682 682
683 WebPerformance WebLocalFrameImpl::performance() const 683 WebPerformance WebLocalFrameImpl::performance() const
684 { 684 {
685 if (!frame()) 685 if (!frame())
686 return WebPerformance(); 686 return WebPerformance();
687 return WebPerformance(DOMWindowPerformance::performance(*(frame()->domWindow ()))); 687 return WebPerformance(DOMWindowPerformance::performance(*(frame()->domWindow ())));
688 } 688 }
689 689
690 bool WebLocalFrameImpl::dispatchBeforeUnloadEvent()
691 {
692 if (!frame())
693 return true;
694 return frame()->loader().shouldClose();
695 }
696
697 void WebLocalFrameImpl::dispatchUnloadEvent() 690 void WebLocalFrameImpl::dispatchUnloadEvent()
698 { 691 {
699 if (!frame()) 692 if (!frame())
700 return; 693 return;
701 SubframeLoadingDisabler disabler(frame()->document()); 694 SubframeLoadingDisabler disabler(frame()->document());
702 frame()->loader().dispatchUnloadEvent(); 695 frame()->loader().dispatchUnloadEvent();
703 } 696 }
704 697
705 void WebLocalFrameImpl::executeScript(const WebScriptSource& source) 698 void WebLocalFrameImpl::executeScript(const WebScriptSource& source)
706 { 699 {
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 1833
1841 void WebLocalFrameImpl::sendPings(const WebURL& destinationURL) 1834 void WebLocalFrameImpl::sendPings(const WebURL& destinationURL)
1842 { 1835 {
1843 DCHECK(frame()); 1836 DCHECK(frame());
1844 DCHECK(m_contextMenuNode.get()); 1837 DCHECK(m_contextMenuNode.get());
1845 Element* anchor = m_contextMenuNode->enclosingLinkEventParentOrSelf(); 1838 Element* anchor = m_contextMenuNode->enclosingLinkEventParentOrSelf();
1846 if (isHTMLAnchorElement(anchor)) 1839 if (isHTMLAnchorElement(anchor))
1847 toHTMLAnchorElement(anchor)->sendPings(destinationURL); 1840 toHTMLAnchorElement(anchor)->sendPings(destinationURL);
1848 } 1841 }
1849 1842
1843 bool WebLocalFrameImpl::dispatchBeforeUnloadEvent(bool isReload)
1844 {
1845 if (!frame())
1846 return true;
1847
1848 return frame()->loader().shouldClose(isReload);
1849 }
1850
1850 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, WebCachePolicy cachePolicy) const 1851 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, WebCachePolicy cachePolicy) const
1851 { 1852 {
1852 HistoryItem* historyItem = item; 1853 HistoryItem* historyItem = item;
1853 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem( 1854 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem(
1854 historyItem, cachePolicy); 1855 historyItem, cachePolicy);
1855 return WrappedResourceRequest(request); 1856 return WrappedResourceRequest(request);
1856 } 1857 }
1857 1858
1858 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType, 1859 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
1859 const WebURL& overrideUrl) const 1860 const WebURL& overrideUrl) const
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 return WebSandboxFlags::None; 2107 return WebSandboxFlags::None;
2107 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2108 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2108 } 2109 }
2109 2110
2110 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2111 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2111 { 2112 {
2112 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2113 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2113 } 2114 }
2114 2115
2115 } // namespace blink 2116 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698