Source/WebKit2/ChangeLog

 12012-07-13 Christophe Dumez <christophe.dumez@intel.com>
 2
 3 [EFL][WK2] Add request manager client
 4 https://bugs.webkit.org/show_bug.cgi?id=91193
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add a URL request manager client and attach it
 9 to the Ewk_Context.
 10
 11 The client application can now register a URL scheme
 12 via the Ewk_Context API and provide a callback handler
 13 that will get called whenever a URL request with this
 14 scheme is made.
 15
 16 A new Ewk_Url_Scheme_Request type is introduced to
 17 provide information about the request to the client
 18 and to allow the client to finish it by setting its
 19 contents.
 20
 21 * PlatformEfl.cmake:
 22 * UIProcess/API/efl/EWebKit2.h:
 23 * UIProcess/API/efl/ewk_context.cpp:
 24 (_Ewk_Url_Scheme_Handler::_Ewk_Url_Scheme_Handler):
 25 (_Ewk_Url_Scheme_Handler):
 26 (_Ewk_Context):
 27 (_Ewk_Context::_Ewk_Context):
 28 (ewk_context_request_manager_get):
 29 (ewk_context_url_scheme_request_received):
 30 (createDefaultEwkContext):
 31 (ewk_context_uri_scheme_register):
 32 * UIProcess/API/efl/ewk_context.h:
 33 * UIProcess/API/efl/ewk_context_private.h:
 34 * UIProcess/API/efl/ewk_context_request_manager_client.cpp: Added.
 35 (toEwkContext):
 36 (didReceiveURIRequest):
 37 (ewk_context_request_manager_client_attach):
 38 * UIProcess/API/efl/ewk_context_request_manager_client_private.h: Added.
 39 * UIProcess/API/efl/ewk_url_scheme_request.cpp: Added.
 40 (_Ewk_Url_Scheme_Request):
 41 (_Ewk_Url_Scheme_Request::_Ewk_Url_Scheme_Request):
 42 (ewk_url_scheme_request_ref):
 43 (ewk_url_scheme_request_unref):
 44 (ewk_url_scheme_request_scheme_get):
 45 (ewk_url_scheme_request_url_get):
 46 (ewk_url_scheme_request_path_get):
 47 (ewk_url_scheme_request_id_get):
 48 (ewk_url_scheme_request_finish):
 49 (ewk_url_scheme_request_new):
 50 * UIProcess/API/efl/ewk_url_scheme_request.h: Added.
 51 * UIProcess/API/efl/ewk_url_scheme_request_private.h: Added.
 52
1532012-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
254
355 [GTK] WebKit2 crash when going back/forward

Source/WebKit2/PlatformEfl.cmake

@@LIST(APPEND WebKit2_SOURCES
3737 UIProcess/API/efl/BatteryProvider.cpp
3838 UIProcess/API/efl/PageClientImpl.cpp
3939 UIProcess/API/efl/ewk_context.cpp
 40 UIProcess/API/efl/ewk_context_request_manager_client.cpp
4041 UIProcess/API/efl/ewk_intent.cpp
4142 UIProcess/API/efl/ewk_intent_service.cpp
4243 UIProcess/API/efl/ewk_navigation_policy_decision.cpp
4344 UIProcess/API/efl/ewk_url_request.cpp
4445 UIProcess/API/efl/ewk_url_response.cpp
 46 UIProcess/API/efl/ewk_url_scheme_request.cpp
4547 UIProcess/API/efl/ewk_view.cpp
4648 UIProcess/API/efl/ewk_view_loader_client.cpp
4749 UIProcess/API/efl/ewk_view_policy_client.cpp

Source/WebKit2/UIProcess/API/efl/EWebKit2.h

3333#include "ewk_navigation_policy_decision.h"
3434#include "ewk_url_request.h"
3535#include "ewk_url_response.h"
 36#include "ewk_url_scheme_request.h"
3637#include "ewk_view.h"
3738#include "ewk_web_error.h"
3839#include "ewk_web_resource.h"

Source/WebKit2/UIProcess/API/efl/ewk_context.cpp

2323
2424#include "BatteryProvider.h"
2525#include "WKAPICast.h"
 26#include "WKContextSoup.h"
2627#include "WKRetainPtr.h"
 28#include "WKString.h"
2729#include "ewk_context_private.h"
 30#include "ewk_context_request_manager_client_private.h"
 31#include "ewk_url_scheme_request_private.h"
 32#include <wtf/HashMap.h>
 33#include <wtf/text/WTFString.h>
2834
2935using namespace WebKit;
3036
 37struct _Ewk_Url_Scheme_Handler {
 38 _Ewk_Url_Scheme_Handler()
 39 : callback(0)
 40 , userData(0)
 41 {
 42 }
 43 _Ewk_Url_Scheme_Handler(Ewk_Url_Scheme_Request_Cb callback, void* userData)
 44 : callback(callback)
 45 , userData(userData)
 46 {
 47 }
 48
 49 Ewk_Url_Scheme_Request_Cb callback;
 50 void* userData;
 51};
 52
 53typedef HashMap<String, _Ewk_Url_Scheme_Handler> URLSchemeHandlerMap;
 54
3155struct _Ewk_Context {
3256 WKRetainPtr<WKContextRef> context;
 57
 58 URLSchemeHandlerMap urlSchemeHandlers;
 59
3360#if ENABLE(BATTERY_STATUS)
3461 RefPtr<BatteryProvider> batteryProvider;
3562#endif
 63 WKRetainPtr<WKSoupRequestManagerRef> requestManager;
3664
3765 _Ewk_Context(WKContextRef contextRef)
3866 : context(contextRef)
39  { }
 67 , requestManager(WKContextGetSoupRequestManager(contextRef))
 68 {
 69#if ENABLE(BATTERY_STATUS)
 70 WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(contextRef);
 71 batteryProvider = BatteryProvider::create(wkBatteryManager);
 72#endif
 73
 74 ewk_context_request_manager_client_attach(this);
 75 }
4076};
4177
4278WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext)

