Changeset 94965 in webkit


Ignore:
Timestamp:
Sep 12, 2011 10:54:33 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Patch by Flavio Ceolin <flavio.ceolin@profusion.mobi> on 2011-09-12
Reviewed by Martin Robinson.

[EFL] Add custom network resource handler
https://bugs.webkit.org/show_bug.cgi?id=44759

This patch adds support for handling user-specific protocols.
It allows browsers to intercept and handle non-standard url schemes (such as preferences://)
allowing to load some resource from non-http/file storage, like a tar/zip/eet.

  • CMakeListsEfl.txt:
  • ewk/ewk_protocol_handler.cpp: Added.
  • ewk/ewk_protocol_handler.h: Added.
  • ewk/ewk_protocol_handler_soup.cpp: Added.
  • ewk/ewk_protocol_handler_soup.h: Added.
  • ewk/ewk_private.h:
  • ewk/ewk_view.cpp:

(ewk_view_protocol_handler_set):
(ewk_view_protocol_handler_unset):
(ewk_view_protocol_handler_resource_get):

  • ewk/ewk_view.h:
Location:
trunk/Source/WebKit/efl
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/efl/CMakeListsEfl.txt

    r94509 r94965  
    7474    efl/ewk/ewk_network.cpp
    7575    efl/ewk/ewk_settings.cpp
     76    efl/ewk/ewk_protocol_handler.cpp
    7677    efl/ewk/ewk_tiled_backing_store.c
    7778    efl/ewk/ewk_tiled_matrix.c
     
    116117    efl/ewk/ewk_auth.cpp
    117118    efl/ewk/ewk_auth_soup.cpp
     119    efl/ewk/ewk_protocol_handler_soup.cpp
    118120  )
    119121ENDIF ()
     
    236238    ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_main.h
    237239    ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_network.h
     240    ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_protocol_handler.h
    238241    ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_settings.h
    239242    ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_view.h
  • trunk/Source/WebKit/efl/ChangeLog

    r94509 r94965  
     12011-09-12  Flavio Ceolin  <flavio.ceolin@profusion.mobi>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [EFL] Add custom network resource handler
     6        https://bugs.webkit.org/show_bug.cgi?id=44759
     7
     8        This patch adds support for handling user-specific protocols.
     9        It allows browsers to intercept and handle non-standard url schemes (such as preferences://)
     10        allowing to load some resource from non-http/file storage, like a tar/zip/eet.
     11
     12        * CMakeListsEfl.txt:
     13        * ewk/ewk_protocol_handler.cpp: Added.
     14        * ewk/ewk_protocol_handler.h: Added.
     15        * ewk/ewk_protocol_handler_soup.cpp: Added.
     16        * ewk/ewk_protocol_handler_soup.h: Added.
     17        * ewk/ewk_private.h:
     18        * ewk/ewk_view.cpp:
     19        (ewk_view_protocol_handler_set):
     20        (ewk_view_protocol_handler_unset):
     21        (ewk_view_protocol_handler_resource_get):
     22        * ewk/ewk_view.h:
     23
    1242011-09-04  Ryuan Choi  <ryuan.choi@samsung.com>
    225
  • trunk/Source/WebKit/efl/ewk/ewk_private.h

    r94063 r94965  
    135135
    136136void ewk_view_download_request(Evas_Object *o, Ewk_Download *download);
     137void *ewk_view_protocol_handler_resource_get(Evas_Object *o, size_t *bytesRead, char **mime, const char *file);
    137138
    138139void ewk_view_editor_client_contents_changed(Evas_Object *o);
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r94414 r94965  
    5151#include "c_instance.h"
    5252#include "ewk_private.h"
     53#include "ewk_protocol_handler.h"
    5354
    5455#include <Ecore.h>
     
    9394    WebCore::ViewportArguments viewport_arguments;
    9495    Ewk_History *history;
     96    struct {
     97        void* context;
     98        Ewk_View_Resource_Handler_Cb function;
     99    } custom_resource_handler;
    95100    struct {
    96101        Ewk_Menu menu;
     
    35973602}
    35983603
     3604Eina_Bool ewk_view_protocol_handler_set(Evas_Object* o, const char** protocols, Ewk_View_Resource_Handler_Cb handler, void* context)
     3605{
     3606    EWK_VIEW_SD_GET(o, sd);
     3607    EWK_VIEW_PRIV_GET(sd, priv);
     3608
     3609    if (!handler)
     3610        return EINA_FALSE;
     3611
     3612    priv->custom_resource_handler.function = handler;
     3613    priv->custom_resource_handler.context = context;
     3614
     3615    return ewk_custom_protocol_handler_set(protocols);
     3616}
     3617
     3618Eina_Bool ewk_view_protocol_handler_unset(Evas_Object* o)
     3619{
     3620    EWK_VIEW_SD_GET(o, sd);
     3621    EWK_VIEW_PRIV_GET(sd, priv);
     3622    Eina_Bool ret = ewk_custom_protocol_handler_all_unset();
     3623
     3624    if (ret) {
     3625        priv->custom_resource_handler.function = 0;
     3626        priv->custom_resource_handler.context = 0;
     3627    }
     3628
     3629    return ret;
     3630}
     3631
     3632void* ewk_view_protocol_handler_resource_get(Evas_Object* o, size_t* bytesRead, char** mime, const char* file)
     3633{
     3634    EWK_VIEW_SD_GET(o, sd);
     3635    EWK_VIEW_PRIV_GET(sd, priv);
     3636
     3637    Ewk_View_Resource_Handler_Cb function = priv->custom_resource_handler.function;
     3638    if (function)
     3639        return function(file, bytesRead, mime, priv->custom_resource_handler.context);
     3640
     3641    return 0;
     3642}
    35993643
    36003644/**
  • trunk/Source/WebKit/efl/ewk/ewk_view.h

    r94380 r94965  
    100100typedef struct _Ewk_View_Smart_Data Ewk_View_Smart_Data;
    101101
     102/// Creates a type name for a Resource Handler Callback
     103typedef void* (*Ewk_View_Resource_Handler_Cb)(const char *, size_t *, char **, void *);
     104
    102105/// Creates a type name for @a _Ewk_View_Smart_Class.
    103106typedef struct _Ewk_View_Smart_Class Ewk_View_Smart_Class;
     
    21452148 */
    21462149EAPI Eina_Bool ewk_view_js_object_add(Evas_Object *o, Ewk_JS_Object *obj, const char *obj_name);
     2150
     2151/**
     2152 * Register a new protocol handler for handling an specific protocol (scheme).
     2153 *
     2154 * @param o view.
     2155 * @param protocols the protocols that will be handled.
     2156 * @param handler the function that will be executed for the protocols
     2157 * @param ctxt the handler context
     2158 * @return @c EINA_TRUE if success, @c EINA_FALSE if not.
     2159 */
     2160EAPI Eina_Bool ewk_view_protocol_handler_set(Evas_Object* o, const char** protocol, Ewk_View_Resource_Handler_Cb handler, void* ctxt);
     2161
     2162/**
     2163 * Remove the custom protocol handler.
     2164 *
     2165 * @param o view.
     2166 * @return @c EINA_TRUE if success, @c EINA_FALSE if not.
     2167 */
     2168EAPI Eina_Bool ewk_view_protocol_handler_unset(Evas_Object* o);
     2169
    21472170#ifdef __cplusplus
    21482171}
Note: See TracChangeset for help on using the changeset viewer.