1/* 2 * Copyright (C) 2012 Igalia S.L. 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21#ifndef WebSoupRequestManagerProxy_h 22#define WebSoupRequestManagerProxy_h 23 24#include "APIObject.h" 25#include "MessageReceiver.h" 26#include "WebContextSupplement.h" 27#include "WebSoupRequestManagerClient.h" 28#include <wtf/PassRefPtr.h> 29#include <wtf/RefPtr.h> 30#include <wtf/text/WTFString.h> 31 32namespace API { 33class Data; 34} 35 36namespace WebKit { 37 38class WebContext; 39 40class WebSoupRequestManagerProxy : public API::ObjectImpl<API::Object::Type::SoupRequestManager>, public WebContextSupplement, private IPC::MessageReceiver { 41public: 42 static const char* supplementName(); 43 44 static PassRefPtr<WebSoupRequestManagerProxy> create(WebContext*); 45 virtual ~WebSoupRequestManagerProxy(); 46 47 void initializeClient(const WKSoupRequestManagerClientBase*); 48 49 void registerURIScheme(const String& scheme); 50 void didHandleURIRequest(const API::Data*, uint64_t contentLength, const String& mimeType, uint64_t requestID); 51 void didReceiveURIRequestData(const API::Data*, uint64_t requestID); 52 void didReceiveURIRequest(const String& uriString, WebPageProxy*, uint64_t requestID); 53 void didFailURIRequest(const WebCore::ResourceError&, uint64_t requestID); 54 55 const Vector<String>& registeredURISchemes() const { return m_registeredURISchemes; } 56 57 using API::Object::ref; 58 using API::Object::deref; 59 60private: 61 WebSoupRequestManagerProxy(WebContext*); 62 63 // WebContextSupplement 64 virtual void contextDestroyed() override; 65 virtual void processDidClose(WebProcessProxy*) override; 66 virtual void refWebContextSupplement() override; 67 virtual void derefWebContextSupplement() override; 68 69 // IPC::MessageReceiver 70 virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override; 71 72 void didFailToLoadURIRequest(uint64_t requestID); 73 74 WebSoupRequestManagerClient m_client; 75 bool m_loadFailed; 76 Vector<String> m_registeredURISchemes; 77}; 78 79} // namespace WebKit 80 81#endif // WebSoupRequestManagerProxy_h 82