@@WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext)
4480 return ewkContext->context.get();
4581}
4682
47 static inline Ewk_Context* createDefaultEwkContext()
 83/**
 84 * @internal
 85 * Retrieve the request manager for @a ewkContext.
 86 *
 87 * @param ewkContext a #Ewk_Context object.
 88 */
 89WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context* ewkContext)
4890{
49  WKContextRef wkContext = WKContextGetSharedProcessContext();
50  Ewk_Context* ewkContext = new Ewk_Context(wkContext);
 91 return ewkContext->requestManager.get();
 92}
5193
52 #if ENABLE(BATTERY_STATUS)
53  WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(wkContext);
54  ewkContext->batteryProvider = BatteryProvider::create(wkBatteryManager);
55 #endif
 94/**
 95 * @internal
 96 * A new URL request was received.
 97 *
 98 * @param ewkContext a #Ewk_Context object.
 99 * @param schemeRequest a #Ewk_Url_Scheme_Request object.
 100 */
 101void ewk_context_url_scheme_request_received(Ewk_Context* ewkContext, Ewk_Url_Scheme_Request* schemeRequest)
 102{
 103 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
 104 EINA_SAFETY_ON_NULL_RETURN(schemeRequest);
56105
57  return ewkContext;
 106 _Ewk_Url_Scheme_Handler handler = ewkContext->urlSchemeHandlers.get(ewk_url_scheme_request_scheme_get(schemeRequest));
 107 if (!handler.callback)
 108 return;
 109
 110 handler.callback(schemeRequest, handler.userData);
 111}
 112
 113static inline Ewk_Context* createDefaultEwkContext()
 114{
 115 WKContextRef wkContext = WKContextGetSharedProcessContext();
 116 return new Ewk_Context(wkContext);
58117}
59118
60119Ewk_Context* ewk_context_default_get()

@@Ewk_Context* ewk_context_default_get()
63122
64123 return defaultContext;
65124}
 125
 126Eina_Bool ewk_context_uri_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData)
 127{
 128 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
 129 EINA_SAFETY_ON_NULL_RETURN_VAL(scheme, false);
 130 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
 131
 132 ewkContext->urlSchemeHandlers.set(String::fromUTF8(scheme), _Ewk_Url_Scheme_Handler(callback, userData));
 133 WKRetainPtr<WKStringRef> wkScheme(AdoptWK, WKStringCreateWithUTF8CString(scheme));
 134 WKSoupRequestManagerRegisterURIScheme(ewkContext->requestManager.get(), wkScheme.get());
 135
 136 return true;
 137}

Source/WebKit2/UIProcess/API/efl/ewk_context.h

2929#ifndef ewk_context_h
3030#define ewk_context_h
3131
 32#include "ewk_url_scheme_request.h"
3233#include <Evas.h>
3334
3435#ifdef __cplusplus

