Changeset 139305 in webkit


Ignore:
Timestamp:
Jan 10, 2013 3:27:49 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Add support for loading web process extensions
https://bugs.webkit.org/show_bug.cgi?id=105631

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2013-01-10
Reviewed by Gustavo Noronha Silva.

.:

  • GNUmakefile.am: Add webkit2_web_extension_h_api.
  • Source/autotools/symbols.filter: Export WebGtkExtensionManager

symbols required by the injected bundle lib.

Source/WebKit2:

  • GNUmakefile.am: Link to libWebCoreDOM.la and build injected

bundle lib.

  • GNUmakefile.list.am: Add new files to compilation.
  • UIProcess/API/gtk/WebKitWebContext.cpp:

(injectedBundleDirectory): Helper funtion to get the injected
bundle directory.
(injectedBundleFilename): Helper funtion to get the injected undle
library full path.
(createDefaultWebContext): Create the WebContext with an injected
bundle path.

  • UIProcess/API/gtk/WebKitWebView.cpp:

(webkit_web_view_get_page_id): Return the identifier of the web
page associated to the web view.

  • UIProcess/API/gtk/WebKitWebView.h:
  • UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new chapter for

web extensions.

  • UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
  • UIProcess/API/gtk/docs/webkit2gtk.types: Add new types.
  • UIProcess/API/gtk/tests/GNUmakefile.am: Add new files to compilation.
  • UIProcess/API/gtk/tests/TestMain.cpp:

(main):

  • UIProcess/API/gtk/tests/TestWebExtensions.cpp: Added.

(testWebExtension):
(beforeAll):
(afterAll):

  • UIProcess/API/gtk/tests/WebExtensionTest.cpp: Added.

(methodCallCallback):
(webkit_web_extension_initialize):

  • UIProcess/API/gtk/tests/WebKitTestBus.cpp: Added.

(WebKitTestBus::WebKitTestBus):
(WebKitTestBus::run):
(WebKitTestBus::~WebKitTestBus):
(WebKitTestBus::connection):
(onNameAppeared):
(WebKitTestBus::createProxy):

  • UIProcess/API/gtk/tests/WebKitTestBus.h: Added.

(WebKitTestBus):

  • WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp: Added.

(_WebKitWebExtensionPrivate):
(webkitWebExtensionPageCreated): Create a WebKitWebPage for the
newly crated page and emit WebKitWebExtension::page-created
signals.
(webkitWebExtensionPageDestroy): Remove the page from the map.
(didCreatePage): Call webkitWebExtensionPageCreated().
(willDestroyPage): Call webkitWebExtensionPageDestroy().
(webkitWebExtensionCreate): Create a new WebKitWebExtension and
initialize the injected bundle client.
(webkit_web_extension_get_page): Return the WebKitWebPage for the
given page identifier.

  • WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h: Added.

(_WebKitWebExtension):
(_WebKitWebExtensionClass):

  • WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionDefines.h: Added.
  • WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionPrivate.h: Added.
  • WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp: Added.

(_WebKitWebPagePrivate):
(webkit_web_page_class_init):
(webkitWebPageCreate): Create a new WebKitWebPage.
(webkit_web_page_get_dom_document): Return the WebKitDOMDocument
loaded in the WebKitWebPage.

  • WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h: Added.

(_WebKitWebPage):
(_WebKitWebPageClass):

  • WebProcess/InjectedBundle/API/gtk/WebKitWebPagePrivate.h: Added.
  • WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h: Added.
  • WebProcess/gtk/WebGtkExtensionManager.cpp: Added.

(WebKit::WebGtkExtensionManager::shared): Return the global shared
instance.
(WebKit::WebGtkExtensionManager::WebGtkExtensionManager):
(WebKit::WebGtkExtensionManager::appendModuleDirectories): Add
directories to scan for modules.
(WebKit::WebGtkExtensionManager::scanModules): Scan for modules.
(WebKit::WebGtkExtensionManager::initialize): Load and initialize
the modules found.

  • WebProcess/gtk/WebGtkExtensionManager.h: Added.
  • WebProcess/gtk/WebGtkInjectedBundleMain.cpp: Added.

(WKBundleInitialize): Initialize WebGtkExtensionManager.

Tools:

  • MiniBrowser/gtk/GNUmakefile.am:
  • MiniBrowser/gtk/main.c:

(main): Set WEBKIT_INJECTED_BUNDLE env var to use the injected
bundle lib from build dir.

  • Scripts/webkitpy/style/checker.py: Add exceptions for GTK+ API

located in WebProcess/InjectedBundle/API/gtk.

  • gtk/generate-gtkdoc:

