Diff
Modified: trunk/Source/WebKit2/ChangeLog (123340 => 123341)
--- trunk/Source/WebKit2/ChangeLog 2012-07-23 15:39:50 UTC (rev 123340)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-23 15:49:04 UTC (rev 123341)
@@ -1,3 +1,56 @@
+2012-07-23 Christophe Dumez <[email protected]>
+
+ [EFL][WK2] Add request manager client
+ https://bugs.webkit.org/show_bug.cgi?id=91193
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add a URL request manager client and attach it
+ to the Ewk_Context.
+
+ The client application can now register a URL scheme
+ via the Ewk_Context API and provide a callback handler
+ that will get called whenever a URL request with this
+ scheme is made.
+
+ A new Ewk_Url_Scheme_Request type is introduced to
+ provide information about the request to the client
+ and to allow the client to finish it by setting its
+ contents.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/EWebKit2.h:
+ * UIProcess/API/efl/ewk_context.cpp:
+ (_Ewk_Url_Scheme_Handler):
+ (_Ewk_Url_Scheme_Handler::_Ewk_Url_Scheme_Handler):
+ (_Ewk_Context):
+ (_Ewk_Context::_Ewk_Context):
+ (ewk_context_request_manager_get):
+ (ewk_context_url_scheme_request_received):
+ (createDefaultEwkContext):
+ (ewk_context_uri_scheme_register):
+ * UIProcess/API/efl/ewk_context.h:
+ * UIProcess/API/efl/ewk_context_private.h:
+ * UIProcess/API/efl/ewk_context_request_manager_client.cpp: Added.
+ (toEwkContext):
+ (didReceiveURIRequest):
+ (ewk_context_request_manager_client_attach):
+ * UIProcess/API/efl/ewk_context_request_manager_client_private.h: Added.
+ * UIProcess/API/efl/ewk_url_scheme_request.cpp: Added.
+ (_Ewk_Url_Scheme_Request):
+ (_Ewk_Url_Scheme_Request::_Ewk_Url_Scheme_Request):
+ (_Ewk_Url_Scheme_Request::~_Ewk_Url_Scheme_Request):
+ (ewk_url_scheme_request_ref):
+ (ewk_url_scheme_request_unref):
+ (ewk_url_scheme_request_scheme_get):
+ (ewk_url_scheme_request_url_get):
+ (ewk_url_scheme_request_path_get):
+ (ewk_url_scheme_request_id_get):
+ (ewk_url_scheme_request_finish):
+ (ewk_url_scheme_request_new):
+ * UIProcess/API/efl/ewk_url_scheme_request.h: Added.
+ * UIProcess/API/efl/ewk_url_scheme_request_private.h: Added.
+
2012-07-23 KwangYong Choi <[email protected]>
[EFL][WK2] ProcessExecutablePath is required
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (123340 => 123341)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-23 15:39:50 UTC (rev 123340)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-23 15:49:04 UTC (rev 123341)
@@ -38,12 +38,14 @@
UIProcess/API/efl/BatteryProvider.cpp
UIProcess/API/efl/PageClientImpl.cpp
UIProcess/API/efl/ewk_context.cpp
+ UIProcess/API/efl/ewk_context_request_manager_client.cpp
UIProcess/API/efl/ewk_cookie_manager.cpp
UIProcess/API/efl/ewk_intent.cpp
UIProcess/API/efl/ewk_intent_service.cpp
UIProcess/API/efl/ewk_navigation_policy_decision.cpp
UIProcess/API/efl/ewk_url_request.cpp
UIProcess/API/efl/ewk_url_response.cpp
+ UIProcess/API/efl/ewk_url_scheme_request.cpp
UIProcess/API/efl/ewk_view.cpp
UIProcess/API/efl/ewk_view_loader_client.cpp
UIProcess/API/efl/ewk_view_policy_client.cpp
@@ -180,6 +182,7 @@
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_request.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_scheme_request.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_view.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_web_error.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_web_resource.h"
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h (123340 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-07-23 15:39:50 UTC (rev 123340)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-07-23 15:49:04 UTC (rev 123341)
@@ -34,6 +34,7 @@
#include "ewk_navigation_policy_decision.h"
#include "ewk_url_request.h"
#include "ewk_url_response.h"
+#include "ewk_url_scheme_request.h"
#include "ewk_view.h"
#include "ewk_web_error.h"
#include "ewk_web_resource.h"
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp (123340 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp 2012-07-23 15:39:50 UTC (rev 123340)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp 2012-07-23 15:49:04 UTC (rev 123341)
@@ -23,12 +23,34 @@
#include "BatteryProvider.h"
#include "WKAPICast.h"
+#include "WKContextSoup.h"
#include "WKRetainPtr.h"
+#include "WKString.h"
#include "ewk_context_private.h"
+#include "ewk_context_request_manager_client_private.h"
#include "ewk_cookie_manager_private.h"
+#include <wtf/HashMap.h>
+#include <wtf/text/WTFString.h>
using namespace WebKit;
+struct _Ewk_Url_Scheme_Handler {
+ Ewk_Url_Scheme_Request_Cb callback;
+ void* userData;
+
+ _Ewk_Url_Scheme_Handler()
+ : callback(0)
+ , userData(0)
+ { }
+
+ _Ewk_Url_Scheme_Handler(Ewk_Url_Scheme_Request_Cb callback, void* userData)
+ : callback(callback)
+ , userData(userData)
+ { }
+};
+
+typedef HashMap<String, _Ewk_Url_Scheme_Handler> URLSchemeHandlerMap;
+
struct _Ewk_Context {
WKRetainPtr<WKContextRef> context;
@@ -37,11 +59,22 @@
RefPtr<BatteryProvider> batteryProvider;
#endif
+ WKRetainPtr<WKSoupRequestManagerRef> requestManager;
+ URLSchemeHandlerMap urlSchemeHandlers;
+
_Ewk_Context(WKContextRef contextRef)
: context(contextRef)
, cookieManager(0)
- { }
+ , requestManager(WKContextGetSoupRequestManager(contextRef))
+ {
+#if ENABLE(BATTERY_STATUS)
+ WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(contextRef);
+ batteryProvider = BatteryProvider::create(wkBatteryManager);
+#endif
+ ewk_context_request_manager_client_attach(this);
+ }
+
~_Ewk_Context()
{
if (cookieManager)
@@ -64,22 +97,57 @@
return ewkContext->context.get();
}
-static inline Ewk_Context* createDefaultEwkContext()
+/**
+ * @internal
+ * Retrieve the request manager for @a ewkContext.
+ *
+ * @param ewkContext a #Ewk_Context object.
+ */
+WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context* ewkContext)
{
- WKContextRef wkContext = WKContextGetSharedProcessContext();
- Ewk_Context* ewkContext = new Ewk_Context(wkContext);
+ return ewkContext->requestManager.get();
+}
-#if ENABLE(BATTERY_STATUS)
- WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(wkContext);
- ewkContext->batteryProvider = BatteryProvider::create(wkBatteryManager);
-#endif
+/**
+ * @internal
+ * A new URL request was received.
+ *
+ * @param ewkContext a #Ewk_Context object.
+ * @param schemeRequest a #Ewk_Url_Scheme_Request object.
+ */
+void ewk_context_url_scheme_request_received(Ewk_Context* ewkContext, Ewk_Url_Scheme_Request* schemeRequest)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ewkContext);
+ EINA_SAFETY_ON_NULL_RETURN(schemeRequest);
- return ewkContext;
+ _Ewk_Url_Scheme_Handler handler = ewkContext->urlSchemeHandlers.get(ewk_url_scheme_request_scheme_get(schemeRequest));
+ if (!handler.callback)
+ return;
+
+ handler.callback(schemeRequest, handler.userData);
}
+static inline Ewk_Context* createDefaultEwkContext()
+{
+ return new Ewk_Context(WKContextGetSharedProcessContext());
+}
+
Ewk_Context* ewk_context_default_get()
{
static Ewk_Context* defaultContext = createDefaultEwkContext();
return defaultContext;
}
+
+Eina_Bool ewk_context_uri_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(scheme, false);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
+
+ ewkContext->urlSchemeHandlers.set(String::fromUTF8(scheme), _Ewk_Url_Scheme_Handler(callback, userData));
+ WKRetainPtr<WKStringRef> wkScheme(AdoptWK, WKStringCreateWithUTF8CString(scheme));
+ WKSoupRequestManagerRegisterURIScheme(ewkContext->requestManager.get(), wkScheme.get());
+
+ return true;
+}
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.h (123340 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.h 2012-07-23 15:39:50 UTC (rev 123340)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.h 2012-07-23 15:49:04 UTC (rev 123341)
@@ -30,6 +30,7 @@
#define ewk_context_h
#include "ewk_cookie_manager.h"
+#include "ewk_url_scheme_request.h"
#include <Evas.h>
#ifdef __cplusplus
@@ -40,6 +41,12 @@
typedef struct _Ewk_Context Ewk_Context;
/**
+ * @typedef Ewk_Url_Scheme_Request_Cb Ewk_Url_Scheme_Request_Cb
+ * @brief Callback type for use with ewk_context_uri_scheme_register().
+ */
+typedef void (*Ewk_Url_Scheme_Request_Cb) (Ewk_Url_Scheme_Request *request, void *user_data);
+
+/**
* Gets default Ewk_Context instance.
*
* @return Ewk_Context object.
@@ -55,6 +62,49 @@
*/
EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *context);
+/**
+ * Register @a scheme in @a context.
+ *
+ * When an URL request with @a scheme is made in the #Ewk_Context, the callback
+ * function provided will be called with a #Ewk_Url_Scheme_Request.
+ *
+ * It is possible to handle URL scheme requests asynchronously, by calling ewk_url_scheme_ref() on the
+ * #Ewk_Url_Scheme_Request and calling ewk_url_scheme_request_finish() later when the data of
+ * the request is available.
+ *
+ * @param context a #Ewk_Context object.
+ * @param scheme the network scheme to register
+ * @param callback the function to be called when an URL request with @a scheme is made.
+ * @param user_data data to pass to callback function
+ *
+ * @code
+ * static void about_uri_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data)
+ * {
+ * const char *path;
+ * char *contents_data = NULL;
+ * unsigned int contents_length = 0;
+ *
+ * path = ewk_url_scheme_request_path_get(request);
+ * if (!strcmp(path, "plugins")) {
+ * // Initialize contents_data with the contents of plugins about page, and set its length to contents_length
+ * } else if (!strcmp(path, "memory")) {
+ * // Initialize contents_data with the contents of memory about page, and set its length to contents_length
+ * } else if (!strcmp(path, "applications")) {
+ * // Initialize contents_data with the contents of application about page, and set its length to contents_length
+ * } else {
+ * Eina_Strbuf *buf = eina_strbuf_new();
+ * eina_strbuf_append_printf(buf, "<html><body><p>Invalid about:%s page</p></body></html>", path);
+ * contents_data = eina_strbuf_string_steal(buf);
+ * contents_length = strlen(contents);
+ * eina_strbuf_free(buf);
+ * }
+ * ewk_url_scheme_request_finish(request, contents_data, contents_length, "text/html");
+ * free(contents_data);
+ * }
+ * @endcode
+ */
+EAPI Eina_Bool ewk_context_uri_scheme_register(Ewk_Context *context, const char *scheme, Ewk_Url_Scheme_Request_Cb callback, void *user_data);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h (123340 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h 2012-07-23 15:39:50 UTC (rev 123340)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h 2012-07-23 15:49:04 UTC (rev 123341)
@@ -23,7 +23,10 @@
#include <WebKit2/WKBase.h>
typedef struct _Ewk_Context Ewk_Context;
+typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request;
WKContextRef ewk_context_WKContext_get(const Ewk_Context*);
+WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context*);
+void ewk_context_url_scheme_request_received(Ewk_Context*, Ewk_Url_Scheme_Request*);
#endif // ewk_context_private_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp (0 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp 2012-07-23 15:49:04 UTC (rev 123341)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "WKBase.h"
+#include "WKSoupRequestManager.h"
+#include "ewk_context_private.h"
+#include "ewk_context_request_manager_client_private.h"
+#include "ewk_url_scheme_request.h"
+#include "ewk_url_scheme_request_private.h"
+
+static inline Ewk_Context* toEwkContext(const void* clientInfo)
+{
+ return static_cast<Ewk_Context*>(const_cast<void*>(clientInfo));
+}
+
+static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, uint64_t requestID, const void* clientInfo)
+{
+ Ewk_Url_Scheme_Request* schemeRequest = ewk_url_scheme_request_new(soupRequestManagerRef, urlRef, requestID);
+ ewk_context_url_scheme_request_received(toEwkContext(clientInfo), schemeRequest);
+ ewk_url_scheme_request_unref(schemeRequest);
+}
+
+void ewk_context_request_manager_client_attach(Ewk_Context* context)
+{
+ WKSoupRequestManagerClient wkRequestManagerClient;
+ memset(&wkRequestManagerClient, 0, sizeof(WKSoupRequestManagerClient));
+
+ wkRequestManagerClient.version = kWKSoupRequestManagerClientCurrentVersion;
+ wkRequestManagerClient.clientInfo = context;
+ wkRequestManagerClient.didReceiveURIRequest = didReceiveURIRequest;
+
+ WKSoupRequestManagerSetClient(ewk_context_request_manager_get(context), &wkRequestManagerClient);
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client_private.h (0 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client_private.h 2012-07-23 15:49:04 UTC (rev 123341)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_context_request_manager_client_private_h
+#define ewk_context_request_manager_client_private_h
+
+typedef struct _Ewk_Context Ewk_Context;
+
+void ewk_context_request_manager_client_attach(Ewk_Context* context);
+
+#endif // ewk_context_request_manager_client_private_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp (0 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp 2012-07-23 15:49:04 UTC (rev 123341)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ewk_url_scheme_request.h"
+
+#include "WKData.h"
+#include "WKRetainPtr.h"
+#include "WKSoupRequestManager.h"
+#include "WKString.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * \struct _Ewk_Url_Scheme_Request
+ * @brief Contains the URL scheme request data.
+ */
+struct _Ewk_Url_Scheme_Request {
+ unsigned int __ref; /**< the reference count of the object */
+ WKRetainPtr<WKSoupRequestManagerRef> wkRequestManager;
+ const char* url;
+ uint64_t requestID;
+ const char* scheme;
+ const char* path;
+
+ _Ewk_Url_Scheme_Request(WKSoupRequestManagerRef manager, const char* _url, uint64_t _requestID)
+ : __ref(1)
+ , wkRequestManager(manager)
+ , url(eina_stringshare_add(_url))
+ , requestID(_requestID)
+ {
+ SoupURI* soupURI = soup_uri_new(_url);
+ scheme = eina_stringshare_add(soupURI->scheme);
+ path = eina_stringshare_add(soupURI->path);
+ soup_uri_free(soupURI);
+ }
+
+ ~_Ewk_Url_Scheme_Request()
+ {
+ ASSERT(!__ref);
+ eina_stringshare_del(url);
+ eina_stringshare_del(scheme);
+ eina_stringshare_del(path);
+ }
+};
+
+void ewk_url_scheme_request_ref(Ewk_Url_Scheme_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN(request);
+ ++request->__ref;
+}
+
+void ewk_url_scheme_request_unref(Ewk_Url_Scheme_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN(request);
+
+ if (--request->__ref)
+ return;
+
+ delete request;
+}
+
+const char* ewk_url_scheme_request_scheme_get(const Ewk_Url_Scheme_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
+
+ return request->scheme;
+}
+
+const char* ewk_url_scheme_request_url_get(const Ewk_Url_Scheme_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
+
+ return request->url;
+}
+
+const char* ewk_url_scheme_request_path_get(const Ewk_Url_Scheme_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
+
+ return request->path;
+}
+
+/**
+ * @internal
+ * Returns the #Ewk_Url_Scheme_Request identifier.
+ */
+uint64_t ewk_url_scheme_request_id_get(const Ewk_Url_Scheme_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
+
+ return request->requestID;
+}
+
+Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request* request, void* contentData, unsigned int contentLength, const char* mimeType)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(request, false);
+
+ WKRetainPtr<WKDataRef> wkData(AdoptWK, WKDataCreate(contentLength ? reinterpret_cast<const unsigned char*>(contentData) : 0, contentLength));
+ WKRetainPtr<WKStringRef> wkMimeType = mimeType ? adoptWK(WKStringCreateWithUTF8CString(mimeType)) : 0;
+
+ // In case of empty reply an empty WKDataRef is sent to the WebProcess.
+ WKSoupRequestManagerDidHandleURIRequest(request->wkRequestManager.get(), wkData.get(), contentLength, wkMimeType.get(), request->requestID);
+
+ return true;
+}
+
+/**
+ * @internal
+ * Constructs a Ewk_Url_Scheme_Request.
+ */
+Ewk_Url_Scheme_Request* ewk_url_scheme_request_new(WKSoupRequestManagerRef requestManager, WKURLRef url, uint64_t requestID)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(requestManager, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
+
+ return new Ewk_Url_Scheme_Request(requestManager, toImpl(url)->string().utf8().data(), requestID);
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h (0 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h 2012-07-23 15:49:04 UTC (rev 123341)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file ewk_url_scheme_request.h
+ * @brief Describes the Ewk URL scheme request API.
+ */
+
+#ifndef ewk_url_scheme_request_h
+#define ewk_url_scheme_request_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Url_Scheme_Request */
+typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param request the URL scheme request object to increase the reference count
+ */
+EAPI void ewk_url_scheme_request_ref(Ewk_Url_Scheme_Request *request);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the URL scheme request is freed.
+ *
+ * @param request the URL request object to decrease the reference count
+ */
+EAPI void ewk_url_scheme_request_unref(Ewk_Url_Scheme_Request *request);
+
+/**
+ * Query the URL scheme for this request.
+ *
+ * @param request request object to query.
+ *
+ * @return the URL scheme pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_url_scheme_request_scheme_get(const Ewk_Url_Scheme_Request *request);
+
+/**
+ * Query the URL for this request.
+ *
+ * @param request request object to query.
+ *
+ * @return the URL pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_url_scheme_request_url_get(const Ewk_Url_Scheme_Request *request);
+
+/**
+ * Query the path part of the URL for this request.
+ *
+ * @param request request object to query.
+ *
+ * @return the path pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_url_scheme_request_path_get(const Ewk_Url_Scheme_Request *request);
+
+/**
+ * Finish a Ewk_Url_Scheme_Request by setting the content of the request and its mime type.
+ *
+ * @param request a Ewk_Url_Scheme_Request.
+ * @param content_data the data content of the request (may be %c NULL if the content is empty).
+ * @param content_length the length of the @a content_data.
+ * @param mime_type the content type of the stream or %c NULL if not known
+ */
+EAPI Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request *request, void *content_data, unsigned int content_length, const char *mime_type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_url_scheme_request_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h (0 => 123341)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h 2012-07-23 15:49:04 UTC (rev 123341)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_url_scheme_request_private_h
+#define ewk_url_scheme_request_private_h
+
+#include "WKBase.h"
+
+typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request;
+typedef struct _Ewk_Context Ewk_Context;
+
+Ewk_Url_Scheme_Request* ewk_url_scheme_request_new(WKSoupRequestManagerRef, WKURLRef, uint64_t requestID);
+
+uint64_t ewk_url_scheme_request_id_get(const Ewk_Url_Scheme_Request* request);
+
+#endif // ewk_url_scheme_request_private_h