Diff
Modified: trunk/Source/WebKit2/ChangeLog (121888 => 121889)
--- trunk/Source/WebKit2/ChangeLog 2012-07-05 07:58:58 UTC (rev 121888)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-05 07:59:25 UTC (rev 121889)
@@ -1,3 +1,47 @@
+2012-07-05 Christophe Dumez <[email protected]>
+
+ [WK2][EFL] Ewk_View needs to report new resource requests
+ https://bugs.webkit.org/show_bug.cgi?id=90577
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add new "resource,request,new" signal to Ewk_View to
+ notify clients of the resource requests being initiated.
+ New Ewk_Url_Request and Ewk_Web_Resource types are
+ introduced in order to provide the clients with the
+ needed information regarding the resource requests.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/EWebKit2.h:
+ * UIProcess/API/efl/ewk_url_request.cpp: Added.
+ (_Ewk_Url_Request):
+ (ewk_url_request_ref):
+ (ewk_url_request_unref):
+ (ewk_url_request_url_get):
+ (ewk_request_first_party_get):
+ (ewk_url_request_http_method_get):
+ (ewk_url_request_new):
+ * UIProcess/API/efl/ewk_url_request.h: Added.
+ * UIProcess/API/efl/ewk_url_request_private.h: Added.
+ * UIProcess/API/efl/ewk_view.cpp:
+ (ewk_view_base_add):
+ (ewk_view_resource_load_initiated):
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/ewk_view_private.h:
+ * UIProcess/API/efl/ewk_view_resource_load_client.cpp: Added.
+ (didInitiateLoadForResource):
+ (ewk_view_resource_load_client_attach):
+ * UIProcess/API/efl/ewk_view_resource_load_client_private.h: Added.
+ * UIProcess/API/efl/ewk_web_resource.cpp: Added.
+ (_Ewk_Web_Resource):
+ (ewk_web_resource_ref):
+ (ewk_web_resource_unref):
+ (ewk_web_resource_uri_get):
+ (ewk_web_resource_new):
+ (ewk_web_resource_main_get):
+ * UIProcess/API/efl/ewk_web_resource.h: Added.
+ * UIProcess/API/efl/ewk_web_resource_private.h: Added.
+
2012-07-04 John Mellor <[email protected]>
Text Autosizing: Add compile flag and runtime setting
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (121888 => 121889)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-05 07:58:58 UTC (rev 121888)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-05 07:59:25 UTC (rev 121889)
@@ -34,9 +34,12 @@
UIProcess/API/efl/ewk_context.cpp
UIProcess/API/efl/ewk_intent.cpp
UIProcess/API/efl/ewk_intent_service.cpp
+ UIProcess/API/efl/ewk_url_request.cpp
UIProcess/API/efl/ewk_view.cpp
UIProcess/API/efl/ewk_view_loader_client.cpp
+ UIProcess/API/efl/ewk_view_resource_load_client.cpp
UIProcess/API/efl/ewk_web_error.cpp
+ UIProcess/API/efl/ewk_web_resource.cpp
UIProcess/cairo/BackingStoreCairo.cpp
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h (121888 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-07-05 07:58:58 UTC (rev 121888)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -30,7 +30,9 @@
#include "ewk_context.h"
#include "ewk_intent.h"
#include "ewk_intent_service.h"
+#include "ewk_url_request.h"
#include "ewk_view.h"
#include "ewk_web_error.h"
+#include "ewk_web_resource.h"
#endif // EWebKit2_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp 2012-07-05 07:59:25 UTC (rev 121889)
@@ -0,0 +1,127 @@
+/*
+ * 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_request.h"
+
+#include "WKAPICast.h"
+#include "WKRetainPtr.h"
+#include "WKURL.h"
+#include "WKURLRequest.h"
+#include "WebURLRequest.h"
+#include "WebURLRequestEfl.h"
+#include "ewk_url_request_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * \struct _Ewk_Url_Request
+ * @brief Contains the URL request data.
+ */
+struct _Ewk_Url_Request {
+ unsigned int __ref; /**< the reference count of the object */
+ WKRetainPtr<WKURLRequestRef> wkRequest;
+
+ const char* url;
+ const char* first_party;
+ const char* http_method;
+};
+
+#define EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest_, ...) \
+ if (!(request)) { \
+ EINA_LOG_CRIT("request is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ if (!(request)->wkRequest) { \
+ EINA_LOG_CRIT("request->wkRequest is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ WKURLRequestRef wkRequest_ = (request)->wkRequest.get()
+
+void ewk_url_request_ref(Ewk_Url_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN(request);
+ ++request->__ref;
+}
+
+void ewk_url_request_unref(Ewk_Url_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN(request);
+
+ if (--request->__ref)
+ return;
+
+ eina_stringshare_del(request->url);
+ eina_stringshare_del(request->first_party);
+ eina_stringshare_del(request->http_method);
+ free(request);
+}
+
+const char* ewk_url_request_url_get(const Ewk_Url_Request* request)
+{
+ EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+
+ WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest));
+ Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
+ eina_stringshare_replace(&ewkRequest->url, toImpl(wkUrl.get())->string().utf8().data());
+
+ return request->url;
+}
+
+const char* ewk_request_cookies_first_party_get(const Ewk_Url_Request* request)
+{
+ EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+
+ Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
+ eina_stringshare_replace(&ewkRequest->first_party, toImpl(wkRequest)->resourceRequest().firstPartyForCookies().string().utf8().data());
+
+ return request->first_party;
+}
+
+const char* ewk_url_request_http_method_get(const Ewk_Url_Request* request)
+{
+ EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+
+ Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
+ eina_stringshare_replace(&ewkRequest->http_method, toImpl(wkRequest)->resourceRequest().httpMethod().utf8().data());
+
+ return request->http_method;
+}
+
+/**
+ * @internal
+ * Constructs a Ewk_Url_Request from a WKURLRequest.
+ */
+Ewk_Url_Request* ewk_url_request_new(WKURLRequestRef wkUrlRequest)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(wkUrlRequest, 0);
+
+ Ewk_Url_Request* ewkUrlRequest = static_cast<Ewk_Url_Request*>(calloc(1, sizeof(Ewk_Url_Request)));
+ ewkUrlRequest->__ref = 1;
+ ewkUrlRequest->wkRequest = wkUrlRequest;
+
+ return ewkUrlRequest;
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -0,0 +1,111 @@
+/*
+ * 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_request.h
+ * @brief Describes the Ewk URL request API.
+ */
+
+#ifndef ewk_url_request_h
+#define ewk_url_request_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Url_Request */
+typedef struct _Ewk_Url_Request Ewk_Url_Request;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param request the URL request object to increase the reference count
+ */
+EAPI void ewk_url_request_ref(Ewk_Url_Request *request);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the URL request is freed.
+ *
+ * @param request the URL request object to decrease the reference count
+ */
+EAPI void ewk_url_request_unref(Ewk_Url_Request *request);
+
+/**
+ * Query 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_request_url_get(const Ewk_Url_Request *request);
+
+/**
+ * Query first party for cookies for this request.
+ *
+ * If set, this first party URL is used to distinguish first party cookies
+ * from third party ones. This is usually set to the URL of the main document.
+ *
+ * @param request request object to query.
+ *
+ * @return the first party 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_request_cookies_first_party_get(const Ewk_Url_Request *request);
+
+/**
+ * Query HTTP method for this request.
+ *
+ * HTTP methods are defined by:
+ * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
+ *
+ * Examples of HTTP methods are "GET", "POST".
+ *
+ * @param request request object to query.
+ *
+ * @return the HTTP method 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_request_http_method_get(const Ewk_Url_Request *request);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_url_request_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -0,0 +1,31 @@
+/*
+ * 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_request_private_h
+#define ewk_url_request_private_h
+
+Ewk_Url_Request* ewk_url_request_new(WKURLRequestRef);
+
+#endif // ewk_url_request_private_h
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (121888 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-07-05 07:58:58 UTC (rev 121888)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-07-05 07:59:25 UTC (rev 121889)
@@ -33,6 +33,7 @@
#include "ewk_intent_private.h"
#include "ewk_view_loader_client_private.h"
#include "ewk_view_private.h"
+#include "ewk_view_resource_load_client_private.h"
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -494,6 +495,7 @@
priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
ewk_view_loader_client_attach(toAPI(priv->pageClient->page()), ewkView);
+ ewk_view_resource_load_client_attach(toAPI(priv->pageClient->page()), ewkView);
return ewkView;
}
@@ -547,6 +549,20 @@
return true;
}
+/**
+ * @internal
+ * Load was initiated for a resource in the view.
+ *
+ * Emits signal: "resource,request,new" with pointer to resource request.
+ */
+void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request)
+{
+ Ewk_Web_Resource_Request resourceRequest = {resource, request};
+ // FIXME: We will need to store the resource and its identifier at some point
+ // to get the resource back from the identifier on resource load finish.
+ evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest);
+}
+
const char* ewk_view_title_get(const Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (121888 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-07-05 07:58:58 UTC (rev 121888)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -30,6 +30,7 @@
* - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration.
* - "load,error", const Ewk_Web_Error*: reports main frame load failed.
* - "load,progress", double*: load progress has changed (value from 0.0 to 1.0).
+ * - "resource,request,new", const Ewk_Web_Resource_Request*: a resource request was initiated.
* - "title,changed", const char*: title of the main frame was changed.
*/
@@ -46,7 +47,10 @@
typedef struct _Ewk_View_Smart_Data Ewk_View_Smart_Data;
typedef struct _Ewk_View_Smart_Class Ewk_View_Smart_Class;
typedef struct _Ewk_Intent Ewk_Intent;
+typedef struct _Ewk_Url_Request Ewk_Url_Request;
+typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
+
/// Ewk view's class, to be overridden by sub-classes.
struct _Ewk_View_Smart_Class {
Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */
@@ -133,7 +137,20 @@
} changed;
};
+/// Creates a type name for _Ewk_Web_Resource_Request.
+typedef struct _Ewk_Web_Resource_Request Ewk_Web_Resource_Request;
+
/**
+ * @brief Structure containing details about a resource request.
+ *
+ * Details given about a resource is loaded.
+ */
+struct _Ewk_Web_Resource_Request {
+ Ewk_Web_Resource *resource; /**< resource being requested */
+ Ewk_Url_Request *request; /**< URL request for the resource */
+};
+
+/**
* Creates a new EFL WebKit view object.
*
* @param e canvas object where to create the view object
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h (121888 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h 2012-07-05 07:58:58 UTC (rev 121888)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -30,7 +30,9 @@
class IntSize;
}
+typedef struct _Ewk_Url_Request Ewk_Url_Request;
typedef struct _Ewk_Web_Error Ewk_Web_Error;
+typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
#if ENABLE(WEB_INTENTS)
typedef struct _Ewk_Intent Ewk_Intent;
#endif
@@ -43,6 +45,7 @@
void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error);
void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress);
void ewk_view_title_changed(Evas_Object* ewkView, const char* title);
+void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request);
Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef);
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp 2012-07-05 07:59:25 UTC (rev 121889)
@@ -0,0 +1,66 @@
+/*
+ * 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 "WKAPICast.h"
+#include "WKFrame.h"
+#include "WKPage.h"
+#include "WKRetainPtr.h"
+#include "WKURL.h"
+#include "WKURLRequest.h"
+#include "ewk_url_request.h"
+#include "ewk_url_request_private.h"
+#include "ewk_view_private.h"
+#include "ewk_view_resource_load_client_private.h"
+#include "ewk_web_resource.h"
+#include "ewk_web_resource_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+static void didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, bool pageIsProvisionallyLoading, const void* clientInfo)
+{
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading);
+ WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest));
+
+ Ewk_Web_Resource* resource = ewk_web_resource_new(toImpl(wkUrl.get())->string().utf8().data(), isMainResource);
+ Ewk_Url_Request* request = ewk_url_request_new(wkRequest);
+ ewk_view_resource_load_initiated(ewkView, resourceIdentifier, resource, request);
+ ewk_web_resource_unref(resource);
+ ewk_url_request_unref(request);
+}
+
+void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
+{
+ WKPageResourceLoadClient wkResourceLoadClient;
+ memset(&wkResourceLoadClient, 0, sizeof(WKPageResourceLoadClient));
+ wkResourceLoadClient.version = kWKPageResourceLoadClientCurrentVersion;
+ wkResourceLoadClient.clientInfo = ewkView;
+ wkResourceLoadClient.didInitiateLoadForResource = didInitiateLoadForResource;
+
+ WKPageSetPageResourceLoadClient(pageRef, &wkResourceLoadClient);
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -0,0 +1,34 @@
+/*
+ * 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_view_resource_load_client_private_h
+#define ewk_view_resource_load_client_private_h
+
+#include <Evas.h>
+#include <WebKit2/WKBase.h>
+
+void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView);
+
+#endif // ewk_view_resource_load_client_private_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp 2012-07-05 07:59:25 UTC (rev 121889)
@@ -0,0 +1,83 @@
+/*
+ * 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_web_resource.h"
+
+#include "ewk_web_resource_private.h"
+#include <wtf/text/CString.h>
+
+struct _Ewk_Web_Resource {
+ unsigned int __ref; /**< the reference count of the object */
+ CString url;
+ bool isMainResource;
+};
+
+void ewk_web_resource_ref(Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN(resource);
+
+ ++resource->__ref;
+}
+
+void ewk_web_resource_unref(Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN(resource);
+
+ if (--resource->__ref)
+ return;
+
+ free(resource);
+}
+
+const char* ewk_web_resource_url_get(const Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(resource, 0);
+
+ return resource->url.data();
+}
+
+/**
+ * @internal
+ * Constructs a Ewk_Web_Resource.
+ */
+Ewk_Web_Resource* ewk_web_resource_new(const char* url, bool isMainResource)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
+
+ Ewk_Web_Resource* resource = static_cast<Ewk_Web_Resource*>(calloc(1, sizeof(Ewk_Web_Resource)));
+ resource->url = ""
+ resource->isMainResource = isMainResource;
+ resource->__ref = 1;
+
+ return resource;
+}
+
+Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(resource, false);
+
+ return resource->isMainResource;
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -0,0 +1,81 @@
+/*
+ * 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_web_resource.h
+ * @brief Describes the Web Resource API.
+ */
+
+#ifndef ewk_web_resource_h
+#define ewk_web_resource_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for @a Ewk_Web_Resource. */
+typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param resource the resource object to increase the reference count
+ */
+EAPI void ewk_web_resource_ref(Ewk_Web_Resource *resource);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the resource is freed.
+ *
+ * @param resource the resource object to decrease the reference count
+ */
+EAPI void ewk_web_resource_unref(Ewk_Web_Resource *resource);
+
+/**
+ * Query URL for this resource.
+ *
+ * @param resource resource object to query.
+ *
+ * @return the URL pointer, that may be @c NULL.
+ */
+EAPI const char *ewk_web_resource_url_get(const Ewk_Web_Resource *resource);
+
+/**
+ * Query if this is the main resource.
+ *
+ * @param resource resource object to query.
+ *
+ * @return @c EINA_TRUE if this is the main resource, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource *resource);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_web_resource_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h (0 => 121889)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h 2012-07-05 07:59:25 UTC (rev 121889)
@@ -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_web_resource_private_h
+#define ewk_web_resource_private_h
+
+typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
+
+Ewk_Web_Resource* ewk_web_resource_new(const char* uri, bool isMainResource);
+
+#endif // ewk_web_resource_private_h