diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API')
8 files changed, 48 insertions, 438 deletions
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp index 76de21a4f..cecad7652 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp @@ -51,7 +51,7 @@ Ewk_Form_Submission_Request::~Ewk_Form_Submission_Request() String Ewk_Form_Submission_Request::fieldValue(const String& fieldName) const { ASSERT(fieldName); - WKRetainPtr<WKStringRef> wkFieldName = toCopiedAPI(fieldName); + WKRetainPtr<WKStringRef> wkFieldName = adoptWK(toCopiedAPI(fieldName)); WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(m_wkValues.get(), wkFieldName.get())); return wkValue ? toImpl(wkValue)->string() : String(); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index d8608aa48..fc955ec82 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -25,7 +25,9 @@ #include "NativeWebMouseEvent.h" #include "NativeWebWheelEvent.h" #include "PageClientImpl.h" +#include "PageLoadClientEfl.h" #include "RefPtrEfl.h" +#include "ResourceLoadClientEfl.h" #include "WKAPICast.h" #include "WKColorPickerResultListener.h" #include "WKEinaSharedString.h" @@ -51,10 +53,8 @@ #include "ewk_settings_private.h" #include "ewk_view_find_client_private.h" #include "ewk_view_form_client_private.h" -#include "ewk_view_loader_client_private.h" #include "ewk_view_policy_client_private.h" #include "ewk_view_private.h" -#include "ewk_view_resource_load_client_private.h" #include "ewk_view_ui_client_private.h" #include <Ecore_Evas.h> #include <Edje.h> @@ -86,7 +86,6 @@ static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; static const int defaultCursorSize = 16; -typedef HashMap< uint64_t, RefPtr<Ewk_Resource> > LoadingResourcesMap; static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo); typedef HashMap<const WebPageProxy*, const Evas_Object*> PageViewMap; @@ -119,6 +118,8 @@ struct Ewk_View_Private_Data { OwnPtr<PageViewportControllerClientEfl> pageViewportControllerClient; #endif RefPtr<WebPageProxy> pageProxy; + OwnPtr<PageLoadClientEfl> pageLoadClient; + OwnPtr<ResourceLoadClientEfl> resourceLoadClient; WKEinaSharedString url; WKEinaSharedString title; @@ -127,7 +128,6 @@ struct Ewk_View_Private_Data { WKEinaSharedString cursorGroup; WKEinaSharedString faviconURL; RefPtr<Evas_Object> cursorObject; - LoadingResourcesMap loadingResourcesMap; OwnPtr<Ewk_Back_Forward_List> backForwardList; OwnPtr<Ewk_Settings> settings; bool areMouseEventsEnabled; @@ -828,17 +828,18 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP priv->pageViewportControllerClient = PageViewportControllerClientEfl::create(ewkView); #endif + // Initialize page clients. WKPageRef wkPage = toAPI(priv->pageProxy.get()); ewk_view_find_client_attach(wkPage, ewkView); ewk_view_form_client_attach(wkPage, ewkView); - ewk_view_loader_client_attach(wkPage, ewkView); ewk_view_policy_client_attach(wkPage, ewkView); - ewk_view_resource_load_client_attach(wkPage, ewkView); ewk_view_ui_client_attach(wkPage, ewkView); #if ENABLE(FULLSCREEN_API) priv->pageProxy->fullScreenManager()->setWebView(ewkView); ewk_settings_fullscreen_enabled_set(priv->settings.get(), true); #endif + priv->pageLoadClient = PageLoadClientEfl::create(ewkView); + priv->resourceLoadClient = ResourceLoadClientEfl::create(ewkView); /* Listen for favicon changes */ Ewk_Favicon_Database* iconDatabase = ewk_context_favicon_database_get(priv->context); @@ -1015,20 +1016,26 @@ Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView) /** * @internal + * Retrieves the internal WKPage for this view. + */ +WKPageRef ewk_view_wkpage_get(const Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + + return toAPI(priv->pageProxy.get()); +} + +/** + * @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_Resource* resource, Ewk_Url_Request* request) +void ewk_view_resource_load_initiated(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - Ewk_Resource_Request resourceRequest = {resource, request, 0}; - // Keep the resource internally to reuse it later. - priv->loadingResourcesMap.add(resourceIdentifier, resource); - evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest); } @@ -1038,16 +1045,9 @@ void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIde * * Emits signal: "resource,request,response" with pointer to resource response. */ -void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response) +void ewk_view_resource_load_response(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Response* response) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Load_Response resourceLoadResponse = {resource.get(), response}; + Ewk_Resource_Load_Response resourceLoadResponse = {resource, response}; evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse); } @@ -1057,16 +1057,9 @@ void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIden * * Emits signal: "resource,request,finished" with pointer to the resource load error. */ -void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Error* error) +void ewk_view_resource_load_failed(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Error* error) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Load_Error resourceLoadError = {resource.get(), error}; + Ewk_Resource_Load_Error resourceLoadError = {resource, error}; evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError); } @@ -1076,16 +1069,9 @@ void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdenti * * Emits signal: "resource,request,finished" with pointer to the resource. */ -void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier) +void ewk_view_resource_load_finished(Evas_Object* ewkView, Ewk_Resource* resource) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.take(resourceIdentifier); - evas_object_smart_callback_call(ewkView, "resource,request,finished", resource.get()); + evas_object_smart_callback_call(ewkView, "resource,request,finished", resource); } /** @@ -1094,17 +1080,9 @@ void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIden * * Emits signal: "resource,request,sent" with pointer to resource request and possible redirect response. */ -void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse) +void ewk_view_resource_request_sent(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - if (!priv->loadingResourcesMap.contains(resourceIdentifier)) - return; - - RefPtr<Ewk_Resource> resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Resource_Request resourceRequest = {resource.get(), request, redirectResponse}; - + Ewk_Resource_Request resourceRequest = {resource, request, redirectResponse}; evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest); } @@ -1538,13 +1516,6 @@ void ewk_view_load_provisional_redirect(Evas_Object* ewkView) */ void ewk_view_load_provisional_started(Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - - // The main frame started provisional load, we should clear - // the loadingResources HashMap to start clean. - priv->loadingResourcesMap.clear(); - ewk_view_url_update(ewkView); evas_object_smart_callback_call(ewkView, "load,provisional,started", 0); } @@ -1942,8 +1913,8 @@ Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, in EINA_SAFETY_ON_NULL_RETURN_VAL(priv->colorPickerResultListener, false); WebCore::Color color = WebCore::Color(r, g, b, a); - const WKStringRef colorString = WKStringCreateWithUTF8CString(color.serialized().utf8().data()); - WKColorPickerResultListenerSetColor(priv->colorPickerResultListener.get(), colorString); + WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data())); + WKColorPickerResultListenerSetColor(priv->colorPickerResultListener.get(), colorString.get()); priv->colorPickerResultListener.clear(); return true; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp deleted file mode 100644 index 0d6d5a347..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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_view.h" - -#include "WKFrame.h" -#include "ewk_back_forward_list_private.h" -#include "ewk_error_private.h" -#include "ewk_intent.h" -#include "ewk_intent_private.h" -#include "ewk_intent_service.h" -#include "ewk_intent_service_private.h" -#include "ewk_view_loader_client_private.h" -#include "ewk_view_private.h" -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> - -using namespace WebKit; - -static void didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo) -{ - if (!WKFrameIsMainFrame(frame)) - return; - - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ewk_view_title_changed(ewkView, toImpl(title)->string().utf8().data()); -} - -#if ENABLE(WEB_INTENTS) -static void didReceiveIntentForFrame(WKPageRef, WKFrameRef, WKIntentDataRef intent, WKTypeRef, const void* clientInfo) -{ - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - RefPtr<Ewk_Intent> ewkIntent = Ewk_Intent::create(intent); - ewk_view_intent_request_new(ewkView, ewkIntent.get()); -} -#endif - -#if ENABLE(WEB_INTENTS_TAG) -static void registerIntentServiceForFrame(WKPageRef, WKFrameRef, WKIntentServiceInfoRef serviceInfo, WKTypeRef, const void *clientInfo) -{ - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - RefPtr<Ewk_Intent_Service> ewkIntentService = Ewk_Intent_Service::create(serviceInfo); - ewk_view_intent_service_register(ewkView, ewkIntentService.get()); -} -#endif - -static void didChangeProgress(WKPageRef page, const void* clientInfo) -{ - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ewk_view_load_progress_changed(ewkView, WKPageGetEstimatedProgress(page)); -} - -static void didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void *clientInfo) -{ - if (!WKFrameIsMainFrame(frame)) - return; - - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ewk_view_load_finished(ewkView); -} - -static void didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void *clientInfo) -{ - if (!WKFrameIsMainFrame(frame)) - return; - - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); - ewk_view_load_error(ewkView, ewkError.get()); - ewk_view_load_finished(ewkView); -} - -static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) -{ - if (!WKFrameIsMainFrame(frame)) - return; - - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ewk_view_load_provisional_started(ewkView); -} - -static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef /*userData*/, const void* clientInfo) -{ - if (!WKFrameIsMainFrame(frame)) - return; - - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ewk_view_load_provisional_redirect(ewkView); -} - -static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo) -{ - if (!WKFrameIsMainFrame(frame)) - return; - - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error); - ewk_view_load_provisional_failed(ewkView, ewkError.get()); -} - -static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo) -{ - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ASSERT(ewkView); - - Ewk_Back_Forward_List* list = ewk_view_back_forward_list_get(ewkView); - ASSERT(list); - list->update(addedItem, removedItems); - - ewk_view_back_forward_list_changed(ewkView); -} - -static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo) -{ - if (!WKFrameIsMainFrame(frame)) - return; - - Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); - ewk_view_url_update(ewkView); -} - -void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView) -{ - WKPageLoaderClient loadClient; - memset(&loadClient, 0, sizeof(WKPageLoaderClient)); - loadClient.version = kWKPageLoaderClientCurrentVersion; - loadClient.clientInfo = ewkView; - loadClient.didReceiveTitleForFrame = didReceiveTitleForFrame; -#if ENABLE(WEB_INTENTS) - loadClient.didReceiveIntentForFrame = didReceiveIntentForFrame; -#endif -#if ENABLE(WEB_INTENTS_TAG) - loadClient.registerIntentServiceForFrame = registerIntentServiceForFrame; -#endif - loadClient.didStartProgress = didChangeProgress; - loadClient.didChangeProgress = didChangeProgress; - loadClient.didFinishProgress = didChangeProgress; - loadClient.didFinishLoadForFrame = didFinishLoadForFrame; - loadClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame; - loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame; - loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame; - loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame; - loadClient.didChangeBackForwardList = didChangeBackForwardList; - loadClient.didSameDocumentNavigationForFrame = didSameDocumentNavigationForFrame; - WKPageSetPageLoaderClient(pageRef, &loadClient); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h deleted file mode 100644 index 615c019fc..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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_loader_client_private_h -#define ewk_view_loader_client_private_h - -#include <Evas.h> -#include <WebKit2/WKBase.h> - -void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView); - -#endif // ewk_view_loader_client_private_h diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index 61c7bd41a..2066f9eff 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -77,17 +77,19 @@ void ewk_view_page_close(Evas_Object* ewkView); WKPageRef ewk_view_page_create(Evas_Object* ewkView); void ewk_view_title_changed(Evas_Object* ewkView, const char* title); void ewk_view_tooltip_text_set(Evas_Object* ewkView, const char* text); -void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Error* error); -void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIdentifier); -void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Resource* resource, Ewk_Url_Request* request); -void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Response* response); -void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse); +void ewk_view_resource_load_failed(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Error* error); +void ewk_view_resource_load_finished(Evas_Object* ewkView, Ewk_Resource* resource); +void ewk_view_resource_load_initiated(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request); +void ewk_view_resource_load_response(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Response* response); +void ewk_view_resource_request_sent(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse); void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount); void ewk_view_url_update(Evas_Object* ewkView); void ewk_view_contents_size_changed(const Evas_Object* ewkView, const WebCore::IntSize&); void ewk_view_back_forward_list_changed(Evas_Object* ewkView); void ewk_view_update_icon(Evas_Object* ewkView); +WKPageRef ewk_view_wkpage_get(const Evas_Object* ewkView); + Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef); #if ENABLE(WEB_INTENTS) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp deleted file mode 100644 index ce62539d3..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 "WKURLResponse.h" -#include "ewk_error_private.h" -#include "ewk_resource.h" -#include "ewk_resource_private.h" -#include "ewk_url_request.h" -#include "ewk_url_request_private.h" -#include "ewk_url_response.h" -#include "ewk_url_response_private.h" -#include "ewk_view_private.h" -#include "ewk_view_resource_load_client_private.h" -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> - -using namespace WebCore; -using namespace WebKit; - -static inline Evas_Object* toEwkView(const void* clientInfo) -{ - return static_cast<Evas_Object*>(const_cast<void*>(clientInfo)); -} - -static void didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, bool pageIsProvisionallyLoading, const void* clientInfo) -{ - bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading); - WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest)); - - RefPtr<Ewk_Resource> resource = Ewk_Resource::create(wkUrl.get(), isMainResource); - RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); - ewk_view_resource_load_initiated(toEwkView(clientInfo), resourceIdentifier, resource.get(), request.get()); -} - -static void didSendRequestForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, WKURLResponseRef wkRedirectResponse, const void* clientInfo) -{ - RefPtr<Ewk_Url_Request> request = Ewk_Url_Request::create(wkRequest); - RefPtr<Ewk_Url_Response> redirectResponse = Ewk_Url_Response::create(wkRedirectResponse); - ewk_view_resource_request_sent(toEwkView(clientInfo), resourceIdentifier, request.get(), redirectResponse.get()); -} - -static void didReceiveResponseForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKURLResponseRef wkResponse, const void* clientInfo) -{ - RefPtr<Ewk_Url_Response> response = Ewk_Url_Response::create(wkResponse); - ewk_view_resource_load_response(toEwkView(clientInfo), resourceIdentifier, response.get()); -} - -static void didFinishLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, const void* clientInfo) -{ - ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier); -} - -static void didFailLoadForResource(WKPageRef, WKFrameRef, uint64_t resourceIdentifier, WKErrorRef wkError, const void* clientInfo) -{ - OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(wkError); - ewk_view_resource_load_failed(toEwkView(clientInfo), resourceIdentifier, ewkError.get()); - ewk_view_resource_load_finished(toEwkView(clientInfo), resourceIdentifier); -} - -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; - wkResourceLoadClient.didSendRequestForResource = didSendRequestForResource; - wkResourceLoadClient.didReceiveResponseForResource = didReceiveResponseForResource; - wkResourceLoadClient.didFinishLoadForResource = didFinishLoadForResource; - wkResourceLoadClient.didFailLoadForResource = didFailLoadForResource; - - WKPageSetPageResourceLoadClient(pageRef, &wkResourceLoadClient); -} diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h deleted file mode 100644 index 1f404b920..000000000 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index cd2de8d25..ac037fb30 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -26,11 +26,6 @@ #import "config.h" #import "WKView.h" -#if USE(DICTATION_ALTERNATIVES) -#import <AppKit/NSTextAlternatives.h> -#import <AppKit/NSAttributedString.h> -#endif - #import "AttributedString.h" #import "ColorSpaceData.h" #import "DataReference.h" @@ -90,6 +85,10 @@ #import <wtf/RefPtr.h> #import <wtf/RetainPtr.h> +#if USE(DICTATION_ALTERNATIVES) +#import <AppKit/NSTextAlternatives.h> +#endif + @interface NSApplication (WKNSApplicationDetails) - (void)speakString:(NSString *)string; - (void)_setCurrentEvent:(NSEvent *)event; @@ -139,12 +138,6 @@ struct WKViewInterpretKeyEventsParameters { - (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState; @end -@interface WKToolTipDelegate : NSObject { - RefPtr<WebPageProxy> _page; -} -- (id)initWithPage:(WebPageProxy *)page; -@end - @interface WKViewData : NSObject { @public OwnPtr<PageClientImpl> _pageClient; @@ -217,7 +210,6 @@ struct WKViewInterpretKeyEventsParameters { String _promisedFilename; String _promisedURL; - RetainPtr<WKToolTipDelegate> _toolTipDelegate; RetainPtr<NSMutableArray> _observers; } @@ -2520,6 +2512,11 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [_data->_trackingRectOwner mouseEntered:fakeEvent]; } +- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data +{ + return nsStringFromWebCoreString(_data->_page->toolTip()); +} + - (void)_wk_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip { if (oldToolTip) @@ -2529,9 +2526,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I // See radar 3500217 for why we remove all tooltips rather than just the single one we created. [self removeAllToolTips]; NSRect wideOpenRect = NSMakeRect(-100000, -100000, 200000, 200000); - if (!_data->_toolTipDelegate) - _data->_toolTipDelegate = adoptNS([[WKToolTipDelegate alloc] initWithPage:_data->_page.get()]); - _data->_lastToolTipTag = [self addToolTipRect:wideOpenRect owner:_data->_toolTipDelegate.get() userData:NULL]; + _data->_lastToolTipTag = [self addToolTipRect:wideOpenRect owner:self userData:NULL]; [self _wk_sendToolTipMouseEntered]; } } @@ -3198,21 +3193,3 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } @end - -@implementation WKToolTipDelegate - -- (id)initWithPage:(WebPageProxy *)page -{ - self = [super init]; - if (!self) - return nil; - _page = page; - return self; -} - -- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data -{ - return nsStringFromWebCoreString(_page->toolTip()); -} - -@end |