Title: [118123] trunk
Revision
118123
Author
[email protected]
Date
2012-05-22 22:24:02 -0700 (Tue, 22 May 2012)

Log Message

[EFL] Implements the registerProtocolHandler method and option.
https://bugs.webkit.org/show_bug.cgi?id=73638

Patch by Dongwoo Im <[email protected]> on 2012-05-22
Reviewed by Andreas Kling.

The registerProtocolHandler() method allows Web sites to register themselves
as possible handlers for particular schemes.

http://dev.w3.org/html5/spec/Overview.html#dom-navigator-registerprotocolhandler

.:

* Source/cmake/OptionsEfl.cmake: Adds the build option.
* Source/cmakeconfig.h.cmake: Adds the build option.

Source/WebCore:

* CMakeLists.txt: Add page/NavigatorRegisterProtocolHandler.idl into WebCore_IDL_FILES.

Source/WebKit:

* PlatformEfl.cmake: Adds the new file into the source list.

Source/WebKit/efl:

* WebCoreSupport/ChromeClientEfl.cpp: Adds a new function.
(WebCore):
(WebCore::customHandlersDataCreate): Creates and fills the data object.
(WebCore::customHandlersDataDelete): Deletes the data object.
(WebCore::ChromeClientEfl::registerProtocolHandler): Registers a protocol and the handler of it.
* WebCoreSupport/ChromeClientEfl.h: Adds a prototype.
(ChromeClientEfl):
* ewk/ewk_custom_handlers.cpp: Added.
(ewk_custom_handlers_register_protocol_handler):
* ewk/ewk_view.h: Adds Data structure.
* ewk/ewk_view_private.h: Adds private function.

LayoutTests:

* platform/efl/fast/dom/register-protocol-handler-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (118122 => 118123)


--- trunk/ChangeLog	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/ChangeLog	2012-05-23 05:24:02 UTC (rev 118123)
@@ -1,3 +1,18 @@
+2012-05-22  Dongwoo Im  <[email protected]>
+
+        [EFL] Implements the registerProtocolHandler method and option.
+        https://bugs.webkit.org/show_bug.cgi?id=73638
+
+        Reviewed by Andreas Kling.
+
+        The registerProtocolHandler() method allows Web sites to register themselves
+        as possible handlers for particular schemes.
+
+        http://dev.w3.org/html5/spec/Overview.html#dom-navigator-registerprotocolhandler
+
+        * Source/cmake/OptionsEfl.cmake: Adds the build option.
+        * Source/cmakeconfig.h.cmake: Adds the build option.
+
 2012-05-22  Kangil Han  <[email protected]>
 
         [EFL][DRT] Implement touch event

Modified: trunk/LayoutTests/ChangeLog (118122 => 118123)


--- trunk/LayoutTests/ChangeLog	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/LayoutTests/ChangeLog	2012-05-23 05:24:02 UTC (rev 118123)
@@ -1,3 +1,17 @@
+2012-05-22  Dongwoo Im  <[email protected]>
+
+        [EFL] Implements the registerProtocolHandler method and option.
+        https://bugs.webkit.org/show_bug.cgi?id=73638
+
+        Reviewed by Andreas Kling.
+
+        The registerProtocolHandler() method allows Web sites to register themselves
+        as possible handlers for particular schemes.
+
+        http://dev.w3.org/html5/spec/Overview.html#dom-navigator-registerprotocolhandler
+
+        * platform/efl/fast/dom/register-protocol-handler-expected.txt: Added.
+
 2012-05-22  Stephanie Lewis  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=87208

Added: trunk/LayoutTests/platform/efl/fast/dom/register-protocol-handler-expected.txt (0 => 118123)


