| #pragma once |
| |
| #include "EmptyClients.h" |
| #include "WebView.h" |
| #include <WebCore/DocumentLoader.h> |
| |
| #include <string> |
| |
| namespace WebCore { |
| class DocumentLoader; |
| class ResourceRequest; |
| class ResourceResponse; |
| } |
| |
| class WebFrameLoaderClient : public WebCore::EmptyFrameLoaderClient |
| { |
| public: |
| WebFrameLoaderClient(const WebCore::IntSize& targetSize, WebView* webView); |
| |
| WebCore::Frame* frame() const { return m_coreFrame; } |
| void setFrame(WebCore::Frame* frame) { m_coreFrame = frame; } |
| |
| std::string getTitle() const { return m_title; } |
| std::string getMainDocumentError() const { return m_mainDocumentError; } |
| void clearMainDocumentError() { m_mainDocumentError.clear(); } |
| |
| void transitionToCommittedForNewPage() override; |
| |
| void committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) override; |
| |
| void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) override; |
| void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long errorCode, const WebCore::ResourceError& error) override; |
| void dispatchDidFailLoad(const WebCore::ResourceError& error) override; |
| void dispatchWillSubmitForm(PassRefPtr<WebCore::FormState>, WebCore::FramePolicyFunction) override; |
| void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) override; |
| void dispatchDidFinishLoad() override; |
| |
| bool canHandleRequest(const WebCore::ResourceRequest&) const override { return true; } |
| bool canShowMIMEType(const String&) const override { return true; } |
| bool canShowMIMETypeAsHTML(const String&) const override { return true; } |
| |
| void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>, WebCore::FramePolicyFunction function) override; |
| void dispatchDecidePolicyForResponse(const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, |
| WebCore::FramePolicyFunction function) override; |
| WebCore::ObjectContentType objectContentType(const WebCore::URL& url, const String& mimeType) override; |
| WTF::String userAgent(const WebCore::URL&) override; |
| |
| bool shouldGoToHistoryItem(WebCore::HistoryItem*) const override { return true; } |
| |
| void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) override; |
| |
| private: |
| WebCore::Frame* m_coreFrame; |
| WebView* m_webView; |
| std::string m_responseData; |
| WebCore::IntSize m_targetSize; |
| std::string m_title; |
| std::string m_mainDocumentError; |
| |
| }; |