WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch proposal to fix ewk_context_url_scheme_register() ewebkit2 API (v2)
0001-EFL-Switch-to-CUSTOM_PROTOCOLS.patch (text/plain), 25.45 KB, created by
Pascal Jacquemart
on 2014-10-01 08:00:43 PDT
(
hide
)
Description:
Patch proposal to fix ewk_context_url_scheme_register() ewebkit2 API (v2)
Filename:
MIME Type:
Creator:
Pascal Jacquemart
Created:
2014-10-01 08:00:43 PDT
Size:
25.45 KB
patch
obsolete
>From 3e8b447b49dded9c0d50b6547d45f6dfd05ba7be Mon Sep 17 00:00:00 2001 >From: "p.jacquemart" <p.jacquemart@samsung.com> >Date: Tue, 30 Sep 2014 17:22:59 +0100 >Subject: [PATCH] [EFL] Switch to CUSTOM_PROTOCOLS > >--- > ChangeLog | 12 ++++ > Source/WebKit2/ChangeLog | 35 +++++++++++ > Source/WebKit2/PlatformEfl.cmake | 18 +++--- > Source/WebKit2/UIProcess/API/efl/ewk_context.h | 4 +- > .../UIProcess/API/efl/ewk_context_private.h | 1 - > .../UIProcess/API/efl/ewk_url_scheme_request.cpp | 19 ++++-- > .../API/efl/ewk_url_scheme_request_private.h | 12 ++-- > .../UIProcess/API/efl/tests/test_ewk2_context.cpp | 2 +- > .../soup/WebSoupCustomProtocolRequestManager.cpp | 4 ++ > .../UIProcess/efl/RequestManagerClientEfl.cpp | 65 +++++++++----------- > .../UIProcess/efl/RequestManagerClientEfl.h | 49 ++++++++++++++- > Source/WebKit2/UIProcess/efl/WebContextEfl.cpp | 8 +++ > Source/WebKit2/UIProcess/soup/WebContextSoup.cpp | 2 + > Source/cmake/OptionsEfl.cmake | 2 + > Tools/ChangeLog | 13 ++++ > Tools/MiniBrowser/efl/main.c | 31 ++++++++++ > 16 files changed, 215 insertions(+), 62 deletions(-) > >diff --git a/ChangeLog b/ChangeLog >index 6831020..ee4383e 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,15 @@ >+2014-09-30 Pascal Jacquemart <p.jacquemart@samsung.com> >+ >+ [EFL] Enable custom URI schemes with CustomProtocols >+ https://bugs.webkit.org/show_bug.cgi?id=128177 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fixing ewk_context_url_scheme_register() ewebkit2 API >+ rely on r162449 - CustomProtocols implementation from Carlos Garcia Campos >+ >+ * Source/cmake/OptionsEfl.cmake: >+ > 2014-09-27 Dan Bernstein <mitz@apple.com> > > WebKit top of tree sources won't build in 10.9 w/ Xcode 6.0.1 >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 360abef..17aa1af 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,38 @@ >+2014-09-30 Pascal Jacquemart <p.jacquemart@samsung.com> >+ >+ [EFL] Enable custom URI schemes with CustomProtocols >+ https://bugs.webkit.org/show_bug.cgi?id=128177 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fixing ewk_context_url_scheme_register() ewebkit2 API >+ rely on r162449 - CustomProtocols implementation from Carlos Garcia Campos >+ >+ * PlatformEfl.cmake: >+ * UIProcess/API/efl/ewk_context.h: >+ * UIProcess/API/efl/ewk_context_private.h: >+ * UIProcess/API/efl/ewk_url_scheme_request.cpp: >+ (EwkUrlSchemeRequest::EwkUrlSchemeRequest): >+ (EwkUrlSchemeRequest::finish): >+ * UIProcess/API/efl/ewk_url_scheme_request_private.h: >+ (EwkUrlSchemeRequest::create): >+ * UIProcess/API/efl/tests/test_ewk2_context.cpp: >+ (TEST_F): >+ * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: >+ * UIProcess/efl/RequestManagerClientEfl.cpp: >+ (WebKit::RequestManagerClientEfl::RequestManagerClientEfl): >+ (WebKit::RequestManagerClientEfl::startLoading): >+ (WebKit::RequestManagerClientEfl::stopLoading): >+ (WebKit::RequestManagerClientEfl::registerURLSchemeHandler): >+ (WebKit::EwkUrlSchemeHandler::EwkUrlSchemeHandler): Deleted. >+ (WebKit::RequestManagerClientEfl::didReceiveURIRequest): Deleted. >+ * UIProcess/efl/RequestManagerClientEfl.h: >+ (WebKit::RequestManagerClientEfl::handlerFromScheme): >+ * UIProcess/efl/WebContextEfl.cpp: >+ (WebKit::WebContext::platformInitializeWebProcess): >+ * UIProcess/soup/WebContextSoup.cpp: >+ (WebKit::WebContext::platformInitializeNetworkProcess): >+ > 2014-09-30 Carlos Garcia Campos <cgarcia@igalia.com> > > REGRESSION(r173929): [GTK] TestInspector fails after r173929 >diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake >index f07fb63..fd79b86 100644 >--- a/Source/WebKit2/PlatformEfl.cmake >+++ b/Source/WebKit2/PlatformEfl.cmake >@@ -30,6 +30,9 @@ list(APPEND WebKit2_SOURCES > > Shared/Downloads/soup/DownloadSoup.cpp > >+ Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp >+ Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp >+ > Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp > > Shared/cairo/ShareableBitmapCairo.cpp >@@ -67,9 +70,8 @@ list(APPEND WebKit2_SOURCES > UIProcess/API/C/efl/WKPopupMenuListener.cpp > UIProcess/API/C/efl/WKViewEfl.cpp > >- UIProcess/API/C/soup/WKContextSoup.cpp > UIProcess/API/C/soup/WKCookieManagerSoup.cpp >- UIProcess/API/C/soup/WKSoupRequestManager.cpp >+ UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp > > UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp > >@@ -125,6 +127,10 @@ list(APPEND WebKit2_SOURCES > > UIProcess/Launcher/efl/ProcessLauncherEfl.cpp > >+ UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp >+ UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp >+ UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp >+ > UIProcess/Network/soup/NetworkProcessProxySoup.cpp > > UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp >@@ -169,8 +175,6 @@ list(APPEND WebKit2_SOURCES > > UIProcess/soup/WebContextSoup.cpp > UIProcess/soup/WebCookieManagerProxySoup.cpp >- UIProcess/soup/WebSoupRequestManagerClient.cpp >- UIProcess/soup/WebSoupRequestManagerProxy.cpp > > WebProcess/Cookies/soup/WebCookieManagerSoup.cpp > WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp >@@ -203,17 +207,12 @@ list(APPEND WebKit2_SOURCES > WebProcess/soup/WebKitSoupRequestGeneric.cpp > WebProcess/soup/WebKitSoupRequestInputStream.cpp > WebProcess/soup/WebProcessSoup.cpp >- WebProcess/soup/WebSoupRequestManager.cpp > ) > > list(APPEND WebKit2_MESSAGES_IN_FILES > UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in > >- UIProcess/soup/WebSoupRequestManagerProxy.messages.in >- > WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in >- >- WebProcess/soup/WebSoupRequestManager.messages.in > ) > > list(APPEND WebKit2_INCLUDE_DIRECTORIES >@@ -229,6 +228,7 @@ list(APPEND WebKit2_INCLUDE_DIRECTORIES > "${WEBKIT2_DIR}/Shared/API/c/efl" > "${WEBKIT2_DIR}/Shared/CoordinatedGraphics" > "${WEBKIT2_DIR}/Shared/Downloads/soup" >+ "${WEBKIT2_DIR}/Shared/Network/CustomProtocols/soup" > "${WEBKIT2_DIR}/Shared/efl" > "${WEBKIT2_DIR}/Shared/soup" > "${WEBKIT2_DIR}/Shared/unix" >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.h b/Source/WebKit2/UIProcess/API/efl/ewk_context.h >index bc7b054..d3a4dca 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_context.h >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.h >@@ -271,7 +271,7 @@ EAPI Ewk_Storage_Manager *ewk_context_storage_manager_get(const Ewk_Context *con > * { > * const char *path; > * char *contents_data = NULL; >- * unsigned int contents_length = 0; >+ * unsigned contents_length = 0; > * > * path = ewk_url_scheme_request_path_get(request); > * if (!strcmp(path, "plugins")) { >@@ -284,7 +284,7 @@ EAPI Ewk_Storage_Manager *ewk_context_storage_manager_get(const Ewk_Context *con > * 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); >+ * contents_length = strlen(contents_data); > * eina_strbuf_free(buf); > * } > * ewk_url_scheme_request_finish(request, contents_data, contents_length, "text/html"); >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h >index 1729c4a..f403651 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h >@@ -116,7 +116,6 @@ private: > #endif > std::unique_ptr<WebKit::DownloadManagerEfl> m_downloadManager; > std::unique_ptr<WebKit::RequestManagerClientEfl> m_requestManagerClient; >- > std::unique_ptr<WebKit::ContextHistoryClientEfl> m_historyClient; > > JSGlobalContextRef m_jsGlobalContext; >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp >index 99ff274..f4b90c8 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp >@@ -29,17 +29,20 @@ > #include "WKData.h" > #include "WKString.h" > #include "WKURL.h" >+#include "WebSoupCustomProtocolRequestManager.h" >+ > #include "ewk_url_scheme_request_private.h" > > using namespace WebKit; > >-EwkUrlSchemeRequest::EwkUrlSchemeRequest(WKSoupRequestManagerRef manager, WKURLRef url, uint64_t requestID) >+EwkUrlSchemeRequest::EwkUrlSchemeRequest(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID) > : m_wkRequestManager(manager) >- , m_url(url) > , m_requestID(requestID) >- , m_scheme(AdoptWK, WKURLCopyScheme(url)) >- , m_path(AdoptWK, WKURLCopyPath(url)) > { >+ WKURLRef url = toCopiedURLAPI(urlRequest->resourceRequest().url()); >+ m_url = WKEinaSharedString(url); >+ m_scheme = WKEinaSharedString(AdoptWK, WKURLCopyScheme(url)); >+ m_path = WKEinaSharedString(AdoptWK, WKURLCopyPath(url)); > } > > uint64_t EwkUrlSchemeRequest::id() const >@@ -68,7 +71,13 @@ void EwkUrlSchemeRequest::finish(const void* contentData, uint64_t contentLength > WKRetainPtr<WKStringRef> wkMimeType = mimeType ? adoptWK(WKStringCreateWithUTF8CString(mimeType)) : 0; > > // In case of empty reply an empty WKDataRef is sent to the WebProcess. >- WKSoupRequestManagerDidHandleURIRequest(m_wkRequestManager.get(), wkData.get(), contentLength, wkMimeType.get(), m_requestID); >+ WebCore::ResourceResponse response(WebCore::URL(WebCore::URL(), String::fromUTF8(m_url)), >+ String::fromUTF8(mimeType), contentLength, emptyString()); >+ >+ toImpl(m_wkRequestManager.get())->didReceiveResponse(m_requestID, response); >+ toImpl(m_wkRequestManager.get())->didLoadData(m_requestID, toImpl(wkData.get())); >+ toImpl(m_wkRequestManager.get())->didFinishLoading(m_requestID); >+ toImpl(m_wkRequestManager.get())->stopLoading(m_requestID); > } > > const char* ewk_url_scheme_request_scheme_get(const Ewk_Url_Scheme_Request* request) >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h >index 0514738..9a404c7 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h >@@ -30,7 +30,7 @@ > #include "WKBase.h" > #include "WKEinaSharedString.h" > #include "WKRetainPtr.h" >-#include "WKSoupRequestManager.h" >+#include "WKSoupCustomProtocolRequestManager.h" > #include "ewk_object_private.h" > > /** >@@ -41,12 +41,12 @@ class EwkUrlSchemeRequest : public EwkObject { > public: > EWK_OBJECT_DECLARE(EwkUrlSchemeRequest) > >- static PassRefPtr<EwkUrlSchemeRequest> create(WKSoupRequestManagerRef manager, WKURLRef url, uint64_t requestID) >+ static PassRefPtr<EwkUrlSchemeRequest> create(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID) > { >- if (!manager || !url) >+ if (!manager || !urlRequest) > return 0; > >- return adoptRef(new EwkUrlSchemeRequest(manager, url, requestID)); >+ return adoptRef(new EwkUrlSchemeRequest(manager, urlRequest, requestID)); > } > > uint64_t id() const; >@@ -57,9 +57,9 @@ public: > void finish(const void* contentData, uint64_t contentLength, const char* mimeType); > > private: >- EwkUrlSchemeRequest(WKSoupRequestManagerRef manager, WKURLRef urlRef, uint64_t requestID); >+ EwkUrlSchemeRequest(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID); > >- WKRetainPtr<WKSoupRequestManagerRef> m_wkRequestManager; >+ WKRetainPtr<WKSoupCustomProtocolRequestManagerRef> m_wkRequestManager; > WKEinaSharedString m_url; > uint64_t m_requestID; > WKEinaSharedString m_scheme; >diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp >index 3f1470a..d891f36 100644 >--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp >@@ -115,7 +115,7 @@ TEST_F(EWK2ContextTest, ewk_context_storage_manager_get) > > TEST_F(EWK2ContextTest, ewk_context_url_scheme_register) > { >-#if ENABLE(CUSTOM_PROTOCOL) >+#if ENABLE(CUSTOM_PROTOCOLS) > ewk_context_url_scheme_register(ewk_view_context_get(webView()), "fooscheme", schemeRequestCallback, 0); > ewk_view_url_set(webView(), "fooscheme:MyPath"); > >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp >index ad73ad4..ef18854 100644 >--- a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp >@@ -33,6 +33,10 @@ > #include <WebCore/ErrorsGtk.h> > #endif > >+#if PLATFORM(EFL) >+#include <WebCore/ErrorsEfl.h> >+#endif >+ > namespace WebKit { > > const char* WebSoupCustomProtocolRequestManager::supplementName() >diff --git a/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp >index 06e1a9f..f468292 100644 >--- a/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp >@@ -26,58 +26,50 @@ > #include "config.h" > #include "RequestManagerClientEfl.h" > >-#include "WKContextSoup.h" >-#include "WKSoupRequestManager.h" > #include "ewk_context_private.h" > #include "ewk_url_scheme_request_private.h" > > namespace WebKit { > >-struct EwkUrlSchemeHandler { >- Ewk_Url_Scheme_Request_Cb callback; >- void* userData; >- >- EwkUrlSchemeHandler() >- : callback(0) >- , userData(0) >- { } >- >- EwkUrlSchemeHandler(Ewk_Url_Scheme_Request_Cb callback, void* userData) >- : callback(callback) >- , userData(userData) >- { } >-}; >- > static inline RequestManagerClientEfl* toRequestManagerClientEfl(const void* clientInfo) > { > return static_cast<RequestManagerClientEfl*>(const_cast<void*>(clientInfo)); > } > >-void RequestManagerClientEfl::didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef, uint64_t requestID, const void* clientInfo) >-{ >- RequestManagerClientEfl* requestManager = toRequestManagerClientEfl(clientInfo); >- >- RefPtr<EwkUrlSchemeRequest> schemeRequest = EwkUrlSchemeRequest::create(soupRequestManagerRef, urlRef, requestID); >- EwkUrlSchemeHandler handler = requestManager->m_urlSchemeHandlers.get(schemeRequest->scheme()); >- if (!handler.callback) >- return; >- >- handler.callback(schemeRequest.get(), handler.userData); >-} >- > RequestManagerClientEfl::RequestManagerClientEfl(WKContextRef context) >- : m_soupRequestManager(WKContextGetSoupRequestManager(context)) > { >+ m_requestManager = toAPI(toImpl(context)->supplement<WebSoupCustomProtocolRequestManager>()); > ASSERT(m_soupRequestManager); > >- WKSoupRequestManagerClientV0 wkRequestManagerClient; >- memset(&wkRequestManagerClient, 0, sizeof(WKSoupRequestManagerClientV0)); >+ WKSoupCustomProtocolRequestManagerClientV0 wkRequestManagerClient; >+ memset(&wkRequestManagerClient, 0, sizeof(WKSoupCustomProtocolRequestManagerClientV0)); > > wkRequestManagerClient.base.version = 0; > wkRequestManagerClient.base.clientInfo = this; >- wkRequestManagerClient.didReceiveURIRequest = didReceiveURIRequest; >+ wkRequestManagerClient.startLoading = startLoading; >+ wkRequestManagerClient.stopLoading = stopLoading; > >- WKSoupRequestManagerSetClient(m_soupRequestManager.get(), &wkRequestManagerClient.base); >+ WKSoupCustomProtocolRequestManagerSetClient(m_requestManager.get(), &wkRequestManagerClient.base); >+} >+ >+void RequestManagerClientEfl::startLoading(WKSoupCustomProtocolRequestManagerRef manager, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo) >+{ >+ RequestManagerClientEfl* client = toRequestManagerClientEfl(clientInfo); >+ RefPtr<EwkUrlSchemeRequest> request = EwkUrlSchemeRequest::create(manager, toImpl(requestRef), customProtocolID); >+ String scheme(String::fromUTF8(request.get()->scheme())); >+ RefPtr<WebKitURISchemeHandler> handler = (client->m_uriSchemeHandlers).get(scheme); >+ ASSERT(handler.get()); >+ if (!handler->hasCallback()) >+ return; >+ >+ (client->m_uriSchemeRequests).set(customProtocolID, request); >+ handler->performCallback(request.get()); >+} >+ >+void RequestManagerClientEfl::stopLoading(WKSoupCustomProtocolRequestManagerRef manager, uint64_t customProtocolID, const void* clientInfo) >+{ >+ RequestManagerClientEfl* client = toRequestManagerClientEfl(clientInfo); >+ (client->m_uriSchemeRequests).remove(customProtocolID); > } > > RequestManagerClientEfl::~RequestManagerClientEfl() >@@ -88,8 +80,9 @@ void RequestManagerClientEfl::registerURLSchemeHandler(const String& scheme, Ewk > { > ASSERT(callback); > >- m_urlSchemeHandlers.set(scheme, EwkUrlSchemeHandler(callback, userData)); >- WKSoupRequestManagerRegisterURIScheme(m_soupRequestManager.get(), adoptWK(toCopiedAPI(scheme)).get()); >+ RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData)); >+ m_uriSchemeHandlers.set(scheme, handler); >+ toImpl(m_requestManager.get())->registerSchemeForCustomProtocol(scheme); > } > > } // namespace WebKit >diff --git a/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h >index c9049f6..e5f816d 100644 >--- a/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h >+++ b/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h >@@ -26,7 +26,11 @@ > #ifndef RequestManagerClientEfl_h > #define RequestManagerClientEfl_h > >+#include "WebContext.h" >+#include "WebSoupCustomProtocolRequestManager.h" > #include "ewk_context_private.h" >+#include "ewk_url_scheme_request_private.h" >+ > #include <WebKit/WKBase.h> > #include <WebKit/WKRetainPtr.h> > #include <wtf/HashMap.h> >@@ -34,18 +38,59 @@ > > namespace WebKit { > >+class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> { >+public: >+ WebKitURISchemeHandler() >+ : m_callback(0) >+ , m_userData(0) >+ { >+ } >+ WebKitURISchemeHandler(Ewk_Url_Scheme_Request_Cb callback, void* userData) >+ : m_callback(callback) >+ , m_userData(userData) >+ { >+ } >+ >+ ~WebKitURISchemeHandler() >+ { >+ } >+ >+ bool hasCallback() >+ { >+ return m_callback; >+ } >+ >+ void performCallback(EwkUrlSchemeRequest* request) >+ { >+ ASSERT(m_callback); >+ >+ m_callback(request, m_userData); >+ } >+ >+private: >+ Ewk_Url_Scheme_Request_Cb m_callback; >+ void* m_userData; >+}; >+ >+typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap; >+typedef HashMap<uint64_t, RefPtr<EwkUrlSchemeRequest> > URISchemeRequestMap; >+ > class RequestManagerClientEfl { > public: > explicit RequestManagerClientEfl(WKContextRef); > ~RequestManagerClientEfl(); > > void registerURLSchemeHandler(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData); >+ PassRefPtr<WebKitURISchemeHandler> handlerFromScheme(String scheme) { return m_uriSchemeHandlers.get(scheme); }; > > private: > static void didReceiveURIRequest(WKSoupRequestManagerRef, WKURLRef, WKPageRef, uint64_t requestID, const void* clientInfo); >+ static void startLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, WKURLRequestRef, const void* clientInfo); >+ static void stopLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, const void* clientInfo); > >- WKRetainPtr<WKSoupRequestManagerRef> m_soupRequestManager; >- HashMap<String, class EwkUrlSchemeHandler> m_urlSchemeHandlers; >+ WKRetainPtr<WKSoupCustomProtocolRequestManagerRef> m_requestManager; >+ URISchemeHandlerMap m_uriSchemeHandlers; >+ URISchemeRequestMap m_uriSchemeRequests; > }; > > } // namespace WebKit >diff --git a/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp b/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp >index 38c6ae1..94f4d8d 100644 >--- a/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp >@@ -31,7 +31,11 @@ > #include "WebInspectorServer.h" > #include "WebProcessCreationParameters.h" > #include "WebProcessMessages.h" >+#if ENABLE(CUSTOM_PROTOCOLS) >+#include "WebSoupCustomProtocolRequestManager.h" >+#else > #include "WebSoupRequestManagerProxy.h" >+#endif > #include <Efreet.h> > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/IconDatabase.h> >@@ -89,7 +93,11 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para > { > initializeInspectorServer(); > >+#if ENABLE(CUSTOM_PROTOCOLS) >+ parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols(); >+#else > parameters.urlSchemesRegistered = supplement<WebSoupRequestManagerProxy>()->registeredURISchemes(); >+#endif > supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType); > parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy; > parameters.ignoreTLSErrors = m_ignoreTLSErrors; >diff --git a/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp b/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp >index 43ee671..739c636 100644 >--- a/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp >+++ b/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp >@@ -42,6 +42,8 @@ void WebContext::platformInitializeNetworkProcess(NetworkProcessCreationParamete > parameters.languages = WebCore::userPreferredLanguages(); > #if ENABLE(CUSTOM_PROTOCOLS) > parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols(); >+#else >+ parameters.urlSchemesRegistered = supplement<WebSoupRequestManagerProxy>()->registeredURISchemes(); > #endif > } > >diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake >index e692a44..052595c 100644 >--- a/Source/cmake/OptionsEfl.cmake >+++ b/Source/cmake/OptionsEfl.cmake >@@ -308,5 +308,7 @@ if (ENABLE_FTL_JIT) > set(HAVE_LLVM ON) > endif () > >+add_definitions(-DENABLE_CUSTOM_PROTOCOLS=1) >+ > # [E]WebKit2 tests need a hint to find out where processes such as WebProcess are located at. > add_definitions(-DWEBKIT_EXEC_PATH=\"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}\") >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 5e8ed29..344e26b 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2014-09-30 Pascal Jacquemart <p.jacquemart@samsung.com> >+ >+ [EFL] Enable custom URI schemes with CustomProtocols >+ https://bugs.webkit.org/show_bug.cgi?id=128177 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adding a dummy "minibrowser-about" scheme as per GTK port >+ So we can make sure the API won't break anymore >+ >+ * MiniBrowser/efl/main.c: >+ (elm_main): >+ > 2014-09-30 Tibor Meszaros <tmeszaros.u-szeged@partner.samsung.com> > > [EFL] Bump EFL version to 1.11.2 >diff --git a/Tools/MiniBrowser/efl/main.c b/Tools/MiniBrowser/efl/main.c >index e55acdb..510f12a 100644 >--- a/Tools/MiniBrowser/efl/main.c >+++ b/Tools/MiniBrowser/efl/main.c >@@ -70,6 +70,35 @@ static Eina_Bool legacy_behavior_enabled = EINA_FALSE; > // The zoom values are chosen to be like in Mozilla Firefox 3. > const static float zoomLevels[] = {0.3, 0.5, 0.67, 0.8, 0.9, 1.0, 1.1, 1.2, 1.33, 1.5, 1.7, 2.0, 2.4, 3.0}; > >+// Implementing about scheme >+static const char MINIBROWSER_ABOUT_SCHEME[] = "minibrowser-about"; >+static void about_url_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data) >+{ >+ const char *url; >+ char *contents_data = NULL; >+ unsigned contents_length = 0; >+ >+ url = ewk_url_scheme_request_url_get(request); >+ if (strstr(url, "plugins")) { >+ // FIXME: >+ // Initialize contents_data with the contents of plugins about page, and set its length to contents_length >+ } else if (strstr(url, "memory")) { >+ // FIXME: >+ // Initialize contents_data with the contents of memory about page, and set its length to contents_length >+ } else if (strstr(url, "applications")) { >+ // FIXME: >+ // 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 %s page</p></body></html>", url); >+ contents_data = eina_strbuf_string_steal(buf); >+ contents_length = strlen(contents_data); >+ eina_strbuf_free(buf); >+ } >+ ewk_url_scheme_request_finish(request, contents_data, contents_length, "text/html"); >+ free(contents_data); >+} >+ > static Eina_Bool > zoom_level_set(Evas_Object *webview, int level) > { >@@ -2350,6 +2379,8 @@ elm_main(int argc, char *argv[]) > if (window_size_string) > parse_window_size(window_size_string, &window_width, &window_height); > >+ ewk_context_url_scheme_register(context, MINIBROWSER_ABOUT_SCHEME, about_url_scheme_request_cb, NULL); >+ > if (args < argc) { > char *url = url_from_user_input(argv[args]); > window = window_create(NULL, 0, 0); >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
cgarcia
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 128177
:
238932
|
239027
|
239030
|
239101
|
239104
|
239211
|
239401