--- trunk/LayoutTests/platform/efl/fast/dom/register-protocol-handler-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/efl/fast/dom/register-protocol-handler-expected.txt	2012-05-23 05:24:02 UTC (rev 118123)
@@ -0,0 +1,20 @@
+This test makes sure that navigator.registerProtocolHandler throws the proper exceptions and has no-op default implementation.
+
+Pass: window.navigator.registerProtocolHandler is defined.
+Pass: Invalid protocol "http" threw SECURITY_ERR exception.
+Pass: Invalid protocol "https" threw SECURITY_ERR exception.
+Pass: Invalid protocol "file" threw SECURITY_ERR exception.
+Pass: Valid protocol "irc" allowed.
+Pass: Valid protocol "mailto" allowed.
+Pass: Valid protocol "mms" allowed.
+Pass: Valid protocol "news" allowed.
+Pass: Valid protocol "nntp" allowed.
+Pass: Valid protocol "sms" allowed.
+Pass: Valid protocol "smsto" allowed.
+Pass: Valid protocol "tel" allowed.
+Pass: Valid protocol "urn" allowed.
+Pass: Valid protocol "webcal" allowed.
+Pass: Invalid url "" threw SYNTAX_ERR exception.
+Pass: Invalid url "%S" threw SYNTAX_ERR exception.
+Pass: Valid call succeeded.
+

Modified: trunk/Source/WebCore/CMakeLists.txt (118122 => 118123)


--- trunk/Source/WebCore/CMakeLists.txt	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-05-23 05:24:02 UTC (rev 118123)
@@ -383,6 +383,7 @@
     page/Location.idl
     page/MemoryInfo.idl
     page/Navigator.idl
+    page/NavigatorRegisterProtocolHandler.idl
     page/Performance.idl
     page/PerformanceEntry.idl
     page/PerformanceEntryList.idl

Modified: trunk/Source/WebCore/ChangeLog (118122 => 118123)


--- trunk/Source/WebCore/ChangeLog	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebCore/ChangeLog	2012-05-23 05:24:02 UTC (rev 118123)
@@ -1,3 +1,17 @@
+2012-05-22  Dongwoo Im  <[email protected]>
+
+        [EFL] Implements the registerProtocolHandler method and option.
+        https://bugs.webkit.org/show_bug.cgi?id=73638
+
+        Reviewed by Andreas Kling.
+
+        The registerProtocolHandler() method allows Web sites to register themselves
+        as possible handlers for particular schemes.
+
+        http://dev.w3.org/html5/spec/Overview.html#dom-navigator-registerprotocolhandler
+
+        * CMakeLists.txt: Add page/NavigatorRegisterProtocolHandler.idl into WebCore_IDL_FILES.
+
 2012-05-22  Kentaro Hara  <[email protected]>
 
         [V8][Performance] Pass Isolate to v8::Null() in V8Node::toV8()

Modified: trunk/Source/WebKit/ChangeLog (118122 => 118123)


--- trunk/Source/WebKit/ChangeLog	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebKit/ChangeLog	2012-05-23 05:24:02 UTC (rev 118123)
@@ -1,3 +1,17 @@
+2012-05-22  Dongwoo Im  <[email protected]>
+
+        [EFL] Implements the registerProtocolHandler method and option.
+        https://bugs.webkit.org/show_bug.cgi?id=73638
+
+        Reviewed by Andreas Kling.
+
+        The registerProtocolHandler() method allows Web sites to register themselves
+        as possible handlers for particular schemes.
+
+        http://dev.w3.org/html5/spec/Overview.html#dom-navigator-registerprotocolhandler
+
+        * PlatformEfl.cmake: Adds the new file into the source list.
+
 2012-05-21  Christophe Dumez  <[email protected]>
 
         [EFL] Minor style fixes in web intents code are needed

Modified: trunk/Source/WebKit/PlatformEfl.cmake (118122 => 118123)


--- trunk/Source/WebKit/PlatformEfl.cmake	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebKit/PlatformEfl.cmake	2012-05-23 05:24:02 UTC (rev 118123)
@@ -156,6 +156,12 @@
     LIST(APPEND WebKit_SOURCES efl/WebCoreSupport/BatteryClientEfl.cpp)
 ENDIF ()
 
+IF (ENABLE_REGISTER_PROTOCOL_HANDLER)
+    LIST(APPEND WebKit_SOURCES
+        efl/ewk/ewk_custom_handler.cpp
+    )
+ENDIF ()
+
 SET(WebKit_THEME_DEFINITION "")
 IF (ENABLE_PROGRESS_TAG)
   LIST(APPEND WebKit_THEME_DEFINITION "-DENABLE_PROGRESS_TAG")