@@extern "C" {
3940typedef struct _Ewk_Context Ewk_Context;
4041
4142/**
 43 * @typedef Ewk_Url_Scheme_Request_Cb Ewk_Url_Scheme_Request_Cb
 44 * @brief Callback type for use with ewk_context_uri_scheme_register().
 45 */
 46typedef void (*Ewk_Url_Scheme_Request_Cb) (Ewk_Url_Scheme_Request *request, void *user_data);
 47
 48/**
4249 * Gets default Ewk_Context instance.
4350 *
4451 * @return Ewk_Context object.
4552 */
4653EAPI Ewk_Context *ewk_context_default_get();
4754
 55/**
 56 * Register @a scheme in @a context.
 57 *
 58 * When an URL request with @a scheme is made in the #Ewk_Context, the callback
 59 * function provided will be called with a #Ewk_Url_Scheme_Request.
 60 *
 61 * It is possible to handle URL scheme requests asynchronously, by calling ewk_url_scheme_ref() on the
 62 * #Ewk_Url_Scheme_Request and calling ewk_url_scheme_request_finish() later when the data of
 63 * the request is available.
 64 *
 65 * @param context a #Ewk_Context object.
 66 * @param scheme the network scheme to register
 67 * @param callback the function to be called when an URL request with @a scheme is made.
 68 * @param user_data data to pass to callback function
 69 *
 70 * @code
 71 * static void about_uri_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data)
 72 * {
 73 * const char *path;
 74 * char *contents_data = NULL;
 75 * unsigned int contents_length = 0;
 76 *
 77 * path = ewk_url_scheme_request_path_get(request);
 78 * if (!strcmp(path, "plugins")) {
 79 * // Initialize contents_data with the contents of plugins about page, and set its length to contents_length
 80 * } else if (!strcmp(path, "memory")) {
 81 * // Initialize contents_data with the contents of memory about page, and set its length to contents_length
 82 * } else if (!strcmp(path, "applications")) {
 83 * // Initialize contents_data with the contents of application about page, and set its length to contents_length
 84 * } else {
 85 * Eina_Strbuf *buf = eina_strbuf_new();
 86 * eina_strbuf_append_printf(buf, "&lt;html&gt;&lt;body&gt;&lt;p&gt;Invalid about:%s page&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;", path);
 87 * contents_data = eina_strbuf_string_steal(buf);
 88 * contents_length = strlen(contents);
 89 * eina_strbuf_free(buf);
 90 * }
 91 * ewk_url_scheme_request_finish(request, contents_data, contents_length, "text/html");
 92 * free(contents_data);
 93 * }
 94 * @endcode
 95 */
 96EAPI Eina_Bool ewk_context_uri_scheme_register(Ewk_Context *context, const char *scheme, Ewk_Url_Scheme_Request_Cb callback, void *user_data);
 97
4898#ifdef __cplusplus
4999}
50100#endif

Source/WebKit2/UIProcess/API/efl/ewk_context_private.h

2323#include <WebKit2/WKBase.h>
2424
2525typedef struct _Ewk_Context Ewk_Context;
 26typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request;
2627
2728WKContextRef ewk_context_WKContext_get(const Ewk_Context*);
 29WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context*);
 30void ewk_context_url_scheme_request_received(Ewk_Context*, Ewk_Url_Scheme_Request*);
