1/*
2 * Copyright (C) 2012 Igalia S.L.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2,1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB.  If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
21#error "Only <webkit2/webkit-web-extension.h> can be included directly."
22#endif
23
24#ifndef WebKitWebExtension_h
25#define WebKitWebExtension_h
26
27#include <glib-object.h>
28#include <webkit2/WebKitDefines.h>
29#include <webkit2/WebKitWebPage.h>
30
31G_BEGIN_DECLS
32
33#define WEBKIT_TYPE_WEB_EXTENSION            (webkit_web_extension_get_type())
34#define WEBKIT_WEB_EXTENSION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_EXTENSION, WebKitWebExtension))
35#define WEBKIT_IS_WEB_EXTENSION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_EXTENSION))
36#define WEBKIT_WEB_EXTENSION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEB_EXTENSION, WebKitWebExtensionClass))
37#define WEBKIT_IS_WEB_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEB_EXTENSION))
38#define WEBKIT_WEB_EXTENSION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEB_EXTENSION, WebKitWebExtensionClass))
39
40typedef struct _WebKitWebExtension        WebKitWebExtension;
41typedef struct _WebKitWebExtensionClass   WebKitWebExtensionClass;
42typedef struct _WebKitWebExtensionPrivate WebKitWebExtensionPrivate;
43
44/**
45 * WebKitWebExtensionInitializeFunction:
46 * @extension: a #WebKitWebExtension
47 *
48 * Type definition for a function that will be called to initialize
49 * the web extension when the web process starts.
50 */
51typedef void (* WebKitWebExtensionInitializeFunction) (WebKitWebExtension *extension);
52
53/**
54 * WebKitWebExtensionInitializeWithUserDataFunction:
55 * @extension: a #WebKitWebExtension
56 * @user_data: a #GVariant
57 *
58 * Type definition for a function that will be called to initialize
59 * the web extensions when the web process starts, and which receives
60 * as additional argument the user data set with
61 * webkit_web_context_set_web_extensions_initialization_user_data().
62 *
63 * Since: 2.4
64 */
65typedef void (* WebKitWebExtensionInitializeWithUserDataFunction) (WebKitWebExtension *extension,
66                                                                   const GVariant     *user_data);
67
68struct _WebKitWebExtension {
69    GObject parent;
70
71    WebKitWebExtensionPrivate *priv;
72};
73
74struct _WebKitWebExtensionClass {
75    GObjectClass parent_class;
76};
77
78WEBKIT_API GType
79webkit_web_extension_get_type (void);
80
81WEBKIT_API WebKitWebPage *
82webkit_web_extension_get_page (WebKitWebExtension *extension,
83                               guint64             page_id);
84
85G_END_DECLS
86
87#endif
88