Modified: trunk/Source/WebKit/efl/ChangeLog (118122 => 118123)


--- trunk/Source/WebKit/efl/ChangeLog	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-05-23 05:24:02 UTC (rev 118123)
@@ -1,3 +1,27 @@
+2012-05-22  Dongwoo Im  <[email protected]>
+
+        [EFL] Implements the registerProtocolHandler method and option.
+        https://bugs.webkit.org/show_bug.cgi?id=73638
+
+        Reviewed by Andreas Kling.
+
+        The registerProtocolHandler() method allows Web sites to register themselves
+        as possible handlers for particular schemes.
+
+        http://dev.w3.org/html5/spec/Overview.html#dom-navigator-registerprotocolhandler
+
+        * WebCoreSupport/ChromeClientEfl.cpp: Adds a new function.
+        (WebCore):
+        (WebCore::customHandlersDataCreate): Creates and fills the data object.
+        (WebCore::customHandlersDataDelete): Deletes the data object.
+        (WebCore::ChromeClientEfl::registerProtocolHandler): Registers a protocol and the handler of it.
+        * WebCoreSupport/ChromeClientEfl.h: Adds a prototype.
+        (ChromeClientEfl):
+        * ewk/ewk_custom_handlers.cpp: Added.
+        (ewk_custom_handlers_register_protocol_handler):
+        * ewk/ewk_view.h: Adds Data structure.
+        * ewk/ewk_view_private.h: Adds private function.
+
 2012-05-22  Kangil Han  <[email protected]>
 
         [EFL][DRT] Implement touch event

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp (118122 => 118123)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2012-05-23 05:24:02 UTC (rev 118123)
@@ -632,4 +632,34 @@
     element->document()->webkitDidExitFullScreenForElement(element);
 }
 #endif
+
+#if ENABLE(REGISTER_PROTOCOL_HANDLER)
+static Ewk_Custom_Handler_Data* customHandlerDataCreate(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url, const char* title)
+{
+    Ewk_Custom_Handler_Data* data = "" Ewk_Custom_Handler_Data;
+    data->ewkView = ewkView;
+    data->scheme = eina_stringshare_add(scheme);
+    data->base_url = eina_stringshare_add(baseURL);
+    data->url = ""
+    data->title = eina_stringshare_add(title);
+    return data;
 }
+
+static void customHandlerDataDelete(Ewk_Custom_Handler_Data* data)
+{
+    eina_stringshare_del(data->scheme);
+    eina_stringshare_del(data->base_url);
+    eina_stringshare_del(data->url);
+    eina_stringshare_del(data->title);
+    delete data;
+}
+
+void ChromeClientEfl::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title)
+{
+    Ewk_Custom_Handler_Data* data = "" scheme.utf8().data(), baseURL.utf8().data(), url.utf8().data(), title.utf8().data());
+    ewk_custom_handler_register_protocol_handler(data);
+    customHandlerDataDelete(data);
+}
+#endif
+
+}

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h (118122 => 118123)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h	2012-05-23 05:24:02 UTC (rev 118123)
@@ -179,6 +179,10 @@
     virtual void numWheelEventHandlersChanged(unsigned) { }
     virtual void numTouchEventHandlersChanged(unsigned) { }
 
+#if ENABLE(REGISTER_PROTOCOL_HANDLER)
+    virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title);
+#endif
+
     Evas_Object* m_view;
     KURL m_hoveredLinkURL;
 };

Added: trunk/Source/WebKit/efl/ewk/ewk_custom_handler.cpp (0 => 118123)


