1 | /* |
2 | * Copyright (C) 2014 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 Library General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 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(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) |
21 | #error "Only <webkit2/webkit2.h> can be included directly." |
22 | #endif |
23 | |
24 | #ifndef WebKitUserContent_h |
25 | #define WebKitUserContent_h |
26 | |
27 | #include <glib-object.h> |
28 | #include <webkit2/WebKitDefines.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | /** |
33 | * WebKitUserContentInjectedFrames: |
34 | * @WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES: Insert the user style |
35 | * sheet in all the frames loaded by the web view, including |
36 | * nested frames. This is the default. |
37 | * @WEBKIT_USER_CONTENT_INJECT_TOP_FRAME: Insert the user style |
38 | * sheet *only* in the top-level frame loaded by the web view, |
39 | * and *not* in the nested frames. |
40 | * |
41 | * Specifies in which frames user style sheets are to be inserted in. |
42 | * |
43 | * Since: 2.6 |
44 | */ |
45 | typedef enum { |
46 | WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, |
47 | WEBKIT_USER_CONTENT_INJECT_TOP_FRAME, |
48 | } WebKitUserContentInjectedFrames; |
49 | |
50 | /** |
51 | * WebKitUserStyleLevel: |
52 | * @WEBKIT_USER_STYLE_LEVEL_USER: The style sheet is an user style sheet, |
53 | * its contents always override other style sheets. This is the default. |
54 | * @WEBKIT_USER_STYLE_LEVEL_AUTHOR: The style sheet will be treated as if |
55 | * it was provided by the loaded documents. That means other user style |
56 | * sheets may still override it. |
57 | * |
58 | * Specifies how to treat an user style sheet. |
59 | * |
60 | * Since: 2.6 |
61 | */ |
62 | typedef enum { |
63 | WEBKIT_USER_STYLE_LEVEL_USER, |
64 | WEBKIT_USER_STYLE_LEVEL_AUTHOR, |
65 | } WebKitUserStyleLevel; |
66 | |
67 | #define WEBKIT_TYPE_USER_STYLE_SHEET (webkit_user_style_sheet_get_type()) |
68 | |
69 | typedef struct _WebKitUserStyleSheet WebKitUserStyleSheet; |
70 | |
71 | WEBKIT_API GType |
72 | webkit_user_style_sheet_get_type (void); |
73 | |
74 | WEBKIT_API WebKitUserStyleSheet * |
75 | webkit_user_style_sheet_ref (WebKitUserStyleSheet *user_style_sheet); |
76 | |
77 | WEBKIT_API void |
78 | webkit_user_style_sheet_unref (WebKitUserStyleSheet *user_style_sheet); |
79 | |
80 | WEBKIT_API WebKitUserStyleSheet * |
81 | webkit_user_style_sheet_new (const gchar *source, |
82 | WebKitUserContentInjectedFrames injected_frames, |
83 | WebKitUserStyleLevel level, |
84 | const gchar* const *whitelist, |
85 | const gchar* const *blacklist); |
86 | |
87 | WEBKIT_API WebKitUserStyleSheet * |
88 | webkit_user_style_sheet_new_for_world (const gchar *source, |
89 | WebKitUserContentInjectedFrames injected_frames, |
90 | WebKitUserStyleLevel level, |
91 | const gchar *world_name, |
92 | const gchar* const *whitelist, |
93 | const gchar* const *blacklist); |
94 | |
95 | /** |
96 | * WebKitUserScriptInjectionTime: |
97 | * @WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START: Insert the code of the user |
98 | * script at the beginning of loaded documents. This is the default. |
99 | * @WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END: Insert the code of the user |
100 | * script at the end of the loaded documents. |
101 | * |
102 | * Specifies at which place of documents an user script will be inserted. |
103 | * |
104 | * Since: 2.6 |
105 | */ |
106 | typedef enum { |
107 | WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START, |
108 | WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END, |
109 | } WebKitUserScriptInjectionTime; |
110 | |
111 | #define WEBKIT_TYPE_USER_SCRIPT (webkit_user_script_get_type()) |
112 | |
113 | typedef struct _WebKitUserScript WebKitUserScript; |
114 | |
115 | WEBKIT_API GType |
116 | webkit_user_script_get_type (void); |
117 | |
118 | WEBKIT_API WebKitUserScript * |
119 | webkit_user_script_ref (WebKitUserScript *user_script); |
120 | |
121 | WEBKIT_API void |
122 | webkit_user_script_unref (WebKitUserScript *user_script); |
123 | |
124 | WEBKIT_API WebKitUserScript * |
125 | webkit_user_script_new (const gchar *source, |
126 | WebKitUserContentInjectedFrames injected_frames, |
127 | WebKitUserScriptInjectionTime injection_time, |
128 | const gchar* const *whitelist, |
129 | const gchar* const *blacklist); |
130 | |
131 | WEBKIT_API WebKitUserScript * |
132 | webkit_user_script_new_for_world (const gchar *source, |
133 | WebKitUserContentInjectedFrames injected_frames, |
134 | WebKitUserScriptInjectionTime injection_time, |
135 | const gchar *world_name, |
136 | const gchar* const *whitelist, |
137 | const gchar* const *blacklist); |
138 | |
139 | #define WEBKIT_TYPE_USER_CONTENT_FILTER (webkit_user_content_filter_get_type()) |
140 | |
141 | typedef struct _WebKitUserContentFilter WebKitUserContentFilter; |
142 | |
143 | WEBKIT_API GType |
144 | webkit_user_content_filter_get_type (void); |
145 | |
146 | WEBKIT_API const char* |
147 | webkit_user_content_filter_get_identifier (WebKitUserContentFilter *user_content_filter); |
148 | |
149 | WEBKIT_API WebKitUserContentFilter * |
150 | webkit_user_content_filter_ref (WebKitUserContentFilter *user_content_filter); |
151 | |
152 | WEBKIT_API void |
153 | webkit_user_content_filter_unref (WebKitUserContentFilter *user_content_filter); |
154 | |
155 | G_END_DECLS |
156 | |
157 | #endif |
158 | |