(get_webkit2_options): Scan also files in
WebProcess/InjectedBundle/API/gtk to generate API docs.
(get_webkit2_options.injected_bundle_src_path): Helper function to
build paths in WebProcess/InjectedBundle/API/gtk.

Location:
trunk
Files:
12 added
19 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r139291 r139305  
     12013-01-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Add support for loading web process extensions
     4        https://bugs.webkit.org/show_bug.cgi?id=105631
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        * GNUmakefile.am: Add webkit2_web_extension_h_api.
     9        * Source/autotools/symbols.filter: Export WebGtkExtensionManager
     10        symbols required by the injected bundle lib.
     11
    1122013-01-10  Christophe Dumez  <christophe.dumez@intel.com>
    213
  • trunk/GNUmakefile.am

    r138595 r139305  
    9999webkit2gtk_h_api :=
    100100webkit2gtk_built_sources :=
     101webkit2_web_extension_h_api :=
    101102webkit2_plugin_process_sources :=
    102103webkit2_plugin_process_built_sources :=
  • trunk/Source/WebKit2/ChangeLog

    r139300 r139305  
     12013-01-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Add support for loading web process extensions
     4        https://bugs.webkit.org/show_bug.cgi?id=105631
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        * GNUmakefile.am: Link to libWebCoreDOM.la and build injected
     9        bundle lib.
     10        * GNUmakefile.list.am: Add new files to compilation.
     11        * UIProcess/API/gtk/WebKitWebContext.cpp:
     12        (injectedBundleDirectory): Helper funtion to get the injected
     13        bundle directory.
     14        (injectedBundleFilename): Helper funtion to get the injected undle
     15        library full path.
     16        (createDefaultWebContext): Create the WebContext with an injected
     17        bundle path.
     18        * UIProcess/API/gtk/WebKitWebView.cpp:
     19        (webkit_web_view_get_page_id): Return the identifier of the web
     20        page associated to the web view.
     21        * UIProcess/API/gtk/WebKitWebView.h:
     22        * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new chapter for
     23        web extensions.
     24        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
     25        * UIProcess/API/gtk/docs/webkit2gtk.types: Add new types.
     26        * UIProcess/API/gtk/tests/GNUmakefile.am: Add new files to compilation.
     27        * UIProcess/API/gtk/tests/TestMain.cpp:
     28        (main):
     29        * UIProcess/API/gtk/tests/TestWebExtensions.cpp: Added.
     30        (testWebExtension):
     31        (beforeAll):
     32        (afterAll):
     33        * UIProcess/API/gtk/tests/WebExtensionTest.cpp: Added.
     34        (methodCallCallback):
     35        (webkit_web_extension_initialize):
     36        * UIProcess/API/gtk/tests/WebKitTestBus.cpp: Added.
     37        (WebKitTestBus::WebKitTestBus):
     38        (WebKitTestBus::run):
     39        (WebKitTestBus::~WebKitTestBus):
     40        (WebKitTestBus::connection):
     41        (onNameAppeared):
     42        (WebKitTestBus::createProxy):
     43        * UIProcess/API/gtk/tests/WebKitTestBus.h: Added.
     44        (WebKitTestBus):
     45        * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp: Added.
     46        (_WebKitWebExtensionPrivate):
     47        (webkitWebExtensionPageCreated): Create a WebKitWebPage for the
     48        newly crated page and emit WebKitWebExtension::page-created
     49        signals.
     50        (webkitWebExtensionPageDestroy): Remove the page from the map.
     51        (didCreatePage): Call webkitWebExtensionPageCreated().
     52        (willDestroyPage): Call webkitWebExtensionPageDestroy().
     53        (webkitWebExtensionCreate): Create a new WebKitWebExtension and
     54        initialize the injected bundle client.
     55        (webkit_web_extension_get_page): Return the WebKitWebPage for the
     56        given page identifier.
     57        * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h: Added.
     58        (_WebKitWebExtension):
     59        (_WebKitWebExtensionClass):
     60        * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionDefines.h: Added.
     61        * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionPrivate.h: Added.
     62        * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp: Added.
     63        (_WebKitWebPagePrivate):
     64        (webkit_web_page_class_init):
     65        (webkitWebPageCreate): Create a new WebKitWebPage.
     66        (webkit_web_page_get_dom_document): Return the WebKitDOMDocument
     67        loaded in the WebKitWebPage.
     68        * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h: Added.
     69        (_WebKitWebPage):
     70        (_WebKitWebPageClass):
     71        * WebProcess/InjectedBundle/API/gtk/WebKitWebPagePrivate.h: Added.
     72        * WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h: Added.
     73        * WebProcess/gtk/WebGtkExtensionManager.cpp: Added.
     74        (WebKit::WebGtkExtensionManager::shared): Return the global shared
     75        instance.
     76        (WebKit::WebGtkExtensionManager::WebGtkExtensionManager):
     77        (WebKit::WebGtkExtensionManager::appendModuleDirectories): Add
     78        directories to scan for modules.
     79        (WebKit::WebGtkExtensionManager::scanModules): Scan for modules.
     80        (WebKit::WebGtkExtensionManager::initialize): Load and initialize
     81        the modules found.
     82        * WebProcess/gtk/WebGtkExtensionManager.h: Added.
     83        * WebProcess/gtk/WebGtkInjectedBundleMain.cpp: Added.
     84        (WKBundleInitialize): Initialize WebGtkExtensionManager.
     85
    1862013-01-10  Huang Dongsung  <luxtella@company100.net>
    287
  • trunk/Source/WebKit2/GNUmakefile.am

    r139046 r139305  
    2424
    2525libwebkit2gtkinclude_HEADERS = \
    26         $(webkit2gtk_h_api)
     26        $(webkit2gtk_h_api) \
     27        $(webkit2_web_extension_h_api)
    2728
    2829nodist_libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOURCES = \
     
    8889        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API \
    8990        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API/c \
     91        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API/gtk \
    9092        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/DOM \
    9193        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/gtk \
     
    104106        -I$(srcdir)/Source/WebKit2/WebProcess/WebCoreSupport/soup \
    105107        -I$(srcdir)/Source/WebKit2/WebProcess/WebPage \
    106     -I$(srcdir)/Source/WebKit2/WebProcess/WebPage/atk \
     108        -I$(srcdir)/Source/WebKit2/WebProcess/WebPage/atk \
    107109        -I$(srcdir)/Source/WebKit2/WebProcess/WebPage/gtk \
    108110        -I$(top_builddir)/DerivedSources/WebKit2 \
     
    111113        -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \
    112114        -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/webkit2 \
     115        -I$(top_builddir)/DerivedSources/WebKit2/webkit2extension/include \
    113116        -I$(top_builddir)/DerivedSources/WebKit2/include/JavaScriptCore \
    114117        -I$(top_builddir)/DerivedSources/WebKit2/include/WebCore \
    115118        -I$(top_builddir)/DerivedSources/WebKit2/include/WebKit2 \
     119        -I$(top_builddir)/DerivedSources/webkitdom \
    116120        -DLIBEXECDIR=\""$(libexecdir)"\" \
     121        -DLIBDIR=\""$(libdir)"\" \
     122        -DBUILDING_WEBKIT \
    117123        -DWEBKIT2_COMPILATION \
    118124        -DENABLE_PLUGIN_PROCESS=1 \
     
    178184libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD += \
    179185        libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
     186        libWebCoreDOM.la \
    180187        libWebCoreGtk.la \
    181188        $(CAIRO_LIBS) \
     
    283290        && ln -n -s -f ${shell pwd}/$(WebKit2)/UIProcess/API/gtk $@
    284291
    285 BUILT_SOURCES += $(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2
     292$(GENSOURCES_WEBKIT2)/webkit2extension/include/webkit2: $(libwebkit2gtkinclude_HEADERS)
     293        $(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2extension/include \
     294        && ln -n -s -f ${shell pwd}/$(WebKit2)/WebProcess/InjectedBundle/API/gtk $@
     295
     296BUILT_SOURCES += \
     297        $(GENSOURCES_WEBKIT2)/webkit2extension/include/webkit2 \
     298        $(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2
    286299
    287300vpath %.messages.in = \
     
    478491        $(XRENDER_CFLAGS) \
    479492        $(XT_CFLAGS)
     493
     494# Injected Bundle
     495injectedbundledir = $(libdir)/webkit2gtk-3.0/injected-bundle
     496injectedbundle_LTLIBRARIES = libwebkit2gtkinjectedbundle.la
     497
     498libwebkit2gtkinjectedbundle_la_SOURCES = \
     499        Source/WebKit2/WebProcess/gtk/WebGtkInjectedBundleMain.cpp
     500
     501libwebkit2gtkinjectedbundle_la_LDFLAGS = \
     502        $(no_undefined) \
     503        -module \
     504        -avoid-version
     505
     506libwebkit2gtkinjectedbundle_la_CPPFLAGS = \
     507        -fno-strict-aliasing \
     508        -I$(srcdir)/Source/WebKit2/Platform \
     509        -I$(srcdir)/Source/WebKit2/Shared \
     510        -I$(srcdir)/Source/WebKit2/Shared/API/c \
     511        -I$(srcdir)/Source/WebKit2/UIProcess/API/C \
     512        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle \
     513        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API/c \
     514        -I$(top_builddir)/DerivedSources/InjectedBundle \
     515        -I$(top_builddir)/DerivedSources/WebKit2/include \
     516        $(global_cppflags) \
     517        $(javascriptcore_cppflags) \
     518        $(GLIB_CFLAGS)
    480519
    481520# Serialize linking of the plugin process with both webkit libraries.
  • trunk/Source/WebKit2/GNUmakefile.list.am

    r139184 r139305  
    132132        $(WebKit2)/UIProcess/API/gtk/WebKitWindowProperties.h \
    133133        $(WebKit2)/UIProcess/API/gtk/webkit2.h
     134
     135webkit2_web_extension_h_api += \
     136        $(WebKit2)/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h \
     137        $(WebKit2)/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionDefines.h \
     138        $(WebKit2)/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h \
     139        $(WebKit2)/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h
    134140
    135141webkit2_built_sources += \
     
    992998        Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp \
    993999        Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h \
     1000        Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.cpp \
     1001        Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.h \
    9941002        Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp \
    9951003        Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h \
     
    10341042        Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp \
    10351043        Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h \
     1044        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp \
     1045        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h \
     1046        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionPrivate.h \
     1047        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionDefines.h \
     1048        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp \
     1049        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h \
     1050        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPagePrivate.h \
     1051        Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h \
    10361052        Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp \
    10371053        Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h \
     
    11861202        Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp \
    11871203        Source/WebKit2/WebProcess/WebPage/TapHighlightController.h \
    1188     Source/WebKit2/WebProcess/WebPage/atk/WebPageAccessibilityObject.h \
    1189     Source/WebKit2/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp \
     1204        Source/WebKit2/WebProcess/WebPage/atk/WebPageAccessibilityObject.h \
     1205        Source/WebKit2/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp \
    11901206        Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp \
    11911207        Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp \
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp

    r138783 r139305  
    167167}
    168168
     169static CString injectedBundleDirectory()
     170{
     171    if (const char* bundleDirectory = g_getenv("WEBKIT_INJECTED_BUNDLE_PATH"))
     172        return bundleDirectory;
     173
     174    static const char* injectedBundlePath = LIBDIR""G_DIR_SEPARATOR_S"webkit2gtk-"WEBKITGTK_API_VERSION_STRING""G_DIR_SEPARATOR_S"injected-bundle"G_DIR_SEPARATOR_S;
     175    return injectedBundlePath;
     176}
     177
     178static CString injectedBundleFilename()
     179{
     180    GOwnPtr<char> bundleFilename(g_build_filename(injectedBundleDirectory().data(), "libwebkit2gtkinjectedbundle.so", NULL));
     181    return bundleFilename.get();
     182}
     183
    169184static gpointer createDefaultWebContext(gpointer)
    170185{
     
    172187    WebKitWebContextPrivate* priv = webContext->priv;
    173188
    174     priv->context = WebContext::create(String());
     189    priv->context = WebContext::create(WebCore::filenameToString(injectedBundleFilename().data()));
    175190    priv->requestManager = webContext->priv->context->supplement<WebSoupRequestManagerProxy>();
    176191    priv->context->setCacheModel(CacheModelPrimaryWebBrowser);
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp

    r138622 r139305  
    18461846
    18471847    getPage(webView)->loadURLRequest(WebURLRequest::create(webkitURIRequestGetResourceRequest(request)).leakRef());
     1848}
     1849
     1850/**
     1851 * webkit_web_view_get_page_id:
     1852 * @web_view: a #WebKitWebView
     1853 *
     1854 * Get the identifier of the #WebKitWebPage corresponding to
     1855 * the #WebKitWebView
     1856 *
     1857 * Returns: the page ID of @web_view.
     1858 */
     1859guint64 webkit_web_view_get_page_id(WebKitWebView* webView)
     1860{
     1861    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
     1862
     1863    return getPage(webView)->pageID();
    18481864}
    18491865
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h

    r138593 r139305  
    262262webkit_web_view_is_loading                           (WebKitWebView             *web_view);
    263263
     264WEBKIT_API guint64
     265webkit_web_view_get_page_id                          (WebKitWebView             *web_view);
     266
    264267WEBKIT_API const gchar *
    265268webkit_web_view_get_title                            (WebKitWebView             *web_view);
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml

    r137469 r139305  
    4444  </chapter>
    4545
     46  <chapter>
     47    <title>Web Extensions</title>
     48    <xi:include href="xml/WebKitWebExtension.xml"/>
     49    <xi:include href="xml/WebKitWebPage.xml"/>
     50  </chapter>
     51
    4652  <index id="index-all">
    4753    <title>Index</title>
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt

    r138593 r139305  
    9797webkit_web_view_go_forward
    9898webkit_web_view_get_title
     99webkit_web_view_get_page_id
    99100webkit_web_view_reload
    100101webkit_web_view_reload_bypass_cache
     
    928929webkit_security_manager_get_type
    929930</SECTION>
     931
     932<SECTION>
     933<FILE>WebKitWebExtension</FILE>
     934WebKitWebExtension
     935WebKitWebExtensionInitializeFunction
     936webkit_web_extension_get_page
     937
     938<SUBSECTION Standard>
     939WebKitWebExtensionClass
     940WEBKIT_TYPE_WEB_EXTENSION
     941WEBKIT_WEB_EXTENSION
     942WEBKIT_IS_WEB_EXTENSION
     943WEBKIT_WEB_EXTENSION_CLASS
     944WEBKIT_IS_WEB_EXTENSION_CLASS
     945WEBKIT_WEB_EXTENSION_GET_CLASS
     946
     947<SUBSECTION Private>
     948WebKitWebExtensionPrivate
     949webkit_web_extension_get_type
     950</SECTION>
     951
     952<SECTION>
     953<FILE>WebKitWebPage</FILE>
     954WebKitWebPage
     955webkit_web_page_get_dom_document
     956
     957<SUBSECTION Standard>
     958WebKitWebPageClass
     959WEBKIT_TYPE_WEB_PAGE
     960WEBKIT_WEB_PAGE
     961WEBKIT_IS_WEB_PAGE
     962WEBKIT_WEB_PAGE_CLASS
     963WEBKIT_IS_WEB_PAGE_CLASS
     964WEBKIT_WEB_PAGE_GET_CLASS
     965
     966<SUBSECTION Private>
     967WebKitWebPagePrivate
     968webkit_web_page_get_type
     969</SECTION>
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types

    r121093 r139305  
    2222webkit_context_menu_get_type
    2323webkit_context_menu_item_get_type
     24webkit_web_extension_get_type
     25webkit_web_page_get_type
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am

    r134600 r139305  
    1313        Programs/WebKit2APITests/TestResources \
    1414        Programs/WebKit2APITests/TestSSL \
     15        Programs/WebKit2APITests/TestWebExtensions \
    1516        Programs/WebKit2APITests/TestWebKitVersion \
    1617        Programs/WebKit2APITests/TestWebKitFaviconDatabase \
     
    3536        -DWEBKIT_DERIVED_SRC_DIR=\"${shell pwd}/${top_builddir}/DerivedSources\" \
    3637        -DWEBKIT_TEST_PLUGIN_DIR=\"${shell pwd}/${top_builddir}/TestNetscapePlugin/.libs\" \
     38        -DWEBKIT_TEST_WEB_EXTENSIONS_DIR=\"${shell pwd}/${top_builddir}/Libraries/WebExtensions/.libs\" \
     39        -DWEBKIT_INJECTED_BUNDLE_PATH=\"${shell pwd}/$(top_builddir)/.libs\" \
    3740        $(javascriptcore_cppflags) \
    3841        -I$(srcdir)/Source/JavaScriptCore \
     
    7174        Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp \
    7275        Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h \
     76        Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestBus.cpp \
     77        Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestBus.h \
    7378        Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp \
    7479        Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h \
     
    7984Libraries_libWebKit2APITestCore_la_CPPFLAGS = $(webkit2_tests_cppflags)
    8085
     86noinst_LTLIBRARIES += Libraries/WebExtensions/libWebExtensionTest.la
     87Libraries_WebExtensions_libWebExtensionTest_la_SOURCES = \
     88        Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp
     89
     90Libraries_WebExtensions_libWebExtensionTest_la_LDFLAGS = \
     91        -rpath ${shell pwd}/$(top_builddir)/Libraries/WebExtensions/.libs \
     92        $(no_undefined) \
     93        -avoid-version \
     94        -module
     95
     96Libraries_WebExtensions_libWebExtensionTest_la_CPPFLAGS = \
     97        -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API/gtk \
     98        -I$(top_builddir)/DerivedSources \
     99        -I$(top_builddir)/DerivedSources/WebKit2/webkit2extension/include \
     100        -DWEBKIT2_COMPILATION \
     101        $(webkit2_tests_cppflags)
     102
     103Libraries_WebExtensions_libWebExtensionTest_la_CXXFLAGS = \
     104        $(global_cxxflags)
     105
     106Libraries_WebExtensions_libWebExtensionTest_la_CFLAGS = \
     107        $(global_cflags)
     108
     109
    81110EXTRA_DIST += \
    82111        Source/WebKit2/UIProcess/API/gtk/tests/resources/test-cert.pem \
     
    215244Programs_WebKit2APITests_TestSSL_LDFLAGS = $(webkit2_tests_ldflags)
    216245
     246Programs_WebKit2APITests_TestWebExtensions_SOURCES = \
     247        Source/WebKit2/UIProcess/API/gtk/tests/TestWebExtensions.cpp
     248Programs_WebKit2APITests_TestWebExtensions_CPPFLAGS = $(webkit2_tests_cppflags)
     249Programs_WebKit2APITests_TestWebExtensions_LDADD = $(webkit2_tests_ldadd)
     250Programs_WebKit2APITests_TestWebExtensions_LDFLAGS = $(webkit2_tests_ldflags)
     251
    217252endif # ENABLE_WEBKIT2
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp

    r132870 r139305  
    4040    gtk_test_init(&argc, &argv, 0);
    4141    g_setenv("WEBKIT_EXEC_PATH", WEBKIT_EXEC_PATH, FALSE);
     42    g_setenv("WEBKIT_INJECTED_BUNDLE_PATH", WEBKIT_INJECTED_BUNDLE_PATH, FALSE);
    4243    g_test_bug_base("https://bugs.webkit.org/");
    4344
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestBus.h

    r139304 r139305  
    11/*
    2  * Copyright (C) 2011 Igalia S.L.
     2 * Copyright (C) 2012 Igalia S.L.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    1818 */
    1919
    20 #include "config.h"
    21 #include "TestMain.h"
     20#ifndef WebKitTestBus_h
     21#define WebKitTestBus_h
    2222
    23 #include <gtk/gtk.h>
     23#include <gio/gio.h>
     24#include <wtf/gobject/GRefPtr.h>
     25#include <wtf/text/CString.h>
    2426
    25 void beforeAll();
    26 void afterAll();
     27class WebKitTestBus {
     28public:
     29    WebKitTestBus();
     30    virtual ~WebKitTestBus();
    2731
    28 static void registerGResource(void)
    29 {
    30     GOwnPtr<char> resourcesPath(g_build_filename(WEBKIT_EXEC_PATH, "resources", "webkit2gtk-tests-resources.gresource", NULL));
    31     GResource* resource = g_resource_load(resourcesPath.get(), 0);
    32     g_assert(resource);
     32    bool run();
     33    GDBusProxy* createProxy(const char* serviceName, const char* objectPath, const char* interfaceName, GMainLoop*);
    3334
    34     g_resources_register(resource);
    35     g_resource_unref(resource);
    36 }
     35private:
     36    GDBusConnection* connection();
    3737
    38 int main(int argc, char** argv)
    39 {
    40     gtk_test_init(&argc, &argv, 0);
    41     g_setenv("WEBKIT_EXEC_PATH", WEBKIT_EXEC_PATH, FALSE);
    42     g_test_bug_base("https://bugs.webkit.org/");
     38    pid_t m_pid;
     39    CString m_address;
     40    GRefPtr<GDBusConnection> m_connection;
     41};
    4342
    44     registerGResource();
    45 
    46     beforeAll();
    47     int returnValue = g_test_run();
    48     afterAll();
    49 
    50     return returnValue;
    51 }
     43#endif // WebKitTestBus_h
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionPrivate.h

    r139304 r139305  
    11/*
    2  * Copyright (C) 2011 Igalia S.L.
     2 * Copyright (C) 2012 Igalia S.L.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    1818 */
    1919
    20 #include "config.h"
    21 #include "TestMain.h"
     20#ifndef WebKitWebExtensionPrivate_h
     21#define WebKitWebExtensionPrivate_h
    2222
    23 #include <gtk/gtk.h>
     23#include "InjectedBundle.h"
     24#include "WebKitWebExtension.h"
    2425
    25 void beforeAll();
    26 void afterAll();
     26WebKitWebExtension* webkitWebExtensionCreate(WebKit::InjectedBundle*);
    2727
    28 static void registerGResource(void)
    29 {
    30     GOwnPtr<char> resourcesPath(g_build_filename(WEBKIT_EXEC_PATH, "resources", "webkit2gtk-tests-resources.gresource", NULL));
    31     GResource* resource = g_resource_load(resourcesPath.get(), 0);
    32     g_assert(resource);
    33 
    34     g_resources_register(resource);
    35     g_resource_unref(resource);
    36 }
    37 
    38 int main(int argc, char** argv)
    39 {
    40     gtk_test_init(&argc, &argv, 0);
    41     g_setenv("WEBKIT_EXEC_PATH", WEBKIT_EXEC_PATH, FALSE);
    42     g_test_bug_base("https://bugs.webkit.org/");
    43 
    44     registerGResource();
    45 
    46     beforeAll();
    47     int returnValue = g_test_run();
    48     afterAll();
    49 
    50     return returnValue;
    51 }
     28#endif // WebKitWebExtensionPrivate_h
  • trunk/Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.h

    r139304 r139305  
    11/*
    2  * Copyright (C) 2011 Igalia S.L.
     2 * Copyright (C) 2012 Igalia S.L.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    1818 */
    1919
    20 #include "config.h"
    21 #include "TestMain.h"
     20#ifndef WebGtkExtensionManager_h
     21#define WebGtkExtensionManager_h
    2222
    23 #include <gtk/gtk.h>
     23#include "Module.h"
     24#include "WKBundle.h"
     25#include <wtf/Noncopyable.h>
     26#include <wtf/Vector.h>
     27#include <wtf/gobject/GRefPtr.h>
    2428
    25 void beforeAll();
    26 void afterAll();
     29typedef struct _WebKitWebExtension WebKitWebExtension;
    2730
    28 static void registerGResource(void)
    29 {
    30     GOwnPtr<char> resourcesPath(g_build_filename(WEBKIT_EXEC_PATH, "resources", "webkit2gtk-tests-resources.gresource", NULL));
    31     GResource* resource = g_resource_load(resourcesPath.get(), 0);
    32     g_assert(resource);
    33 
    34     g_resources_register(resource);
    35     g_resource_unref(resource);
     31namespace WTF {
     32class String;
    3633}
    3734
    38 int main(int argc, char** argv)
    39 {
    40     gtk_test_init(&argc, &argv, 0);
    41     g_setenv("WEBKIT_EXEC_PATH", WEBKIT_EXEC_PATH, FALSE);
    42     g_test_bug_base("https://bugs.webkit.org/");
     35namespace WebKit {
    4336
    44     registerGResource();
     37class WebGtkExtensionManager {
     38    WTF_MAKE_NONCOPYABLE(WebGtkExtensionManager);
    4539
    46     beforeAll();
    47     int returnValue = g_test_run();
    48     afterAll();
     40public:
     41    static WebGtkExtensionManager& shared();
    4942
    50     return returnValue;
    51 }
     43    void initialize(WKBundleRef);
     44
     45private:
     46    WebGtkExtensionManager();
     47
     48    void appendModuleDirectories(Vector<String>&);
     49    void scanModules(Vector<String>&);
     50
     51    Vector<Module*> m_extensionModules;
     52    GRefPtr<WebKitWebExtension> m_extension;
     53};
     54
     55} // namespace WebKit
     56
     57#endif // WebGtkExtensionManager_h
  • trunk/Source/WebKit2/WebProcess/gtk/WebGtkInjectedBundleMain.cpp

    r139304 r139305  
    11/*
    2  * Copyright (C) 2011 Igalia S.L.
     2 * Copyright (C) 2013 Igalia S.L.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    1919
    2020#include "config.h"
    21 #include "TestMain.h"
    2221
    23 #include <gtk/gtk.h>
     22#include "WebGtkExtensionManager.h"
     23#include <WebKit2/WKBundleInitialize.h>
    2424
    25 void beforeAll();
    26 void afterAll();
     25using namespace WebKit;
    2726
    28 static void registerGResource(void)
     27#if defined(WIN32) || defined(_WIN32)
     28extern "C" __declspec(dllexport)
     29#else
     30extern "C"
     31#endif
     32void WKBundleInitialize(WKBundleRef bundle, WKTypeRef)
    2933{
    30     GOwnPtr<char> resourcesPath(g_build_filename(WEBKIT_EXEC_PATH, "resources", "webkit2gtk-tests-resources.gresource", NULL));
    31     GResource* resource = g_resource_load(resourcesPath.get(), 0);
    32     g_assert(resource);
    33 
    34     g_resources_register(resource);
    35     g_resource_unref(resource);
     34    WebGtkExtensionManager::shared().initialize(bundle);
    3635}
    37 
    38 int main(int argc, char** argv)
    39 {
    40     gtk_test_init(&argc, &argv, 0);
    41     g_setenv("WEBKIT_EXEC_PATH", WEBKIT_EXEC_PATH, FALSE);
    42     g_test_bug_base("https://bugs.webkit.org/");
    43 
    44     registerGResource();
    45 
    46     beforeAll();
    47     int returnValue = g_test_run();
    48     afterAll();
    49 
    50     return returnValue;
    51 }
  • trunk/Source/autotools/symbols.filter

    r139269 r139305  
    238238_ZN7WebCore28DocumentStyleSheetCollection14addAuthorSheetEN3WTF10PassRefPtrINS_18StyleSheetContentsEEE;
    239239_ZN7WebCore4KURL10invalidateEv;
     240_ZN6WebKit22WebGtkExtensionManager10initializeEPK14OpaqueWKBundle;
     241_ZN6WebKit22WebGtkExtensionManager6sharedEv;
    240242
    241243local:
  • trunk/Tools/ChangeLog

    r139303 r139305  
     12013-01-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Add support for loading web process extensions
     4        https://bugs.webkit.org/show_bug.cgi?id=105631
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        * MiniBrowser/gtk/GNUmakefile.am:
     9        * MiniBrowser/gtk/main.c:
     10        (main): Set WEBKIT_INJECTED_BUNDLE env var to use the injected
     11        bundle lib from build dir.
     12        * Scripts/webkitpy/style/checker.py: Add exceptions for GTK+ API
     13        located in WebProcess/InjectedBundle/API/gtk.
     14        * gtk/generate-gtkdoc:
     15        (get_webkit2_options): Scan also files in
     16        WebProcess/InjectedBundle/API/gtk to generate API docs.
     17        (get_webkit2_options.injected_bundle_src_path): Helper function to
     18        build paths in WebProcess/InjectedBundle/API/gtk.
     19
    1202013-01-10  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
    221
  • trunk/Tools/MiniBrowser/gtk/GNUmakefile.am

    r115301 r139305  
    1010        -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \
    1111        -DWEBKIT_EXEC_PATH=\"${shell pwd}/$(top_builddir)/Programs/\" \
     12        -DWEBKIT_INJECTED_BUNDLE_PATH=\"${shell pwd}/$(top_builddir)/.libs\" \
    1213        $(global_cppflags) \
    1314        $(javascriptcore_cppflags) \
  • trunk/Tools/MiniBrowser/gtk/main.c

    r131072 r139305  
    227227    g_setenv("WEBKIT_INSPECTOR_PATH", WEBKIT_EXEC_PATH "resources/inspector", FALSE);
    228228#endif /* WEBKIT_EXEC_PATH */
     229    g_setenv("WEBKIT_INJECTED_BUNDLE_PATH", WEBKIT_INJECTED_BUNDLE_PATH, FALSE);
    229230
    230231    // Enable the favicon database, by specifying the default directory.
  • trunk/Tools/Scripts/webkitpy/style/checker.py

    r137450 r139305  
    181181    ([# The GTK+ API use upper case, underscore separated, words in
    182182      # certain types of enums (e.g. signals, properties).
    183       "Source/WebKit2/UIProcess/API/gtk"],
     183      "Source/WebKit2/UIProcess/API/gtk",
     184      "Source/WebKit2/WebProcess/InjectedBundle/API/gtk"],
    184185     ["-readability/enum_casing"]),
    185186
     
    330331    # which differ greatly from WebKit coding style.
    331332    re.compile(r'Source/WebKit2/UIProcess/API/gtk/WebKit(?!.*Private\.h).*\.h$'),
    332     'Source/WebKit2/UIProcess/API/gtk/webkit2.h']
     333    re.compile(r'Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKit(?!.*Private\.h).*\.h$'),
     334    'Source/WebKit2/UIProcess/API/gtk/webkit2.h',
     335    'Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h']
    333336
    334337# Files to skip that are more common or obvious.
  • trunk/Tools/gtk/generate-gtkdoc

    r139048 r139305  
    7878    def src_path(*args):
    7979        return common.top_level_path(*(('Source', 'WebKit2', 'UIProcess', 'API', 'gtk') + args))
     80    def injected_bundle_src_path(*args):
     81        return common.top_level_path(*(('Source', 'WebKit2', 'WebProcess', 'InjectedBundle', 'API', 'gtk') + args))
    8082
    8183    xref_deps = get_common_xref_deps().copy()
     
    8991        'doc_dir' : src_path('docs'),
    9092        'output_dir' : common.build_path('Documentation', 'webkit2gtk'),
    91         'source_dirs' : [src_path(), derived_sources_path('webkit2gtk', 'webkit2')],
     93        'source_dirs' : [src_path(), derived_sources_path('webkit2gtk', 'webkit2'), injected_bundle_src_path()],
    9294        'cflags' : ' -I' + derived_sources_path('webkit2gtk', 'include') + \
    9395                   ' -I' + derived_sources_path('webkit2gtk') + \
     
    9799        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps),
    98100        'ignored_files': glob.glob(src_path('*Private.h')) + \
     101                         glob.glob(injected_bundle_src_path('*Private.h')) + \
    99102                         glob.glob(src_path('*Client*')) + \
    100103                         glob.glob(src_path('WebKit2GtkAuthenticationDialog.*')) + \
Note: See TracChangeset for help on using the changeset viewer.