1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
/*
* Copyright (C) 2007 Holger Hans Peter Freyther
* Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
* Copyright (C) 2008 Collabora Ltd.
*
* 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 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.
*/
#ifndef webkitwebview_h
#define webkitwebview_h
#include <gtk/gtk.h>
#include <libsoup/soup.h>
#include <JavaScriptCore/JSBase.h>
#include <webkit/webkitdefines.h>
#include <webkit/webkitdom.h>
#include <webkit/webkitwebbackforwardlist.h>
#include <webkit/webkitwebframe.h>
#include <webkit/webkitwebhistoryitem.h>
#include <webkit/webkitwebsettings.h>
G_BEGIN_DECLS
#define WEBKIT_TYPE_WEB_VIEW (webkit_web_view_get_type())
#define WEBKIT_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebView))
#define WEBKIT_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewClass))
#define WEBKIT_IS_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_VIEW))
#define WEBKIT_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_VIEW))
#define WEBKIT_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewClass))
typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate;
typedef enum {
WEBKIT_NAVIGATION_RESPONSE_ACCEPT,
WEBKIT_NAVIGATION_RESPONSE_IGNORE,
WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD
} WebKitNavigationResponse;
typedef enum {
WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER = 1,
WEBKIT_CACHE_MODEL_WEB_BROWSER
} WebKitCacheModel;
typedef enum
{
WEBKIT_WEB_VIEW_TARGET_INFO_HTML,
WEBKIT_WEB_VIEW_TARGET_INFO_TEXT,
WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE,
WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST,
WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL
} WebKitWebViewTargetInfo;
struct _WebKitWebView {
GtkContainer parent_instance;
/*< private >*/
WebKitWebViewPrivate *priv;
};
struct _WebKitWebViewClass {
GtkContainerClass parent_class;
/*< public >*/
/*
* default handler/virtual methods
*/
WebKitWebView * (* create_web_view) (WebKitWebView *web_view,
WebKitWebFrame *web_frame);
gboolean (* web_view_ready) (WebKitWebView* web_view);
gboolean (* close_web_view) (WebKitWebView* web_view);
WebKitNavigationResponse (* navigation_requested) (WebKitWebView *web_view,
WebKitWebFrame *frame,
WebKitNetworkRequest *request);
void (* window_object_cleared) (WebKitWebView *web_view,
WebKitWebFrame *frame,
JSGlobalContextRef context,
JSObjectRef window_object);
gchar * (* choose_file) (WebKitWebView *web_view,
WebKitWebFrame *frame,
const gchar *old_file);
gboolean (* script_alert) (WebKitWebView *web_view,
WebKitWebFrame *frame,
const gchar *alert_message);
gboolean (* script_confirm) (WebKitWebView *web_view,
WebKitWebFrame *frame,
const gchar *confirm_message,
gboolean *did_confirm);
gboolean (* script_prompt) (WebKitWebView *web_view,
WebKitWebFrame *frame,
const gchar *message,
const gchar *default_value,
gchar* *value);
gboolean (* console_message) (WebKitWebView *web_view,
const gchar *message,
guint line_number,
const gchar* source_id);
void (* select_all) (WebKitWebView *web_view);
void (* cut_clipboard) (WebKitWebView *web_view);
void (* copy_clipboard) (WebKitWebView *web_view);
void (* paste_clipboard) (WebKitWebView *web_view);
gboolean (* move_cursor) (WebKitWebView *web_view,
GtkMovementStep step,
gint count);
/*
* internal
*/
void (* set_scroll_adjustments) (WebKitWebView *web_view,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
void (* undo) (WebKitWebView *web_view);
void (* redo) (WebKitWebView *web_view);
/* Padding for future expansion */
void (*_webkit_reserved0) (void);
void (*_webkit_reserved1) (void);
void (*_webkit_reserved2) (void);
void (*_webkit_reserved3) (void);
};
WEBKIT_API GType
webkit_web_view_get_type (void);
WEBKIT_API GtkWidget *
webkit_web_view_new (void);
WEBKIT_API G_CONST_RETURN gchar *
webkit_web_view_get_title (WebKitWebView *web_view);
WEBKIT_API G_CONST_RETURN gchar *
webkit_web_view_get_uri (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_set_maintains_back_forward_list (WebKitWebView *web_view,
gboolean flag);
WEBKIT_API WebKitWebBackForwardList *
webkit_web_view_get_back_forward_list (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_go_to_back_forward_item (WebKitWebView *web_view,
WebKitWebHistoryItem *item);
WEBKIT_API gboolean
webkit_web_view_can_go_back (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_can_go_back_or_forward (WebKitWebView *web_view,
gint steps);
WEBKIT_API gboolean
webkit_web_view_can_go_forward (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_go_back (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_go_back_or_forward (WebKitWebView *web_view,
gint steps);
WEBKIT_API void
webkit_web_view_go_forward (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_stop_loading (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_open (WebKitWebView *web_view,
const gchar *uri);
WEBKIT_API void
webkit_web_view_reload (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_reload_bypass_cache (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_load_uri (WebKitWebView *web_view,
const gchar *uri);
WEBKIT_API void
webkit_web_view_load_string (WebKitWebView *web_view,
const gchar *content,
const gchar *mime_type,
const gchar *encoding,
const gchar *base_uri);
WEBKIT_API void
webkit_web_view_load_html_string (WebKitWebView *web_view,
const gchar *content,
const gchar *base_uri);
WEBKIT_API void
webkit_web_view_load_request (WebKitWebView *web_view,
WebKitNetworkRequest *request);
WEBKIT_API gboolean
webkit_web_view_search_text (WebKitWebView *web_view,
const gchar *text,
gboolean case_sensitive,
gboolean forward,
gboolean wrap);
WEBKIT_API guint
webkit_web_view_mark_text_matches (WebKitWebView *web_view,
const gchar *string,
gboolean case_sensitive,
guint limit);
WEBKIT_API void
webkit_web_view_set_highlight_text_matches (WebKitWebView *web_view,
gboolean highlight);
WEBKIT_API void
webkit_web_view_unmark_text_matches (WebKitWebView *web_view);
WEBKIT_API WebKitWebFrame *
webkit_web_view_get_main_frame (WebKitWebView *web_view);
WEBKIT_API WebKitWebFrame *
webkit_web_view_get_focused_frame (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_execute_script (WebKitWebView *web_view,
const gchar *script);
WEBKIT_API gboolean
webkit_web_view_can_cut_clipboard (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_can_copy_clipboard (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_can_paste_clipboard (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_cut_clipboard (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_copy_clipboard (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_paste_clipboard (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_delete_selection (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_has_selection (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_select_all (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_get_editable (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_set_editable (WebKitWebView *web_view,
gboolean flag);
WEBKIT_API GtkTargetList *
webkit_web_view_get_copy_target_list (WebKitWebView *web_view);
WEBKIT_API GtkTargetList *
webkit_web_view_get_paste_target_list (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_set_settings (WebKitWebView *web_view,
WebKitWebSettings *settings);
WEBKIT_API WebKitWebSettings *
webkit_web_view_get_settings (WebKitWebView *web_view);
WEBKIT_API WebKitWebInspector *
webkit_web_view_get_inspector (WebKitWebView *web_view);
WEBKIT_API WebKitWebWindowFeatures*
webkit_web_view_get_window_features (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_can_show_mime_type (WebKitWebView *web_view,
const gchar *mime_type);
WEBKIT_API gboolean
webkit_web_view_get_transparent (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_set_transparent (WebKitWebView *web_view,
gboolean flag);
WEBKIT_API gfloat
webkit_web_view_get_zoom_level (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_set_zoom_level (WebKitWebView *web_view,
gfloat zoom_level);
WEBKIT_API void
webkit_web_view_zoom_in (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_zoom_out (WebKitWebView *web_view);
WEBKIT_API gboolean
webkit_web_view_get_full_content_zoom (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_set_full_content_zoom (WebKitWebView *web_view,
gboolean full_content_zoom);
WEBKIT_API SoupSession*
webkit_get_default_session (void);
WEBKIT_API const gchar*
webkit_web_view_get_encoding (WebKitWebView * webView);
WEBKIT_API void
webkit_web_view_set_custom_encoding (WebKitWebView * webView,
const gchar * encoding);
WEBKIT_API const char*
webkit_web_view_get_custom_encoding (WebKitWebView * webView);
WEBKIT_API void
webkit_web_view_move_cursor (WebKitWebView * webView,
GtkMovementStep step,
gint count);
WEBKIT_API WebKitLoadStatus
webkit_web_view_get_load_status (WebKitWebView *web_view);
WEBKIT_API gdouble
webkit_web_view_get_progress (WebKitWebView *web_view);
WEBKIT_API void
webkit_web_view_undo (WebKitWebView *webView);
WEBKIT_API gboolean
webkit_web_view_can_undo (WebKitWebView *webView);
WEBKIT_API void
webkit_web_view_redo (WebKitWebView *webView);
WEBKIT_API gboolean
webkit_web_view_can_redo (WebKitWebView *webView);
WEBKIT_API void
webkit_web_view_set_view_source_mode (WebKitWebView *web_view,
gboolean view_source_mode);
WEBKIT_API gboolean
webkit_web_view_get_view_source_mode (WebKitWebView *web_view);
WEBKIT_API WebKitHitTestResult*
webkit_web_view_get_hit_test_result (WebKitWebView *webView,
GdkEventButton *event);
WEBKIT_API G_CONST_RETURN gchar *
webkit_web_view_get_icon_uri (WebKitWebView *webView);
WEBKIT_API void
webkit_set_cache_model (WebKitCacheModel cache_model);
WEBKIT_API WebKitCacheModel
webkit_get_cache_model (void);
WEBKIT_API WebKitDOMDocument *
webkit_web_view_get_dom_document (WebKitWebView *webView);
G_END_DECLS
#endif
|