2831
2932#endif // ewk_context_private_h

Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp

 1/*
 2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27
 28#include "WKBase.h"
 29#include "WKSoupRequestManager.h"
 30#include "ewk_context_private.h"
 31#include "ewk_context_request_manager_client_private.h"
 32#include "ewk_url_scheme_request.h"
 33#include "ewk_url_scheme_request_private.h"
 34
 35static inline Ewk_Context* toEwkContext(const void* clientInfo)
 36{
 37 return static_cast<Ewk_Context*>(const_cast<void*>(clientInfo));
 38}
 39
 40static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, uint64_t requestID, const void* clientInfo)
 41{
 42 Ewk_Url_Scheme_Request* schemeRequest = ewk_url_scheme_request_new(soupRequestManagerRef, urlRef, requestID);
 43 ewk_context_url_scheme_request_received(toEwkContext(clientInfo), schemeRequest);
 44 ewk_url_scheme_request_unref(schemeRequest);
 45}
 46
 47void ewk_context_request_manager_client_attach(Ewk_Context* context)
 48{
 49 WKSoupRequestManagerClient wkRequestManagerClient;
 50 memset(&wkRequestManagerClient, 0, sizeof(WKSoupRequestManagerClient));
 51
 52 wkRequestManagerClient.version = kWKSoupRequestManagerClientCurrentVersion;
 53 wkRequestManagerClient.clientInfo = context;
 54 wkRequestManagerClient.didReceiveURIRequest = didReceiveURIRequest;
 55
 56 WKSoupRequestManagerSetClient(ewk_context_request_manager_get(context), &wkRequestManagerClient);
 57}

Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client_private.h

 1/*
 2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef ewk_context_request_manager_client_private_h
 27#define ewk_context_request_manager_client_private_h
 28
 29typedef struct _Ewk_Context Ewk_Context;
 30
 31void ewk_context_request_manager_client_attach(Ewk_Context* context);
 32
 33#endif // ewk_context_request_manager_client_private_h

Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp

 1/*
 2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "ewk_url_scheme_request.h"
 28
 29#include "WKData.h"
 30#include "WKRetainPtr.h"
 31#include "WKSoupRequestManager.h"
 32#include "WKString.h"
 33#include <wtf/text/CString.h>
 34
 35using namespace WebKit;
 36
 37/**
 38 * \struct _Ewk_Url_Scheme_Request
 39 * @brief Contains the URL scheme request data.
 40 */
 41struct _Ewk_Url_Scheme_Request {
 42 unsigned int __ref; /**< the reference count of the object */
 43 WKRetainPtr<WKSoupRequestManagerRef> wkRequestManager;
 44 const char* url;
 45 uint64_t requestID;
 46 const char* scheme;
 47 const char* path;
 48
 49 _Ewk_Url_Scheme_Request(WKSoupRequestManagerRef manager, const char* _url, uint64_t _requestID)
 50 : __ref(1)
 51 , wkRequestManager(manager)
 52 , url(eina_stringshare_add(_url))
 53 , requestID(_requestID)
 54 {
 55 SoupURI* soupURI = soup_uri_new(_url);
 56 scheme = eina_stringshare_add(soupURI->scheme);
 57 path = eina_stringshare_add(soupURI->path);
 58 soup_uri_free(soupURI);
 59 }
 60};
 61
 62void ewk_url_scheme_request_ref(Ewk_Url_Scheme_Request* request)
 63{
 64 EINA_SAFETY_ON_NULL_RETURN(request);
 65 ++request->__ref;
 66}
 67
 68void ewk_url_scheme_request_unref(Ewk_Url_Scheme_Request* request)
 69{
 70 EINA_SAFETY_ON_NULL_RETURN(request);
 71
 72 if (--request->__ref)
 73 return;
 74
 75 eina_stringshare_del(request->url);
 76 eina_stringshare_del(request->scheme);
 77 eina_stringshare_del(request->path);
 78 delete request;
 79}
 80
 81const char* ewk_url_scheme_request_scheme_get(const Ewk_Url_Scheme_Request* request)
 82{
 83 EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
 84
 85 return request->scheme;
 86}
 87
 88const char* ewk_url_scheme_request_url_get(const Ewk_Url_Scheme_Request* request)
 89{
 90 EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
 91
 92 return request->url;
 93}
 94
 95const char* ewk_url_scheme_request_path_get(const Ewk_Url_Scheme_Request* request)
 96{
 97 EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
 98
 99 return request->path;
 100}
 101
 102/**
 103 * @internal
 104 * Returns the #Ewk_Url_Scheme_Request identifier.
 105 */
 106uint64_t ewk_url_scheme_request_id_get(const Ewk_Url_Scheme_Request* request)
 107{
 108 EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
 109
 110 return request->requestID;
 111}
 112
 113Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request* request, void* contentData, unsigned int contentLength, const char* mimeType)
 114{
 115 EINA_SAFETY_ON_NULL_RETURN_VAL(request, false);
 116
 117 WKRetainPtr<WKDataRef> wkData(AdoptWK, WKDataCreate(contentLength ? reinterpret_cast<const unsigned char*>(contentData) : 0, contentLength));
 118 WKRetainPtr<WKStringRef> wkMimeType = mimeType ? adoptWK(WKStringCreateWithUTF8CString(mimeType)) : 0;
 119
 120 // In case of empty reply an empty WKDataRef is sent to the WebProcess.
 121 WKSoupRequestManagerDidHandleURIRequest(request->wkRequestManager.get(), wkData.get(), contentLength, wkMimeType.get(), request->requestID);
 122
 123 return true;
 124}
 125
 126/**
 127 * @internal
 128 * Constructs a Ewk_Url_Scheme_Request.
 129 */
 130Ewk_Url_Scheme_Request* ewk_url_scheme_request_new(WKSoupRequestManagerRef requestManager, WKURLRef url, uint64_t requestID)
 131{
 132 EINA_SAFETY_ON_NULL_RETURN_VAL(requestManager, 0);
 133 EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
 134
 135 return new Ewk_Url_Scheme_Request(requestManager, toImpl(url)->string().utf8().data(), requestID);
 136}

Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h

 1/*
 2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26/**
 27 * @file ewk_url_scheme_request.h
 28 * @brief Describes the Ewk URL scheme request API.
 29 */
 30
 31#ifndef ewk_url_scheme_request_h
 32#define ewk_url_scheme_request_h
 33
 34#include <Eina.h>
 35
 36#ifdef __cplusplus
 37extern "C" {
 38#endif
 39
 40/** Creates a type name for _Ewk_Url_Scheme_Request */
 41typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request;
 42
 43/**
 44 * Increases the reference count of the given object.
 45 *
 46 * @param request the URL scheme request object to increase the reference count
 47 */
 48EAPI void ewk_url_scheme_request_ref(Ewk_Url_Scheme_Request *request);
 49
 50/**
 51 * Decreases the reference count of the given object, possibly freeing it.
 52 *
 53 * When the reference count it's reached 0, the URL scheme request is freed.
 54 *
 55 * @param request the URL request object to decrease the reference count
 56 */
 57EAPI void ewk_url_scheme_request_unref(Ewk_Url_Scheme_Request *request);
 58
 59/**
 60 * Query the URL scheme for this request.
 61 *
 62 * @param request request object to query.
 63 *
 64 * @return the URL scheme pointer, that may be @c NULL. This pointer is
 65 * guaranteed to be eina_stringshare, so whenever possible
 66 * save yourself some cpu cycles and use
 67 * eina_stringshare_ref() instead of eina_stringshare_add() or
 68 * strdup().
 69 */
 70EAPI const char *ewk_url_scheme_request_scheme_get(const Ewk_Url_Scheme_Request *request);
 71
 72/**
 73 * Query the URL for this request.
 74 *
 75 * @param request request object to query.
 76 *
 77 * @return the URL pointer, that may be @c NULL. This pointer is
 78 * guaranteed to be eina_stringshare, so whenever possible
 79 * save yourself some cpu cycles and use
 80 * eina_stringshare_ref() instead of eina_stringshare_add() or
 81 * strdup().
 82 */
 83EAPI const char *ewk_url_scheme_request_url_get(const Ewk_Url_Scheme_Request *request);
 84
 85/**
 86 * Query the path part of the URL for this request.
 87 *
 88 * @param request request object to query.
 89 *
 90 * @return the path pointer, that may be @c NULL. This pointer is
 91 * guaranteed to be eina_stringshare, so whenever possible
 92 * save yourself some cpu cycles and use
 93 * eina_stringshare_ref() instead of eina_stringshare_add() or
 94 * strdup().
 95 */
 96EAPI const char *ewk_url_scheme_request_path_get(const Ewk_Url_Scheme_Request *request);
 97
 98/**
 99 * Finish a Ewk_Url_Scheme_Request by setting the content of the request and its mime type.
 100 *
 101 * @param request a Ewk_Url_Scheme_Request.
 102 * @param content_data the data content of the request (may be %c NULL if the content is empty).
 103 * @param content_length the length of the @a content_data.
 104 * @param mime_type the content type of the stream or %c NULL if not known
 105 */
 106EAPI Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request *request, void *content_data, unsigned int content_length, const char *mime_type);
 107
 108#ifdef __cplusplus
 109}
 110#endif
 111
 112#endif // ewk_url_scheme_request_h

Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h

 1/*
 2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef ewk_url_scheme_request_private_h
 27#define ewk_url_scheme_request_private_h
 28
 29#include "WKBase.h"
 30
 31typedef struct _Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request;
 32typedef struct _Ewk_Context Ewk_Context;
 33
 34Ewk_Url_Scheme_Request* ewk_url_scheme_request_new(WKSoupRequestManagerRef, WKURLRef, uint64_t requestID);
 35
 36uint64_t ewk_url_scheme_request_id_get(const Ewk_Url_Scheme_Request* request);
 37
 38#endif // ewk_url_scheme_request_private_h