diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/WebFrameProxy.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/WebFrameProxy.cpp | 96 |
1 files changed, 67 insertions, 29 deletions
diff --git a/Source/WebKit2/UIProcess/WebFrameProxy.cpp b/Source/WebKit2/UIProcess/WebFrameProxy.cpp index ea26db29d..b13102fd9 100644 --- a/Source/WebKit2/UIProcess/WebFrameProxy.cpp +++ b/Source/WebKit2/UIProcess/WebFrameProxy.cpp @@ -27,12 +27,12 @@ #include "WebFrameProxy.h" #include "WebCertificateInfo.h" -#include "WebContext.h" #include "WebFormSubmissionListenerProxy.h" #include "WebFramePolicyListenerProxy.h" #include "WebPageMessages.h" #include "WebPageProxy.h" -#include <WebCore/DOMImplementation.h> +#include "WebPasteboardProxy.h" +#include "WebProcessPool.h" #include <WebCore/Image.h> #include <WebCore/MIMETypeRegistry.h> #include <stdio.h> @@ -47,21 +47,24 @@ WebFrameProxy::WebFrameProxy(WebPageProxy* page, uint64_t frameID) , m_isFrameSet(false) , m_frameID(frameID) { - WebContext::statistics().wkFrameCount++; + WebProcessPool::statistics().wkFrameCount++; } WebFrameProxy::~WebFrameProxy() { - WebContext::statistics().wkFrameCount--; + WebProcessPool::statistics().wkFrameCount--; +#if PLATFORM(GTK) + WebPasteboardProxy::singleton().didDestroyFrame(this); +#endif } -void WebFrameProxy::disconnect() +void WebFrameProxy::webProcessWillShutDown() { - m_page = 0; + m_page = nullptr; if (m_activeListener) { m_activeListener->invalidate(); - m_activeListener = 0; + m_activeListener = nullptr; } } @@ -110,17 +113,20 @@ bool WebFrameProxy::isDisplayingStandaloneImageDocument() const return Image::supportsType(m_MIMEType); } +bool WebFrameProxy::isDisplayingStandaloneMediaDocument() const +{ + return MIMETypeRegistry::isSupportedMediaMIMEType(m_MIMEType); +} + bool WebFrameProxy::isDisplayingMarkupDocument() const { - // FIXME: This check should be moved to somewhere in WebCore. - return m_MIMEType == "text/html" || m_MIMEType == "image/svg+xml" || m_MIMEType == "application/x-webarchive" || DOMImplementation::isXMLMIMEType(m_MIMEType); + // FIXME: This should be a call to a single MIMETypeRegistry function; adding a new one if needed. + // FIXME: This is doing case sensitive comparisons on MIME types, should be using ASCII case insensitive instead. + return m_MIMEType == "text/html" || m_MIMEType == "image/svg+xml" || m_MIMEType == "application/x-webarchive" || MIMETypeRegistry::isXMLMIMEType(m_MIMEType); } bool WebFrameProxy::isDisplayingPDFDocument() const { - if (m_MIMEType.isEmpty()) - return false; - return MIMETypeRegistry::isPDFOrPostScriptMIMEType(m_MIMEType); } @@ -139,14 +145,15 @@ void WebFrameProxy::didFailProvisionalLoad() m_frameLoadState.didFailProvisionalLoad(); } -void WebFrameProxy::didCommitLoad(const String& contentType, const WebCore::CertificateInfo& certificateInfo) +void WebFrameProxy::didCommitLoad(const String& contentType, WebCertificateInfo& certificateInfo, bool containsPluginDocument) { m_frameLoadState.didCommitLoad(); m_title = String(); m_MIMEType = contentType; m_isFrameSet = false; - m_certificateInfo = WebCertificateInfo::create(certificateInfo); + m_certificateInfo = &certificateInfo; + m_containsPluginDocument = containsPluginDocument; } void WebFrameProxy::didFinishLoad() @@ -169,60 +176,60 @@ void WebFrameProxy::didChangeTitle(const String& title) m_title = title; } -void WebFrameProxy::receivedPolicyDecision(WebCore::PolicyAction action, uint64_t listenerID) +void WebFrameProxy::receivedPolicyDecision(WebCore::PolicyAction action, uint64_t listenerID, API::Navigation* navigation, const WebsitePolicies& websitePolicies) { if (!m_page) return; ASSERT(m_activeListener); ASSERT(m_activeListener->listenerID() == listenerID); - m_page->receivedPolicyDecision(action, this, listenerID); + m_page->receivedPolicyDecision(action, *this, listenerID, navigation, websitePolicies); } -WebFramePolicyListenerProxy* WebFrameProxy::setUpPolicyListenerProxy(uint64_t listenerID) +WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(uint64_t listenerID) { if (m_activeListener) m_activeListener->invalidate(); m_activeListener = WebFramePolicyListenerProxy::create(this, listenerID); - return static_cast<WebFramePolicyListenerProxy*>(m_activeListener.get()); + return *static_cast<WebFramePolicyListenerProxy*>(m_activeListener.get()); } -WebFormSubmissionListenerProxy* WebFrameProxy::setUpFormSubmissionListenerProxy(uint64_t listenerID) +WebFormSubmissionListenerProxy& WebFrameProxy::setUpFormSubmissionListenerProxy(uint64_t listenerID) { if (m_activeListener) m_activeListener->invalidate(); m_activeListener = WebFormSubmissionListenerProxy::create(this, listenerID); - return static_cast<WebFormSubmissionListenerProxy*>(m_activeListener.get()); + return *static_cast<WebFormSubmissionListenerProxy*>(m_activeListener.get()); } -void WebFrameProxy::getWebArchive(PassRefPtr<DataCallback> callback) +void WebFrameProxy::getWebArchive(std::function<void (API::Data*, CallbackBase::Error)> callbackFunction) { if (!m_page) { - callback->invalidate(); + callbackFunction(nullptr, CallbackBase::Error::Unknown); return; } - m_page->getWebArchiveOfFrame(this, callback); + m_page->getWebArchiveOfFrame(this, callbackFunction); } -void WebFrameProxy::getMainResourceData(PassRefPtr<DataCallback> callback) +void WebFrameProxy::getMainResourceData(std::function<void (API::Data*, CallbackBase::Error)> callbackFunction) { if (!m_page) { - callback->invalidate(); + callbackFunction(nullptr, CallbackBase::Error::Unknown); return; } - m_page->getMainResourceDataOfFrame(this, callback); + m_page->getMainResourceDataOfFrame(this, callbackFunction); } -void WebFrameProxy::getResourceData(API::URL* resourceURL, PassRefPtr<DataCallback> callback) +void WebFrameProxy::getResourceData(API::URL* resourceURL, std::function<void (API::Data*, CallbackBase::Error)> callbackFunction) { if (!m_page) { - callback->invalidate(); + callbackFunction(nullptr, CallbackBase::Error::Unknown); return; } - m_page->getResourceDataFromFrame(this, resourceURL, callback); + m_page->getResourceDataFromFrame(this, resourceURL, callbackFunction); } void WebFrameProxy::setUnreachableURL(const String& unreachableURL) @@ -230,4 +237,35 @@ void WebFrameProxy::setUnreachableURL(const String& unreachableURL) m_frameLoadState.setUnreachableURL(unreachableURL); } +#if ENABLE(CONTENT_FILTERING) +bool WebFrameProxy::didHandleContentFilterUnblockNavigation(const WebCore::ResourceRequest& request) +{ + if (!m_contentFilterUnblockHandler.canHandleRequest(request)) { + m_contentFilterUnblockHandler = { }; + return false; + } + + RefPtr<WebPageProxy> page { m_page }; + ASSERT(page); + m_contentFilterUnblockHandler.requestUnblockAsync([page](bool unblocked) { + if (unblocked) { + const bool reloadFromOrigin = false; + const bool contentBlockersEnabled = true; + page->reload(reloadFromOrigin, contentBlockersEnabled); + } + }); + return true; +} +#endif + +#if PLATFORM(GTK) +void WebFrameProxy::collapseSelection() +{ + if (!m_page) + return; + + m_page->process().send(Messages::WebPage::CollapseSelectionInFrame(m_frameID), m_page->pageID()); +} +#endif + } // namespace WebKit |