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

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: Now only calling BeforeUnload from the embedder 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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 1831
1839 void WebLocalFrameImpl::sendPings(const WebURL& destinationURL) 1832 void WebLocalFrameImpl::sendPings(const WebURL& destinationURL)
1840 { 1833 {
1841 DCHECK(frame()); 1834 DCHECK(frame());
1842 DCHECK(m_contextMenuNode.get()); 1835 DCHECK(m_contextMenuNode.get());
1843 Element* anchor = m_contextMenuNode->enclosingLinkEventParentOrSelf(); 1836 Element* anchor = m_contextMenuNode->enclosingLinkEventParentOrSelf();
1844 if (isHTMLAnchorElement(anchor)) 1837 if (isHTMLAnchorElement(anchor))
1845 toHTMLAnchorElement(anchor)->sendPings(destinationURL); 1838 toHTMLAnchorElement(anchor)->sendPings(destinationURL);
1846 } 1839 }
1847 1840
1841 bool WebLocalFrameImpl::dispatchBeforeUnloadEvent(bool* proceed)
1842 {
1843 if (!frame()) {
dcheng 2016/05/03 06:51:58 Do you mind pointing me at the layout test that tr
clamy 2016/05/03 13:17:09 It's third_party/WebKit/LayoutTests/fast/events/be
1844 *proceed = true;
1845 return true;
1846 }
1847
1848 *proceed = frame()->loader().shouldClose();
1849 return !!frame();
1850 }
1851
1848 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, WebCachePolicy cachePolicy) const 1852 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, WebCachePolicy cachePolicy) const
1849 { 1853 {
1850 HistoryItem* historyItem = item; 1854 HistoryItem* historyItem = item;
1851 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem( 1855 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem(
1852 historyItem, cachePolicy); 1856 historyItem, cachePolicy);
1853 return WrappedResourceRequest(request); 1857 return WrappedResourceRequest(request);
1854 } 1858 }
1855 1859
1856 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType, 1860 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
1857 const WebURL& overrideUrl) const 1861 const WebURL& overrideUrl) const
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 return WebSandboxFlags::None; 2115 return WebSandboxFlags::None;
2112 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2116 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2113 } 2117 }
2114 2118
2115 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2119 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2116 { 2120 {
2117 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2121 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2118 } 2122 }
2119 2123
2120 } // namespace blink 2124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698