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

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: Rebase + fixed issue with layout test Created 4 years, 6 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return WebDocument(frame()->document()); 681 return WebDocument(frame()->document());
682 } 682 }
683 683
684 WebPerformance WebLocalFrameImpl::performance() const 684 WebPerformance WebLocalFrameImpl::performance() const
685 { 685 {
686 if (!frame()) 686 if (!frame())
687 return WebPerformance(); 687 return WebPerformance();
688 return WebPerformance(DOMWindowPerformance::performance(*(frame()->domWindow ()))); 688 return WebPerformance(DOMWindowPerformance::performance(*(frame()->domWindow ())));
689 } 689 }
690 690
691 bool WebLocalFrameImpl::dispatchBeforeUnloadEvent()
692 {
693 if (!frame())
694 return true;
695 return frame()->loader().shouldClose();
696 }
697
698 void WebLocalFrameImpl::dispatchUnloadEvent() 691 void WebLocalFrameImpl::dispatchUnloadEvent()
699 { 692 {
700 if (!frame()) 693 if (!frame())
701 return; 694 return;
702 SubframeLoadingDisabler disabler(frame()->document()); 695 SubframeLoadingDisabler disabler(frame()->document());
703 frame()->loader().dispatchUnloadEvent(); 696 frame()->loader().dispatchUnloadEvent();
704 } 697 }
705 698
706 void WebLocalFrameImpl::executeScript(const WebScriptSource& source) 699 void WebLocalFrameImpl::executeScript(const WebScriptSource& source)
707 { 700 {
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 1816
1824 void WebLocalFrameImpl::sendPings(const WebURL& destinationURL) 1817 void WebLocalFrameImpl::sendPings(const WebURL& destinationURL)
1825 { 1818 {
1826 DCHECK(frame()); 1819 DCHECK(frame());
1827 DCHECK(m_contextMenuNode.get()); 1820 DCHECK(m_contextMenuNode.get());
1828 Element* anchor = m_contextMenuNode->enclosingLinkEventParentOrSelf(); 1821 Element* anchor = m_contextMenuNode->enclosingLinkEventParentOrSelf();
1829 if (isHTMLAnchorElement(anchor)) 1822 if (isHTMLAnchorElement(anchor))
1830 toHTMLAnchorElement(anchor)->sendPings(destinationURL); 1823 toHTMLAnchorElement(anchor)->sendPings(destinationURL);
1831 } 1824 }
1832 1825
1826 bool WebLocalFrameImpl::dispatchBeforeUnloadEvent(bool isReload)
1827 {
1828 if (!frame())
1829 return true;
1830
1831 return frame()->loader().shouldClose(isReload);
1832 }
1833
1833 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, WebCachePolicy cachePolicy) const 1834 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, WebCachePolicy cachePolicy) const
1834 { 1835 {
1835 HistoryItem* historyItem = item; 1836 HistoryItem* historyItem = item;
1836 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem( 1837 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem(
1837 historyItem, cachePolicy); 1838 historyItem, cachePolicy);
1838 return WrappedResourceRequest(request); 1839 return WrappedResourceRequest(request);
1839 } 1840 }
1840 1841
1841 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType, 1842 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
1842 const WebURL& overrideUrl) const 1843 const WebURL& overrideUrl) const
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 return WebSandboxFlags::None; 2090 return WebSandboxFlags::None;
2090 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2091 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2091 } 2092 }
2092 2093
2093 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2094 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2094 { 2095 {
2095 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2096 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2096 } 2097 }
2097 2098
2098 } // namespace blink 2099 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698