-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWebKit2-4.0.d.ts
9526 lines (9130 loc) · 370 KB
/
WebKit2-4.0.d.ts
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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/** Generated with https://github.com/Gr3q/GIR2TS - If possible do not modify. */
declare namespace imports.gi.WebKit2 {
/** This construct is only for enabling class multi-inheritance,
* use {@link AuthenticationRequest} instead.
*/
interface IAuthenticationRequest {
/**
* Authenticate the #WebKitAuthenticationRequest using the #WebKitCredential
* supplied. To continue without credentials, pass %NULL as #credential.
* @param credential A #WebKitCredential, or %NULL
*/
authenticate(credential?: Credential | null): void;
/**
* Determine whether the authentication method associated with this
* #WebKitAuthenticationRequest should allow the storage of credentials.
* This will return %FALSE if WebKit doesn't support credential storing,
* if private browsing is enabled, or if persistent credential storage has been
* disabled in #WebKitWebsiteDataManager, unless credentials saving has been
* explicitly enabled with {@link Webkit.authentication_request_set_can_save_credentials}.
* @returns %TRUE if WebKit can store credentials or %FALSE otherwise.
*/
can_save_credentials(): boolean;
/**
* Cancel the authentication challenge. This will also cancel the page loading and result in a
* #WebKitWebView::load-failed signal with a #WebKitNetworkError of type %WEBKIT_NETWORK_ERROR_CANCELLED being emitted.
*/
cancel(): void;
/**
* Get the host that this authentication challenge is applicable to.
* @returns The host of #request.
*/
get_host(): string;
/**
* Get the port that this authentication challenge is applicable to.
* @returns The port of #request.
*/
get_port(): number;
/**
* Get the #WebKitCredential of the proposed authentication challenge that was
* stored from a previous session. The client can use this directly for
* authentication or construct their own #WebKitCredential.
* @returns A #WebKitCredential encapsulating credential details
* or %NULL if there is no stored credential.
*/
get_proposed_credential(): Credential;
/**
* Get the realm that this authentication challenge is applicable to.
* @returns The realm of #request.
*/
get_realm(): string;
/**
* Get the authentication scheme of the authentication challenge.
* @returns The #WebKitAuthenticationScheme of #request.
*/
get_scheme(): AuthenticationScheme;
/**
* Get the #WebKitSecurityOrigin that this authentication challenge is applicable to.
* @returns a newly created #WebKitSecurityOrigin.
*/
get_security_origin(): SecurityOrigin;
/**
* Determine whether the authentication challenge is associated with a proxy server rather than an "origin" server.
* @returns %TRUE if authentication is for a proxy or %FALSE otherwise.
*/
is_for_proxy(): boolean;
/**
* Determine whether this this is a first attempt or a retry for this authentication challenge.
* @returns %TRUE if authentication attempt is a retry or %FALSE otherwise.
*/
is_retry(): boolean;
/**
* Set whether the authentication method associated with #request
* should allow the storage of credentials.
* This should be used by applications handling their own credentials
* storage to indicate that it should be supported even when internal
* credential storage is disabled or unsupported.
* Note that storing of credentials will not be allowed on ephemeral
* sessions in any case.
* @param enabled value to set
*/
set_can_save_credentials(enabled: boolean): void;
/**
* Set the #WebKitCredential of the proposed authentication challenge that was
* stored from a previous session. This should only be used by applications handling
* their own credential storage. (When using the default WebKit credential storage,
* {@link Webkit.authentication_request_get_proposed_credential} already contains previously-stored
* credentials.)
* Passing a %NULL #credential will clear the proposed credential.
* @param credential a #WebKitCredential, or %NULL
*/
set_proposed_credential(credential: Credential): void;
/**
* This signal is emitted when the user authentication request succeeded.
* Applications handling their own credential storage should connect to
* this signal to save the credentials.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
* - credential: the #WebKitCredential accepted
*
* @returns Callback ID
*/
connect(signal: "authenticated", callback: (owner: this, credential: Credential) => void): number;
/**
* This signal is emitted when the user authentication request is
* cancelled. It allows the application to dismiss its authentication
* dialog in case of page load failure for example.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
*
* @returns Callback ID
*/
connect(signal: "cancelled", callback: (owner: this) => void): number;
}
type AuthenticationRequestInitOptionsMixin = GObject.ObjectInitOptions
export interface AuthenticationRequestInitOptions extends AuthenticationRequestInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link AuthenticationRequest} instead.
*/
type AuthenticationRequestMixin = IAuthenticationRequest & GObject.Object;
interface AuthenticationRequest extends AuthenticationRequestMixin {}
class AuthenticationRequest {
public constructor(options?: Partial<AuthenticationRequestInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link AutomationSession} instead.
*/
interface IAutomationSession {
/**
* The session unique identifier.
*/
id: string;
/**
* Get the #WebKitAutomationSession previously set with {@link Webkit.automation_session_set_application_info}.
* @returns the #WebKitAutomationSession of #session, or %NULL if no one has been set.
*/
get_application_info(): ApplicationInfo;
/**
* Get the unique identifier of a #WebKitAutomationSession
* @returns the unique identifier of #session
*/
get_id(): string;
/**
* Set the application information to #session. This information will be used by the driver service
* to match the requested capabilities with the actual application information. If this information
* is not provided to the session when a new automation session is requested, the creation might fail
* if the client requested a specific browser name or version. This will not have any effect when called
* after the automation session has been fully created, so this must be called in the callback of
* #WebKitWebContext::automation-started signal.
* @param info a #WebKitApplicationInfo
*/
set_application_info(info: ApplicationInfo): void;
/**
* This signal is emitted when the automation client requests a new
* browsing context to interact with it. The callback handler should
* return a #WebKitWebView created with #WebKitWebView:is-controlled-by-automation
* construct property enabled and #WebKitWebView:automation-presentation-type construct
* property set if needed.
*
* If the signal is emitted with "tab" detail, the returned #WebKitWebView should be
* a new web view added to a new tab of the current browsing context window.
* If the signal is emitted with "window" detail, the returned #WebKitWebView should be
* a new web view added to a new window.
* When creating a new web view and there's an active browsing context, the new window
* or tab shouldn't be focused.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
* - returns a #WebKitWebView widget.
*
* @returns Callback ID
*/
connect(signal: "create-web-view", callback: (owner: this) => WebView): number;
connect(signal: "notify::id", callback: (owner: this, ...args: any) => void): number;
}
type AutomationSessionInitOptionsMixin = GObject.ObjectInitOptions &
Pick<IAutomationSession,
"id">;
export interface AutomationSessionInitOptions extends AutomationSessionInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link AutomationSession} instead.
*/
type AutomationSessionMixin = IAutomationSession & GObject.Object;
interface AutomationSession extends AutomationSessionMixin {}
class AutomationSession {
public constructor(options?: Partial<AutomationSessionInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link BackForwardList} instead.
*/
interface IBackForwardList {
/**
* Returns the item that precedes the current item.
* @returns the #WebKitBackForwardListItem
* preceding the current item or %NULL.
*/
get_back_item(): BackForwardListItem | null;
get_back_list(): BackForwardListItem[];
get_back_list_with_limit(limit: number): BackForwardListItem[];
/**
* Returns the current item in #back_forward_list.
* @returns a #WebKitBackForwardListItem
* or %NULL if #back_forward_list is empty.
*/
get_current_item(): BackForwardListItem | null;
/**
* Returns the item that follows the current item.
* @returns the #WebKitBackForwardListItem
* following the current item or %NULL.
*/
get_forward_item(): BackForwardListItem | null;
get_forward_list(): BackForwardListItem[];
get_forward_list_with_limit(limit: number): BackForwardListItem[];
get_length(): number;
/**
* Returns the item at a given index relative to the current item.
* @param index the index of the item
* @returns the #WebKitBackForwardListItem
* located at the specified index relative to the current item or %NULL.
*/
get_nth_item(index: number): BackForwardListItem | null;
/**
* This signal is emitted when #back_forward_list changes. This happens
* when the current item is updated, a new item is added or one or more
* items are removed. Note that both #item_added and #items_removed can
* %NULL when only the current item is updated. Items are only removed
* when the list is cleared or the maximum items limit is reached.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
* - item_added: the #WebKitBackForwardListItem added or %NULL
* - items_removed: a #GList of #WebKitBackForwardListItem<!-- -->s
*
* @returns Callback ID
*/
connect(signal: "changed", callback: (owner: this, item_added: BackForwardListItem | null, items_removed: any | null) => void): number;
}
type BackForwardListInitOptionsMixin = GObject.ObjectInitOptions
export interface BackForwardListInitOptions extends BackForwardListInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link BackForwardList} instead.
*/
type BackForwardListMixin = IBackForwardList & GObject.Object;
interface BackForwardList extends BackForwardListMixin {}
class BackForwardList {
public constructor(options?: Partial<BackForwardListInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link BackForwardListItem} instead.
*/
interface IBackForwardListItem {
/**
* See also {@link Webkit.back_forward_list_item_get_uri}.
* @returns the original URI of #list_item or %NULL
* when the original URI is empty.
*/
get_original_uri(): string;
get_title(): string;
/**
* This URI may differ from the original URI if the page was,
* for example, redirected to a new location.
* See also {@link Webkit.back_forward_list_item_get_original_uri}.
* @returns the URI of #list_item or %NULL
* when the URI is empty.
*/
get_uri(): string;
}
type BackForwardListItemInitOptionsMixin = GObject.InitiallyUnownedInitOptions
export interface BackForwardListItemInitOptions extends BackForwardListItemInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link BackForwardListItem} instead.
*/
type BackForwardListItemMixin = IBackForwardListItem & GObject.InitiallyUnowned;
interface BackForwardListItem extends BackForwardListItemMixin {}
class BackForwardListItem {
public constructor(options?: Partial<BackForwardListItemInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link ColorChooserRequest} instead.
*/
interface IColorChooserRequest {
rgba: Gdk.RGBA;
/**
* Cancels #request and the input element changes to use the initial color
* it has before the request started.
* The signal #WebKitColorChooserRequest::finished
* is emitted to notify that the request has finished.
*/
cancel(): void;
/**
* Finishes #request and the input element keeps the current value of
* #WebKitColorChooserRequest:rgba.
* The signal #WebKitColorChooserRequest::finished
* is emitted to notify that the request has finished.
*/
finish(): void;
/**
* Gets the bounding box of the color input element.
* @returns a #GdkRectangle to fill in with the element area
*/
get_element_rectangle(): Gdk.Rectangle;
/**
* Gets the current #GdkRGBA color of #request
* @returns a #GdkRGBA to fill in with the current color.
*/
get_rgba(): Gdk.RGBA;
/**
* Sets the current #GdkRGBA color of #request
* @param rgba a pointer #GdkRGBA
*/
set_rgba(rgba: Gdk.RGBA): void;
/**
* Emitted when the #request finishes. This signal can be emitted because the
* user completed the #request calling {@link Webkit.color_chooser_request_finish},
* or cancelled it with webkit_color_chooser_request_cancel() or because the
* color input element is removed from the DOM.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
*
* @returns Callback ID
*/
connect(signal: "finished", callback: (owner: this) => void): number;
connect(signal: "notify::rgba", callback: (owner: this, ...args: any) => void): number;
}
type ColorChooserRequestInitOptionsMixin = GObject.ObjectInitOptions &
Pick<IColorChooserRequest,
"rgba">;
export interface ColorChooserRequestInitOptions extends ColorChooserRequestInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link ColorChooserRequest} instead.
*/
type ColorChooserRequestMixin = IColorChooserRequest & GObject.Object;
interface ColorChooserRequest extends ColorChooserRequestMixin {}
class ColorChooserRequest {
public constructor(options?: Partial<ColorChooserRequestInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link ContextMenu} instead.
*/
interface IContextMenu {
/**
* Adds #item at the end of the #menu.
* @param item the #WebKitContextMenuItem to add
*/
append(item: ContextMenuItem): void;
/**
* Gets the first item in the #menu.
* @returns the first #WebKitContextMenuItem of #menu,
* or %NULL if the #WebKitContextMenu is empty.
*/
first(): ContextMenuItem;
/**
* Gets the item at the given position in the #menu.
* @param position the position of the item, counting from 0
* @returns the #WebKitContextMenuItem at position #position in #menu,
* or %NULL if the position is off the end of the #menu.
*/
get_item_at_position(position: number): ContextMenuItem;
/**
* Returns the item list of #menu.
* @returns a #GList of
* #WebKitContextMenuItem<!-- -->s
*/
get_items(): ContextMenuItem[];
/**
* Gets the length of the #menu.
* @returns the number of #WebKitContextMenuItem<!-- -->s in #menu
*/
get_n_items(): number;
/**
* Gets the user data of #menu.
* This function can be used from the UI Process to get user data previously set
* from the Web Process with {@link Webkit.context_menu_set_user_data}.
* @returns the user data of #menu, or %NULL if #menu doesn't have user data
*/
get_user_data(): GLib.Variant;
/**
* Inserts #item into the #menu at the given position.
* If #position is negative, or is larger than the number of items
* in the #WebKitContextMenu, the item is added on to the end of
* the #menu. The first position is 0.
* @param item the #WebKitContextMenuItem to add
* @param position the position to insert the item
*/
insert(item: ContextMenuItem, position: number): void;
/**
* Gets the last item in the #menu.
* @returns the last #WebKitContextMenuItem of #menu,
* or %NULL if the #WebKitContextMenu is empty.
*/
last(): ContextMenuItem;
/**
* Moves #item to the given position in the #menu.
* If #position is negative, or is larger than the number of items
* in the #WebKitContextMenu, the item is added on to the end of
* the #menu.
* The first position is 0.
* @param item the #WebKitContextMenuItem to add
* @param position the new position to move the item
*/
move_item(item: ContextMenuItem, position: number): void;
/**
* Adds #item at the beginning of the #menu.
* @param item the #WebKitContextMenuItem to add
*/
prepend(item: ContextMenuItem): void;
/**
* Removes #item from the #menu.
* See also {@link Webkit.context_menu_remove_all} to remove all items.
* @param item the #WebKitContextMenuItem to remove
*/
remove(item: ContextMenuItem): void;
/**
* Removes all items of the #menu.
*/
remove_all(): void;
/**
* Sets user data to #menu.
* This function can be used from a Web Process extension to set user data
* that can be retrieved from the UI Process using {@link Webkit.context_menu_get_user_data}.
* If the #user_data #GVariant is floating, it is consumed.
* @param user_data a #GVariant
*/
set_user_data(user_data: GLib.Variant): void;
}
type ContextMenuInitOptionsMixin = GObject.ObjectInitOptions
export interface ContextMenuInitOptions extends ContextMenuInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link ContextMenu} instead.
*/
type ContextMenuMixin = IContextMenu & GObject.Object;
interface ContextMenu extends ContextMenuMixin {}
class ContextMenu {
public constructor(options?: Partial<ContextMenuInitOptions>);
/**
* Creates a new #WebKitContextMenu object to be used as a submenu of an existing
* #WebKitContextMenu. The context menu of a #WebKitWebView is created by the view
* and passed as an argument of #WebKitWebView::context-menu signal.
* To add items to the menu use {@link Webkit.context_menu_prepend},
* webkit_context_menu_append() or webkit_context_menu_insert().
* See also webkit_context_menu_new_with_items() to create a #WebKitContextMenu with
* a list of initial items.
* @returns The newly created #WebKitContextMenu object
*/
public static new(): ContextMenu;
/**
* Creates a new #WebKitContextMenu object to be used as a submenu of an existing
* #WebKitContextMenu with the given initial items.
* See also {@link Webkit.context_menu_new}
* @param items a #GList of #WebKitContextMenuItem
* @returns The newly created #WebKitContextMenu object
*/
public static new_with_items(items: ContextMenuItem[]): ContextMenu;
}
/** This construct is only for enabling class multi-inheritance,
* use {@link ContextMenuItem} instead.
*/
interface IContextMenuItem {
/**
* @deprecated
* Use {@link Webkit.context_menu_item_get_gaction} instead.
*
* Gets the action associated to #item as a #GtkAction.
* @returns the #GtkAction associated to the #WebKitContextMenuItem,
* or %NULL if #item is a separator.
*/
get_action(): Gtk.Action;
/**
* Gets the action associated to #item as a #GAction.
* @returns the #GAction associated to the #WebKitContextMenuItem,
* or %NULL if #item is a separator.
*/
get_gaction(): Gio.Action;
/**
* Gets the #WebKitContextMenuAction of #item. If the #WebKitContextMenuItem was not
* created for a stock action %WEBKIT_CONTEXT_MENU_ACTION_CUSTOM will be
* returned. If the #WebKitContextMenuItem is a separator %WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION
* will be returned.
* @returns the #WebKitContextMenuAction of #item
*/
get_stock_action(): ContextMenuAction;
/**
* Gets the submenu of #item.
* @returns the #WebKitContextMenu representing the submenu of
* #item or %NULL if #item doesn't have a submenu.
*/
get_submenu(): ContextMenu;
/**
* Checks whether #item is a separator.
* @returns %TRUE is #item is a separator or %FALSE otherwise
*/
is_separator(): boolean;
/**
* Sets or replaces the #item submenu. If #submenu is %NULL the current
* submenu of #item is removed.
* @param submenu a #WebKitContextMenu
*/
set_submenu(submenu?: ContextMenu | null): void;
}
type ContextMenuItemInitOptionsMixin = GObject.InitiallyUnownedInitOptions
export interface ContextMenuItemInitOptions extends ContextMenuItemInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link ContextMenuItem} instead.
*/
type ContextMenuItemMixin = IContextMenuItem & GObject.InitiallyUnowned;
interface ContextMenuItem extends ContextMenuItemMixin {}
class ContextMenuItem {
public constructor(options?: Partial<ContextMenuItemInitOptions>);
/**
* @deprecated
* Use {@link Webkit.context_menu_item_new_from_gaction} instead.
*
* Creates a new #WebKitContextMenuItem for the given #action.
* @param action a #GtkAction
* @returns the newly created #WebKitContextMenuItem object.
*/
public static new(action: Gtk.Action): ContextMenuItem;
/**
* Creates a new #WebKitContextMenuItem for the given #action and #label. On activation
* #target will be passed as parameter to the callback.
* @param action a #GAction
* @param label the menu item label text
* @param target a #GVariant to use as the action target
* @returns the newly created #WebKitContextMenuItem object.
*/
public static new_from_gaction(action: Gio.Action, label: string, target?: GLib.Variant | null): ContextMenuItem;
/**
* Creates a new #WebKitContextMenuItem for the given stock action.
* Stock actions are handled automatically by WebKit so that, for example,
* when a menu item created with a %WEBKIT_CONTEXT_MENU_ACTION_STOP is
* activated the action associated will be handled by WebKit and the current
* load operation will be stopped. You can get the #GAction of a
* #WebKitContextMenuItem created with a #WebKitContextMenuAction with
* {@link Webkit.context_menu_item_get_gaction} and connect to the #GSimpleAction::activate signal
* to be notified when the item is activated, but you can't prevent the associated
* action from being performed.
* @param action a #WebKitContextMenuAction stock action
* @returns the newly created #WebKitContextMenuItem object.
*/
public static new_from_stock_action(action: ContextMenuAction): ContextMenuItem;
/**
* Creates a new #WebKitContextMenuItem for the given stock action using the given #label.
* Stock actions have a predefined label, this method can be used to create a
* #WebKitContextMenuItem for a #WebKitContextMenuAction but using a custom label.
* @param action a #WebKitContextMenuAction stock action
* @param label a custom label text to use instead of the predefined one
* @returns the newly created #WebKitContextMenuItem object.
*/
public static new_from_stock_action_with_label(action: ContextMenuAction, label: string): ContextMenuItem;
/**
* Creates a new #WebKitContextMenuItem representing a separator.
* @returns the newly created #WebKitContextMenuItem object.
*/
public static new_separator(): ContextMenuItem;
/**
* Creates a new #WebKitContextMenuItem using the given #label with a submenu.
* @param label the menu item label text
* @param submenu a #WebKitContextMenu to set
* @returns the newly created #WebKitContextMenuItem object.
*/
public static new_with_submenu(label: string, submenu: ContextMenu): ContextMenuItem;
}
/** This construct is only for enabling class multi-inheritance,
* use {@link CookieManager} instead.
*/
interface ICookieManager {
/**
* Asynchronously add a #SoupCookie to the underlying storage.
*
* When the operation is finished, #callback will be called. You can then call
* {@link Webkit.cookie_manager_add_cookie_finish} to get the result of the operation.
* @param cookie the #SoupCookie to be added
* @param cancellable a #GCancellable or %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
add_cookie(cookie: Soup.Cookie, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void;
/**
* Finish an asynchronous operation started with {@link Webkit.cookie_manager_add_cookie}.
* @param result a #GAsyncResult
* @returns %TRUE if the cookie was added or %FALSE in case of error.
*/
add_cookie_finish(result: Gio.AsyncResult): boolean;
/**
* @deprecated
* Use {@link Webkit.website_data_manager_clear} instead.
*
* Delete all cookies of #cookie_manager
*/
delete_all_cookies(): void;
/**
* Asynchronously delete a #SoupCookie from the current session.
*
* When the operation is finished, #callback will be called. You can then call
* {@link Webkit.cookie_manager_delete_cookie_finish} to get the result of the operation.
* @param cookie the #SoupCookie to be deleted
* @param cancellable a #GCancellable or %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
delete_cookie(cookie: Soup.Cookie, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void;
/**
* Finish an asynchronous operation started with {@link Webkit.cookie_manager_delete_cookie}.
* @param result a #GAsyncResult
* @returns %TRUE if the cookie was deleted or %FALSE in case of error.
*/
delete_cookie_finish(result: Gio.AsyncResult): boolean;
/**
* @deprecated
* Use {@link Webkit.website_data_manager_remove} instead.
*
* Remove all cookies of #cookie_manager for the given #domain.
* @param domain a domain name
*/
delete_cookies_for_domain(domain: string): void;
/**
* Asynchronously get the cookie acceptance policy of #cookie_manager.
* Note that when policy was set to %WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY and
* ITP is enabled, this will return %WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS.
* See also {@link Webkit.website_data_manager_set_itp_enabled}.
*
* When the operation is finished, #callback will be called. You can then call
* webkit_cookie_manager_get_accept_policy_finish() to get the result of the operation.
* @param cancellable a #GCancellable or %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
get_accept_policy(cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void;
/**
* Finish an asynchronous operation started with {@link Webkit.cookie_manager_get_accept_policy}.
* @param result a #GAsyncResult
* @returns the cookie acceptance policy of #cookie_manager as a #WebKitCookieAcceptPolicy.
*/
get_accept_policy_finish(result: Gio.AsyncResult): CookieAcceptPolicy;
/**
* Asynchronously get a list of #SoupCookie from #cookie_manager associated with #uri, which
* must be either an HTTP or an HTTPS URL.
*
* When the operation is finished, #callback will be called. You can then call
* {@link Webkit.cookie_manager_get_cookies_finish} to get the result of the operation.
* @param uri the URI associated to the cookies to be retrieved
* @param cancellable a #GCancellable or %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
get_cookies(uri: string, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void;
/**
* Finish an asynchronous operation started with {@link Webkit.cookie_manager_get_cookies}.
* The return value is a #GSList of #SoupCookie instances which should be released
* with g_list_free_full() and soup_cookie_free().
* @param result a #GAsyncResult
* @returns A #GList of #SoupCookie instances.
*/
get_cookies_finish(result: Gio.AsyncResult): Soup.Cookie[];
/**
* @deprecated
* Use {@link Webkit.website_data_manager_fetch} instead.
*
* Asynchronously get the list of domains for which #cookie_manager contains cookies.
*
* When the operation is finished, #callback will be called. You can then call
* {@link Webkit.cookie_manager_get_domains_with_cookies_finish} to get the result of the operation.
* @param cancellable a #GCancellable or %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
get_domains_with_cookies(cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void;
/**
* @deprecated
* Use {@link Webkit.website_data_manager_fetch_finish} instead.
*
* Finish an asynchronous operation started with {@link Webkit.cookie_manager_get_domains_with_cookies}.
* The return value is a %NULL terminated list of strings which should
* be released with g_strfreev().
* @param result a #GAsyncResult
* @returns A %NULL terminated array of domain names
* or %NULL in case of error.
*/
get_domains_with_cookies_finish(result: Gio.AsyncResult): string[];
/**
* Set the cookie acceptance policy of #cookie_manager as #policy.
* Note that ITP has its own way to handle third-party cookies, so when it's enabled,
* and #policy is set to %WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY, %WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS
* will be used instead. Once disabled, the policy will be set back to %WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY.
* See also {@link Webkit.website_data_manager_set_itp_enabled}.
* @param policy a #WebKitCookieAcceptPolicy
*/
set_accept_policy(policy: CookieAcceptPolicy): void;
/**
* Set the #filename where non-session cookies are stored persistently using
* #storage as the format to read/write the cookies.
* Cookies are initially read from #filename to create an initial set of cookies.
* Then, non-session cookies will be written to #filename when the WebKitCookieManager::changed
* signal is emitted.
* By default, #cookie_manager doesn't store the cookies persistently, so you need to call this
* method to keep cookies saved across sessions.
*
* This method should never be called on a #WebKitCookieManager associated to an ephemeral #WebKitWebsiteDataManager.
* @param filename the filename to read to/write from
* @param storage a #WebKitCookiePersistentStorage
*/
set_persistent_storage(filename: string, storage: CookiePersistentStorage): void;
/**
* This signal is emitted when cookies are added, removed or modified.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
*
* @returns Callback ID
*/
connect(signal: "changed", callback: (owner: this) => void): number;
}
type CookieManagerInitOptionsMixin = GObject.ObjectInitOptions
export interface CookieManagerInitOptions extends CookieManagerInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link CookieManager} instead.
*/
type CookieManagerMixin = ICookieManager & GObject.Object;
interface CookieManager extends CookieManagerMixin {}
class CookieManager {
public constructor(options?: Partial<CookieManagerInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link DeviceInfoPermissionRequest} instead.
*/
interface IDeviceInfoPermissionRequest {
}
type DeviceInfoPermissionRequestInitOptionsMixin = GObject.ObjectInitOptions & PermissionRequestInitOptions
export interface DeviceInfoPermissionRequestInitOptions extends DeviceInfoPermissionRequestInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link DeviceInfoPermissionRequest} instead.
*/
type DeviceInfoPermissionRequestMixin = IDeviceInfoPermissionRequest & GObject.Object & PermissionRequest;
interface DeviceInfoPermissionRequest extends DeviceInfoPermissionRequestMixin {}
class DeviceInfoPermissionRequest {
public constructor(options?: Partial<DeviceInfoPermissionRequestInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link Download} instead.
*/
interface IDownload {
/**
* Whether or not the download is allowed to overwrite an existing file on
* disk. If this property is %FALSE and the destination already exists,
* the download will fail.
*/
allow_overwrite: boolean;
/**
* The local URI to where the download will be saved.
*/
readonly destination: string;
/**
* An estimate of the percent completion for the download operation.
* This value will range from 0.0 to 1.0. The value is an estimate
* based on the total number of bytes expected to be received for
* a download.
* If you need a more accurate progress information you can connect to
* #WebKitDownload::received-data signal to track the progress.
*/
readonly estimated_progress: number;
/**
* The #WebKitURIResponse associated with this download.
*/
readonly response: URIResponse;
/**
* Cancels the download. When the ongoing download
* operation is effectively cancelled the signal
* #WebKitDownload::failed is emitted with
* %WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER error.
*/
cancel(): void;
/**
* Returns the current value of the #WebKitDownload:allow-overwrite property,
* which determines whether the download will overwrite an existing file on
* disk, or if it will fail if the destination already exists.
* @returns the current value of the #WebKitDownload:allow-overwrite property
*/
get_allow_overwrite(): boolean;
/**
* Obtains the URI to which the downloaded file will be written. You
* can connect to #WebKitDownload::created-destination to make
* sure this method returns a valid destination.
* @returns the destination URI or %NULL
*/
get_destination(): string;
/**
* Gets the elapsed time in seconds, including any fractional part.
* If the download finished, had an error or was cancelled this is
* the time between its start and the event.
* @returns seconds since the download was started
*/
get_elapsed_time(): number;
/**
* Gets the value of the #WebKitDownload:estimated-progress property.
* You can monitor the estimated progress of the download operation by
* connecting to the notify::estimated-progress signal of #download.
* @returns an estimate of the of the percent complete for a download
* as a range from 0.0 to 1.0.
*/
get_estimated_progress(): number;
/**
* Gets the length of the data already downloaded for #download
* in bytes.
* @returns the amount of bytes already downloaded.
*/
get_received_data_length(): number;
/**
* Retrieves the #WebKitURIRequest object that backs the download
* process.
* @returns the #WebKitURIRequest of #download
*/
get_request(): URIRequest;
/**
* Retrieves the #WebKitURIResponse object that backs the download
* process. This method returns %NULL if called before the response
* is received from the server. You can connect to notify::response
* signal to be notified when the response is received.
* @returns the #WebKitURIResponse, or %NULL if
* the response hasn't been received yet.
*/
get_response(): URIResponse;
/**
* Get the #WebKitWebView that initiated the download.
* @returns the #WebKitWebView that initiated #download,
* or %NULL if #download was not initiated by a #WebKitWebView.
*/
get_web_view(): WebView;
/**
* Sets the #WebKitDownload:allow-overwrite property, which determines whether
* the download may overwrite an existing file on disk, or if it will fail if
* the destination already exists.
* @param allowed the new value for the #WebKitDownload:allow-overwrite property
*/
set_allow_overwrite(allowed: boolean): void;
/**
* Sets the URI to which the downloaded file will be written.
* This method should be called before the download transfer
* starts or it will not have any effect on the ongoing download
* operation. To set the destination using the filename suggested
* by the server connect to #WebKitDownload::decide-destination
* signal and call {@link Webkit.download_set_destination}. If you want to
* set a fixed destination URI that doesn't depend on the suggested
* filename you can connect to notify::response signal and call
* webkit_download_set_destination().
* If #WebKitDownload::decide-destination signal is not handled
* and destination URI is not set when the download transfer starts,
* the file will be saved with the filename suggested by the server in
* %G_USER_DIRECTORY_DOWNLOAD directory.
* @param uri the destination URI
*/
set_destination(uri: string): void;
/**
* This signal is emitted after #WebKitDownload::decide-destination and before
* #WebKitDownload::received-data to notify that destination file has been
* created successfully at #destination.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
* - destination: the destination URI
*
* @returns Callback ID
*/
connect(signal: "created-destination", callback: (owner: this, destination: string) => void): number;
/**
* This signal is emitted after response is received to
* decide a destination URI for the download. If this signal is not
* handled the file will be downloaded to %G_USER_DIRECTORY_DOWNLOAD
* directory using #suggested_filename.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
* - suggested_filename: the filename suggested for the download
* - returns %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
*
* @returns Callback ID
*/
connect(signal: "decide-destination", callback: (owner: this, suggested_filename: string) => boolean): number;
/**
* This signal is emitted when an error occurs during the download
* operation. The given #error, of the domain %WEBKIT_DOWNLOAD_ERROR,
* contains further details of the failure. If the download is cancelled
* with {@link Webkit.download_cancel}, this signal is emitted with error
* %WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER. The download operation finishes
* after an error and #WebKitDownload::finished signal is emitted after this one.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
* - error: the #GError that was triggered
*
* @returns Callback ID
*/
connect(signal: "failed", callback: (owner: this, error: GLib.Error) => void): number;
/**
* This signal is emitted when download finishes successfully or due to an error.
* In case of errors #WebKitDownload::failed signal is emitted before this one.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
*
* @returns Callback ID
*/
connect(signal: "finished", callback: (owner: this) => void): number;
/**
* This signal is emitted after response is received,
* every time new data has been written to the destination. It's
* useful to know the progress of the download operation.
* @param signal
* @param callback Callback function
* - owner: owner of the emitted event
* - data_length: the length of data received in bytes
*
* @returns Callback ID
*/
connect(signal: "received-data", callback: (owner: this, data_length: number) => void): number;
connect(signal: "notify::allow-overwrite", callback: (owner: this, ...args: any) => void): number;
connect(signal: "notify::destination", callback: (owner: this, ...args: any) => void): number;
connect(signal: "notify::estimated-progress", callback: (owner: this, ...args: any) => void): number;
connect(signal: "notify::response", callback: (owner: this, ...args: any) => void): number;
}
type DownloadInitOptionsMixin = GObject.ObjectInitOptions &
Pick<IDownload,
"allow_overwrite">;
export interface DownloadInitOptions extends DownloadInitOptionsMixin {}
/** This construct is only for enabling class multi-inheritance,
* use {@link Download} instead.
*/
type DownloadMixin = IDownload & GObject.Object;
interface Download extends DownloadMixin {}
class Download {
public constructor(options?: Partial<DownloadInitOptions>);
}
/** This construct is only for enabling class multi-inheritance,
* use {@link EditorState} instead.
*/
interface IEditorState {
/**
* Bitmask of #WebKitEditorTypingAttributes flags.
* See {@link Webkit.editor_state_get_typing_attributes} for more information.
*/