Changeset 174419 in webkit
- Timestamp:
- Oct 7, 2014 11:37:40 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r174200 r174419 1 2014-10-07 Pascal Jacquemart <p.jacquemart@samsung.com> 2 3 [EFL] Enable custom URI schemes with CustomProtocols 4 https://bugs.webkit.org/show_bug.cgi?id=128177 5 6 Reviewed by Gyuyoung Kim. 7 8 Fixing ewk_context_url_scheme_register() ewebkit2 API 9 rely on r162449 - CustomProtocols implementation from Carlos Garcia Campos 10 11 * Source/cmake/OptionsEfl.cmake: Forcing CUSTOM_PROTOCOLS flag 12 1 13 2014-10-01 Michael Catanzaro <mcatanzaro@igalia.com> 2 14 -
trunk/Source/WebKit2/ChangeLog
r174417 r174419 1 2014-10-07 Pascal Jacquemart <p.jacquemart@samsung.com> 2 3 [EFL] Enable custom URI schemes with CustomProtocols 4 https://bugs.webkit.org/show_bug.cgi?id=128177 5 6 Reviewed by Gyuyoung Kim. 7 8 Fixing ewk_context_url_scheme_register() ewebkit2 API 9 rely on r162449 - CustomProtocols implementation from Carlos Garcia Campos 10 11 * PlatformEfl.cmake: 12 * UIProcess/API/efl/ewk_context.h: 13 * UIProcess/API/efl/ewk_url_scheme_request.cpp: 14 (EwkUrlSchemeRequest::EwkUrlSchemeRequest): 15 (EwkUrlSchemeRequest::finish): 16 * UIProcess/API/efl/ewk_url_scheme_request_private.h: 17 (EwkUrlSchemeRequest::create): 18 * UIProcess/API/efl/tests/test_ewk2_context.cpp: 19 (TEST_F): 20 * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: 21 * UIProcess/efl/RequestManagerClientEfl.cpp: 22 (WebKit::RequestManagerClientEfl::RequestManagerClientEfl): 23 (WebKit::RequestManagerClientEfl::startLoading): 24 (WebKit::RequestManagerClientEfl::stopLoading): 25 (WebKit::RequestManagerClientEfl::registerURLSchemeHandler): 26 (WebKit::EwkUrlSchemeHandler::EwkUrlSchemeHandler): Deleted. 27 (WebKit::RequestManagerClientEfl::didReceiveURIRequest): Deleted. 28 * UIProcess/efl/RequestManagerClientEfl.h: 29 * UIProcess/efl/WebContextEfl.cpp: 30 (WebKit::WebContext::platformInitializeWebProcess): 31 * UIProcess/soup/WebContextSoup.cpp: 32 (WebKit::WebContext::platformInitializeNetworkProcess): 33 1 34 2014-10-07 Sungmann Cho <sungmann.cho@navercorp.com> 2 35 -
trunk/Source/WebKit2/PlatformEfl.cmake
r174335 r174419 30 30 31 31 Shared/Downloads/soup/DownloadSoup.cpp 32 33 Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp 34 Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp 32 35 33 36 Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp … … 68 71 UIProcess/API/C/efl/WKViewEfl.cpp 69 72 70 UIProcess/API/C/soup/WKContextSoup.cpp71 73 UIProcess/API/C/soup/WKCookieManagerSoup.cpp 72 UIProcess/API/C/soup/WKSoup RequestManager.cpp74 UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp 73 75 74 76 UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp … … 126 128 UIProcess/Launcher/efl/ProcessLauncherEfl.cpp 127 129 130 UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp 131 UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp 132 UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp 133 128 134 UIProcess/Network/soup/NetworkProcessProxySoup.cpp 129 135 … … 170 176 UIProcess/soup/WebContextSoup.cpp 171 177 UIProcess/soup/WebCookieManagerProxySoup.cpp 172 UIProcess/soup/WebSoupRequestManagerClient.cpp173 UIProcess/soup/WebSoupRequestManagerProxy.cpp174 178 175 179 WebProcess/Cookies/soup/WebCookieManagerSoup.cpp … … 207 211 WebProcess/soup/WebKitSoupRequestInputStream.cpp 208 212 WebProcess/soup/WebProcessSoup.cpp 209 WebProcess/soup/WebSoupRequestManager.cpp210 213 ) 211 214 … … 213 216 UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in 214 217 215 UIProcess/soup/WebSoupRequestManagerProxy.messages.in216 217 218 WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in 218 219 WebProcess/soup/WebSoupRequestManager.messages.in220 219 ) 221 220 … … 233 232 "${WEBKIT2_DIR}/Shared/CoordinatedGraphics" 234 233 "${WEBKIT2_DIR}/Shared/Downloads/soup" 234 "${WEBKIT2_DIR}/Shared/Network/CustomProtocols/soup" 235 235 "${WEBKIT2_DIR}/Shared/efl" 236 236 "${WEBKIT2_DIR}/Shared/soup" -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.h
r174335 r174419 261 261 * function provided will be called with a #Ewk_Url_Scheme_Request. 262 262 * 263 * It is possible to handle URL scheme requests asynchronously, by calling ewk_ url_scheme_ref() on the263 * It is possible to handle URL scheme requests asynchronously, by calling ewk_object_ref() on the 264 264 * #Ewk_Url_Scheme_Request and calling ewk_url_scheme_request_finish() later when the data of 265 265 * the request is available. … … 271 271 * 272 272 * @code 273 * static void about_url_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data)273 * static void custom_url_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data) 274 274 * { 275 * const char * path;275 * const char *scheme; 276 276 * char *contents_data = NULL; 277 * unsigned int contents_length = 0; 278 * 279 * path = ewk_url_scheme_request_path_get(request); 280 * if (!strcmp(path, "plugins")) { 281 * // Initialize contents_data with the contents of plugins about page, and set its length to contents_length 282 * } else if (!strcmp(path, "memory")) { 283 * // Initialize contents_data with the contents of memory about page, and set its length to contents_length 284 * } else if (!strcmp(path, "applications")) { 285 * // Initialize contents_data with the contents of application about page, and set its length to contents_length 277 * unsigned contents_length = 0; 278 * 279 * scheme = ewk_url_scheme_request_scheme_get(request); 280 * if (!strcmp(scheme, "myapp")) { 281 * // Initialize contents_data with a welcome page, and set its length to contents_length 286 282 * } else { 287 283 * Eina_Strbuf *buf = eina_strbuf_new(); 288 * eina_strbuf_append_printf(buf, "<html><body><p>Invalid a bout:%s page</p></body></html>", path);284 * eina_strbuf_append_printf(buf, "<html><body><p>Invalid application: %s</p></body></html>", scheme); 289 285 * contents_data = eina_strbuf_string_steal(buf); 290 * contents_length = strlen(contents );286 * contents_length = strlen(contents_data); 291 287 * eina_strbuf_free(buf); 292 288 * } -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp
r161758 r174419 30 30 #include "WKString.h" 31 31 #include "WKURL.h" 32 #include "WebSoupCustomProtocolRequestManager.h" 33 32 34 #include "ewk_url_scheme_request_private.h" 33 35 34 36 using namespace WebKit; 35 37 36 EwkUrlSchemeRequest::EwkUrlSchemeRequest(WKSoup RequestManagerRef manager, WKURLRef url, uint64_t requestID)38 EwkUrlSchemeRequest::EwkUrlSchemeRequest(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID) 37 39 : m_wkRequestManager(manager) 38 , m_url(url)39 40 , m_requestID(requestID) 40 , m_scheme(AdoptWK, WKURLCopyScheme(url))41 , m_path(AdoptWK, WKURLCopyPath(url))42 41 { 42 WKURLRef url = toCopiedURLAPI(urlRequest->resourceRequest().url()); 43 m_url = WKEinaSharedString(url); 44 m_scheme = WKEinaSharedString(AdoptWK, WKURLCopyScheme(url)); 45 m_path = WKEinaSharedString(AdoptWK, WKURLCopyPath(url)); 43 46 } 44 47 … … 69 72 70 73 // In case of empty reply an empty WKDataRef is sent to the WebProcess. 71 WKSoupRequestManagerDidHandleURIRequest(m_wkRequestManager.get(), wkData.get(), contentLength, wkMimeType.get(), m_requestID); 74 WebCore::ResourceResponse response(WebCore::URL(WebCore::URL(), String::fromUTF8(m_url)), 75 String::fromUTF8(mimeType), contentLength, emptyString()); 76 77 toImpl(m_wkRequestManager.get())->didReceiveResponse(m_requestID, response); 78 toImpl(m_wkRequestManager.get())->didLoadData(m_requestID, toImpl(wkData.get())); 79 toImpl(m_wkRequestManager.get())->didFinishLoading(m_requestID); 80 toImpl(m_wkRequestManager.get())->stopLoading(m_requestID); 72 81 } 73 82 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h
r135117 r174419 31 31 #include "WKEinaSharedString.h" 32 32 #include "WKRetainPtr.h" 33 #include "WKSoup RequestManager.h"33 #include "WKSoupCustomProtocolRequestManager.h" 34 34 #include "ewk_object_private.h" 35 35 … … 42 42 EWK_OBJECT_DECLARE(EwkUrlSchemeRequest) 43 43 44 static PassRefPtr<EwkUrlSchemeRequest> create(WKSoup RequestManagerRef manager, WKURLRef url, uint64_t requestID)44 static PassRefPtr<EwkUrlSchemeRequest> create(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID) 45 45 { 46 if (!manager || !url )46 if (!manager || !urlRequest) 47 47 return 0; 48 48 49 return adoptRef(new EwkUrlSchemeRequest(manager, url , requestID));49 return adoptRef(new EwkUrlSchemeRequest(manager, urlRequest, requestID)); 50 50 } 51 51 … … 58 58 59 59 private: 60 EwkUrlSchemeRequest(WKSoup RequestManagerRef manager, WKURLRef urlRef, uint64_t requestID);60 EwkUrlSchemeRequest(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID); 61 61 62 WKRetainPtr<WKSoup RequestManagerRef> m_wkRequestManager;62 WKRetainPtr<WKSoupCustomProtocolRequestManagerRef> m_wkRequestManager; 63 63 WKEinaSharedString m_url; 64 64 uint64_t m_requestID; -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp
r174335 r174419 116 116 TEST_F(EWK2ContextTest, ewk_context_url_scheme_register) 117 117 { 118 #if ENABLE(CUSTOM_PROTOCOL) 119 ewk_context_url_scheme_register(ewk_view_context_get(webView()), "fooscheme", schemeRequestCallback, 0); 118 ewk_context_url_scheme_register(ewk_view_context_get(webView()), "fooscheme", schemeRequestCallback, nullptr); 120 119 ewk_view_url_set(webView(), "fooscheme:MyPath"); 121 120 122 121 ASSERT_TRUE(waitUntilTrue(finishTest, testTimeoutSeconds)); 123 #endif124 122 } 125 123 -
trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp
r162449 r174419 32 32 #if PLATFORM(GTK) 33 33 #include <WebCore/ErrorsGtk.h> 34 #elif PLATFORM(EFL) 35 #include <WebCore/ErrorsEfl.h> 34 36 #endif 35 37 -
trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp
r160128 r174419 27 27 #include "RequestManagerClientEfl.h" 28 28 29 #include "WKContextSoup.h"30 #include "WKSoupRequestManager.h"31 29 #include "ewk_context_private.h" 32 30 #include "ewk_url_scheme_request_private.h" 33 31 34 32 namespace WebKit { 35 36 struct EwkUrlSchemeHandler {37 Ewk_Url_Scheme_Request_Cb callback;38 void* userData;39 40 EwkUrlSchemeHandler()41 : callback(0)42 , userData(0)43 { }44 45 EwkUrlSchemeHandler(Ewk_Url_Scheme_Request_Cb callback, void* userData)46 : callback(callback)47 , userData(userData)48 { }49 };50 33 51 34 static inline RequestManagerClientEfl* toRequestManagerClientEfl(const void* clientInfo) … … 54 37 } 55 38 56 void RequestManagerClientEfl::didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef, uint64_t requestID, const void* clientInfo)39 RequestManagerClientEfl::RequestManagerClientEfl(WKContextRef context) 57 40 { 58 RequestManagerClientEfl* requestManager = toRequestManagerClientEfl(clientInfo); 59 60 RefPtr<EwkUrlSchemeRequest> schemeRequest = EwkUrlSchemeRequest::create(soupRequestManagerRef, urlRef, requestID); 61 EwkUrlSchemeHandler handler = requestManager->m_urlSchemeHandlers.get(schemeRequest->scheme()); 62 if (!handler.callback) 63 return; 64 65 handler.callback(schemeRequest.get(), handler.userData); 66 } 67 68 RequestManagerClientEfl::RequestManagerClientEfl(WKContextRef context) 69 : m_soupRequestManager(WKContextGetSoupRequestManager(context)) 70 { 41 m_requestManager = toAPI(toImpl(context)->supplement<WebSoupCustomProtocolRequestManager>()); 71 42 ASSERT(m_soupRequestManager); 72 43 73 WKSoup RequestManagerClientV0 wkRequestManagerClient;74 memset(&wkRequestManagerClient, 0, sizeof(WKSoup RequestManagerClientV0));44 WKSoupCustomProtocolRequestManagerClientV0 wkRequestManagerClient; 45 memset(&wkRequestManagerClient, 0, sizeof(WKSoupCustomProtocolRequestManagerClientV0)); 75 46 76 47 wkRequestManagerClient.base.version = 0; 77 48 wkRequestManagerClient.base.clientInfo = this; 78 wkRequestManagerClient.didReceiveURIRequest = didReceiveURIRequest; 49 wkRequestManagerClient.startLoading = startLoading; 50 wkRequestManagerClient.stopLoading = stopLoading; 79 51 80 WKSoup RequestManagerSetClient(m_soupRequestManager.get(), &wkRequestManagerClient.base);52 WKSoupCustomProtocolRequestManagerSetClient(m_requestManager.get(), &wkRequestManagerClient.base); 81 53 } 82 54 83 RequestManagerClientEfl::~RequestManagerClientEfl()55 void RequestManagerClientEfl::startLoading(WKSoupCustomProtocolRequestManagerRef manager, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo) 84 56 { 57 RequestManagerClientEfl* client = toRequestManagerClientEfl(clientInfo); 58 RefPtr<EwkUrlSchemeRequest> request = EwkUrlSchemeRequest::create(manager, toImpl(requestRef), customProtocolID); 59 String scheme(String::fromUTF8(request.get()->scheme())); 60 RefPtr<WebKitURISchemeHandler> handler = (client->m_uriSchemeHandlers).get(scheme); 61 ASSERT(handler.get()); 62 if (!handler->hasCallback()) 63 return; 64 65 (client->m_uriSchemeRequests).set(customProtocolID, request); 66 handler->performCallback(request.get()); 67 } 68 69 void RequestManagerClientEfl::stopLoading(WKSoupCustomProtocolRequestManagerRef manager, uint64_t customProtocolID, const void* clientInfo) 70 { 71 UNUSED_PARAM(manager); 72 73 RequestManagerClientEfl* client = toRequestManagerClientEfl(clientInfo); 74 (client->m_uriSchemeRequests).remove(customProtocolID); 85 75 } 86 76 … … 89 79 ASSERT(callback); 90 80 91 m_urlSchemeHandlers.set(scheme, EwkUrlSchemeHandler(callback, userData)); 92 WKSoupRequestManagerRegisterURIScheme(m_soupRequestManager.get(), adoptWK(toCopiedAPI(scheme)).get()); 81 RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData)); 82 m_uriSchemeHandlers.set(scheme, handler); 83 toImpl(m_requestManager.get())->registerSchemeForCustomProtocol(scheme); 93 84 } 94 85 -
trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h
r168961 r174419 27 27 #define RequestManagerClientEfl_h 28 28 29 #include "WebContext.h" 30 #include "WebSoupCustomProtocolRequestManager.h" 29 31 #include "ewk_context_private.h" 32 #include "ewk_url_scheme_request_private.h" 33 30 34 #include <WebKit/WKBase.h> 31 35 #include <WebKit/WKRetainPtr.h> … … 35 39 namespace WebKit { 36 40 41 class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> { 42 public: 43 WebKitURISchemeHandler() 44 : m_callback(nullptr) 45 , m_userData(nullptr) 46 { 47 } 48 49 WebKitURISchemeHandler(Ewk_Url_Scheme_Request_Cb callback, void* userData) 50 : m_callback(callback) 51 , m_userData(userData) 52 { 53 } 54 55 bool hasCallback() 56 { 57 return m_callback; 58 } 59 60 void performCallback(EwkUrlSchemeRequest* request) 61 { 62 ASSERT(m_callback); 63 64 m_callback(request, m_userData); 65 } 66 67 private: 68 Ewk_Url_Scheme_Request_Cb m_callback; 69 void* m_userData; 70 }; 71 72 typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap; 73 typedef HashMap<uint64_t, RefPtr<EwkUrlSchemeRequest> > URISchemeRequestMap; 74 37 75 class RequestManagerClientEfl { 38 76 public: 39 77 explicit RequestManagerClientEfl(WKContextRef); 40 ~RequestManagerClientEfl();41 78 42 79 void registerURLSchemeHandler(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData); 43 80 44 81 private: 45 static void didReceiveURIRequest(WKSoupRequestManagerRef, WKURLRef, WKPageRef, uint64_t requestID, const void* clientInfo); 82 static void startLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, WKURLRequestRef, const void* clientInfo); 83 static void stopLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, const void* clientInfo); 46 84 47 WKRetainPtr<WKSoupRequestManagerRef> m_soupRequestManager; 48 HashMap<String, class EwkUrlSchemeHandler> m_urlSchemeHandlers; 85 WKRetainPtr<WKSoupCustomProtocolRequestManagerRef> m_requestManager; 86 URISchemeHandlerMap m_uriSchemeHandlers; 87 URISchemeRequestMap m_uriSchemeRequests; 49 88 }; 50 89 -
trunk/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp
r172500 r174419 32 32 #include "WebProcessCreationParameters.h" 33 33 #include "WebProcessMessages.h" 34 #include "WebSoup RequestManagerProxy.h"34 #include "WebSoupCustomProtocolRequestManager.h" 35 35 #include <Efreet.h> 36 36 #include <WebCore/ApplicationCacheStorage.h> … … 90 90 initializeInspectorServer(); 91 91 92 parameters.urlSchemesRegistered = supplement<WebSoupRequestManagerProxy>()->registeredURISchemes();92 parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols(); 93 93 supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType); 94 94 parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy; -
trunk/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp
r162449 r174419 41 41 parameters.ignoreTLSErrors = m_ignoreTLSErrors; 42 42 parameters.languages = WebCore::userPreferredLanguages(); 43 #if ENABLE(CUSTOM_PROTOCOLS)44 43 parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols(); 45 #endif46 44 } 47 45 -
trunk/Source/cmake/OptionsEfl.cmake
r174128 r174419 309 309 endif () 310 310 311 add_definitions(-DENABLE_CUSTOM_PROTOCOLS=1) 312 311 313 # [E]WebKit2 tests need a hint to find out where processes such as WebProcess are located at. 312 314 add_definitions(-DWEBKIT_EXEC_PATH=\"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}\")
Note: See TracChangeset
for help on using the changeset viewer.