--- trunk/Source/WebKit/efl/ewk/ewk_custom_handler.cpp	                        (rev 0)
+++ trunk/Source/WebKit/efl/ewk/ewk_custom_handler.cpp	2012-05-23 05:24:02 UTC (rev 118123)
@@ -0,0 +1,33 @@
+/*
+    Copyright (C) 2012 Samsung Electronics
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#if ENABLE(REGISTER_PROTOCOL_HANDLER)
+
+#include "ewk_view_private.h"
+
+bool ewk_custom_handler_register_protocol_handler(Ewk_Custom_Handler_Data* data)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(data->ewkView, false);
+    evas_object_smart_callback_call(data->ewkView, "protocolhandler,registration,requested", data);
+    return true;
+}
+
+#endif

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (118122 => 118123)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-05-23 05:24:02 UTC (rev 118123)
@@ -70,6 +70,7 @@
  *  - "menubar,visible,set", Eina_Bool: sets menubar visibility.
  *  - "mixedcontent,displayed", void: any of the containing frames has loaded and displayed mixed content.
  *  - "mixedcontent,run", void: any of the containing frames has loaded and run mixed content.
+ *  - "protocolhandler,registration,requested", Ewk_Custom_Handler_Data: add a handler url for the given protocol.
  *  - "onload,event", Evas_Object*: a frame onload event has been received.
  *  - "ready", void: page is fully loaded.
  *  - "resource,request,new", Ewk_Frame_Resource_Request*: reports that
@@ -309,6 +310,17 @@
     unsigned char a; /**< Alpha channel. */
 };
 
+/// Creates a type name for @a _Ewk_Custom_Handler_Data.
+typedef struct _Ewk_Custom_Handler_Data Ewk_Custom_Handler_Data;
+/// Contains the target scheme and the url which take care of the target.
+struct _Ewk_Custom_Handler_Data {
+    Evas_Object *ewkView; /**< Reference to the view object. */
+    const char *scheme; /**< Reference to the scheme that will be handled. (eg. "application/x-soup") */
+    const char *base_url; /**< Reference to the resolved url if the url is relative url. (eg. "https://www.example.com/") */
+    const char *url; /**< Reference to the url which will handle the given protocol. (eg. "soup?url="" */
+    const char *title; /**< Reference to the descriptive title of the handler. (eg. "SoupWeb") */
+};
+
 /**
  * @brief Contains an internal View data.
  *

Modified: trunk/Source/WebKit/efl/ewk/ewk_view_private.h (118122 => 118123)


--- trunk/Source/WebKit/efl/ewk/ewk_view_private.h	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/WebKit/efl/ewk/ewk_view_private.h	2012-05-23 05:24:02 UTC (rev 118123)
@@ -149,6 +149,10 @@
 WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object* ewkView);
 #endif
 
+#if ENABLE(REGISTER_PROTOCOL_HANDLER)
+bool ewk_custom_handler_register_protocol_handler(Ewk_Custom_Handler_Data* data);
+#endif
+
 namespace EWKPrivate {
 WebCore::Page *corePage(const Evas_Object *ewkView);
 PlatformPageClient corePageClient(Evas_Object* ewkView);

Modified: trunk/Source/cmake/OptionsEfl.cmake (118122 => 118123)


--- trunk/Source/cmake/OptionsEfl.cmake	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/cmake/OptionsEfl.cmake	2012-05-23 05:24:02 UTC (rev 118123)
@@ -75,6 +75,7 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_INFO ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PAGE_VISIBILITY_API ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REGISTER_PROTOCOL_HANDLER ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REQUEST_ANIMATION_FRAME ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHARED_WORKERS ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS ON)

Modified: trunk/Source/cmakeconfig.h.cmake (118122 => 118123)


--- trunk/Source/cmakeconfig.h.cmake	2012-05-23 05:20:24 UTC (rev 118122)
+++ trunk/Source/cmakeconfig.h.cmake	2012-05-23 05:24:02 UTC (rev 118123)
@@ -56,6 +56,7 @@
 #cmakedefine01 ENABLE_PAGE_POPUP
 #cmakedefine01 ENABLE_PAGE_VISIBILITY_API
 #cmakedefine01 ENABLE_PROGRESS_TAG
+#cmakedefine01 ENABLE_REGISTER_PROTOCOL_HANDLER
 #cmakedefine01 ENABLE_REQUEST_ANIMATION_FRAME
 #cmakedefine01 ENABLE_SHARED_WORKERS
 #cmakedefine01 ENABLE_SMOOTH_SCROLLING
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to