• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16declare type WebviewController = import('../api/@ohos.web.webview').default.WebviewController;
17
18/**
19 * Enum type supplied to {@link getMessageLevel} for receiving the console log level of JavaScript.
20 *
21 * @enum { number }
22 * @syscap SystemCapability.Web.Webview.Core
23 * @since 8
24 */
25declare enum MessageLevel {
26  /**
27   * Debug level.
28   *
29   * @syscap SystemCapability.Web.Webview.Core
30   * @since 8
31   */
32  Debug,
33
34  /**
35   * Error level.
36   *
37   * @syscap SystemCapability.Web.Webview.Core
38   * @since 8
39   */
40  Error,
41
42  /**
43   * Info level.
44   *
45   * @syscap SystemCapability.Web.Webview.Core
46   * @since 8
47   */
48  Info,
49
50  /**
51   * Log level.
52   *
53   * @syscap SystemCapability.Web.Webview.Core
54   * @since 8
55   */
56  Log,
57
58  /**
59   * Warn level.
60   *
61   * @syscap SystemCapability.Web.Webview.Core
62   * @since 8
63   */
64  Warn,
65}
66
67/**
68 * The Web's behavior to load from HTTP or HTTPS. Defaults to MixedMode.None.
69 *
70 * @enum { number }
71 * @syscap SystemCapability.Web.Webview.Core
72 * @since 8
73 */
74declare enum MixedMode {
75  /**
76   * Allows all sources.
77   *
78   * @syscap SystemCapability.Web.Webview.Core
79   * @since 8
80   */
81  All,
82
83  /**
84   * Allows sources Compatibly.
85   *
86   * @syscap SystemCapability.Web.Webview.Core
87   * @since 8
88   */
89  Compatible,
90
91  /**
92   * Don't allow unsecure sources from a secure origin.
93   *
94   * @syscap SystemCapability.Web.Webview.Core
95   * @since 8
96   */
97  None,
98}
99
100/**
101 * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest.
102 *
103 * @enum { number }
104 * @syscap SystemCapability.Web.Webview.Core
105 * @since 8
106 */
107declare enum HitTestType {
108  /**
109   * The edit text.
110   *
111   * @syscap SystemCapability.Web.Webview.Core
112   * @since 8
113   */
114  EditText,
115
116  /**
117   * The email address.
118   *
119   * @syscap SystemCapability.Web.Webview.Core
120   * @since 8
121   */
122  Email,
123
124  /**
125   * The HTML::a tag with src=http.
126   *
127   * @syscap SystemCapability.Web.Webview.Core
128   * @since 8
129   */
130  HttpAnchor,
131
132  /**
133   * The HTML::a tag with src=http + HTML::img.
134   *
135   * @syscap SystemCapability.Web.Webview.Core
136   * @since 8
137   */
138  HttpAnchorImg,
139
140  /**
141   * The HTML::img tag.
142   *
143   * @syscap SystemCapability.Web.Webview.Core
144   * @since 8
145   */
146  Img,
147
148  /**
149   * The map address.
150   *
151   * @syscap SystemCapability.Web.Webview.Core
152   * @since 8
153   */
154  Map,
155
156  /**
157   * The phone number.
158   *
159   * @syscap SystemCapability.Web.Webview.Core
160   * @since 8
161   */
162  Phone,
163
164  /**
165   * Other unknown HitTest.
166   *
167   * @syscap SystemCapability.Web.Webview.Core
168   * @since 8
169   */
170  Unknown,
171}
172
173/**
174 * Enum type supplied to {@link cacheMode} for setting the Web cache mode.
175 *
176 * @enum { number }
177 * @syscap SystemCapability.Web.Webview.Core
178 * @since 8
179 */
180declare enum CacheMode {
181  /**
182   * load cache when they are available and not expired, otherwise load online.
183   *
184   * @syscap SystemCapability.Web.Webview.Core
185   * @since 9
186   */
187  Default,
188
189  /**
190   * load cache when they are available, otherwise load online.
191   *
192   * @syscap SystemCapability.Web.Webview.Core
193   * @since 8
194   */
195  None,
196
197  /**
198   * Load cache first, then online.
199   *
200   * @syscap SystemCapability.Web.Webview.Core
201   * @since 8
202   */
203  Online,
204
205  /**
206   * load cache and not online.
207   *
208   * @syscap SystemCapability.Web.Webview.Core
209   * @since 8
210   */
211  Only,
212}
213
214/**
215 * Enum type supplied to {@link darkMode} for setting the web dark mode.
216 *
217 * @enum { number }
218 * @syscap SystemCapability.Web.Webview.Core
219 * @since 9
220 */
221declare enum WebDarkMode {
222  /**
223   * Disable the web dark mode.
224   *
225   * @syscap SystemCapability.Web.Webview.Core
226   * @since 9
227   */
228  Off,
229
230  /**
231   * Enable the web dark mode.
232   *
233   * @syscap SystemCapability.Web.Webview.Core
234   * @since 9
235   */
236  On,
237
238  /**
239   * Make web dark mode follow the system.
240   *
241   * @syscap SystemCapability.Web.Webview.Core
242   * @since 9
243   */
244  Auto,
245}
246
247/**
248 * Enum type supplied to {@link captureMode} for setting the web capture mode.
249 *
250 * @enum { number }
251 * @syscap SystemCapability.Web.Webview.Core
252 * @since 10
253 */
254declare enum WebCaptureMode {
255  /**
256   * The home screen.
257   * @syscap SystemCapability.Web.Webview.Core
258   * @since 10
259   */
260  HOME_SCREEN = 0,
261}
262
263/**
264 * Defines the Media Options.
265 *
266 * @interface WebMediaOptions
267 * @syscap SystemCapability.Web.Webview.Core
268 * @since 10
269 */
270declare interface WebMediaOptions {
271  /**
272   * The time interval for audio playback to resume.
273   *
274   * @type { ?number }
275   * @syscap SystemCapability.Web.Webview.Core
276   * @since 10
277   */
278  resumeInterval?: number;
279  /**
280   * Whether the audio of each web is exclusive.
281   *
282   * @type { ?boolean }
283   * @syscap SystemCapability.Web.Webview.Core
284   * @since 10
285   */
286  audioExclusive?: boolean;
287}
288
289/**
290 * Defines the screen capture configuration.
291 *
292 * @interface ScreenCaptureConfig
293 * @syscap SystemCapability.Web.Webview.Core
294 * @since 10
295 */
296declare interface ScreenCaptureConfig {
297  /**
298   * The mode for selecting the recording area.
299   *
300   * @type { WebCaptureMode }
301   * @syscap SystemCapability.Web.Webview.Core
302   * @since 10
303   */
304  captureMode: WebCaptureMode;
305}
306
307/**
308 * Define the handler to exit the full screen mode, related to the {@link onFullScreenEnter} event.
309 *
310 * @syscap SystemCapability.Web.Webview.Core
311 * @since 9
312 */
313declare class FullScreenExitHandler {
314  /**
315   * Constructor.
316   *
317   * @syscap SystemCapability.Web.Webview.Core
318   * @since 9
319   */
320  constructor();
321
322  /**
323   * Exit the full screen mode.
324   *
325   * @syscap SystemCapability.Web.Webview.Core
326   * @since 9
327   */
328  exitFullScreen(): void;
329}
330
331/**
332 * Enum type supplied to {@link renderExitReason} when onRenderExited being called.
333 *
334 * @enum { number }
335 * @syscap SystemCapability.Web.Webview.Core
336 * @since 9
337 */
338declare enum RenderExitReason {
339  /**
340   * Render process non-zero exit status.
341   *
342   * @syscap SystemCapability.Web.Webview.Core
343   * @since 9
344   */
345  ProcessAbnormalTermination,
346
347  /**
348   * SIGKILL or task manager kill.
349   *
350   * @syscap SystemCapability.Web.Webview.Core
351   * @since 9
352   */
353  ProcessWasKilled,
354
355  /**
356   * Segmentation fault.
357   *
358   * @syscap SystemCapability.Web.Webview.Core
359   * @since 9
360   */
361  ProcessCrashed,
362
363  /**
364   * Out of memory.
365   *
366   * @syscap SystemCapability.Web.Webview.Core
367   * @since 9
368   */
369  ProcessOom,
370
371  /**
372   * Unknown reason.
373   *
374   * @syscap SystemCapability.Web.Webview.Core
375   * @since 9
376   */
377  ProcessExitUnknown,
378}
379
380/**
381 * Enum type supplied to {@link error} when onSslErrorEventReceive being called.
382 *
383 * @enum { number }
384 * @syscap SystemCapability.Web.Webview.Core
385 * @since 9
386 */
387declare enum SslError {
388  /**
389   * General error.
390   *
391   * @syscap SystemCapability.Web.Webview.Core
392   * @since 9
393   */
394  Invalid,
395
396  /**
397   * Hostname mismatch.
398   *
399   * @syscap SystemCapability.Web.Webview.Core
400   * @since 9
401   */
402  HostMismatch,
403
404  /**
405   * The certificate date is invalid.
406   *
407   * @syscap SystemCapability.Web.Webview.Core
408   * @since 9
409   */
410  DateInvalid,
411
412  /**
413   * The certificate authority is not trusted.
414   *
415   * @syscap SystemCapability.Web.Webview.Core
416   * @since 9
417   */
418  Untrusted,
419}
420
421/**
422 * Enum type supplied to {@link FileSelectorParam} when onFileSelectorShow being called.
423 *
424 * @enum { number }
425 * @syscap SystemCapability.Web.Webview.Core
426 * @since 9
427 */
428declare enum FileSelectorMode {
429  /**
430   * Allows single file to be selected.
431   *
432   * @syscap SystemCapability.Web.Webview.Core
433   * @since 9
434   */
435  FileOpenMode,
436
437  /**
438   * Allows multiple files to be selected.
439   *
440   * @syscap SystemCapability.Web.Webview.Core
441   * @since 9
442   */
443  FileOpenMultipleMode,
444
445  /**
446   * Allows file folders to be selected.
447   *
448   * @syscap SystemCapability.Web.Webview.Core
449   * @since 9
450   */
451  FileOpenFolderMode,
452
453  /**
454   * Allows select files to save.
455   *
456   * @syscap SystemCapability.Web.Webview.Core
457   * @since 9
458   */
459  FileSaveMode,
460}
461
462/**
463 * Encompassed message information as parameters to {@link onFileSelectorShow} method.
464 *
465 * @syscap SystemCapability.Web.Webview.Core
466 * @since 9
467 */
468declare class FileSelectorParam {
469  /**
470   * Constructor.
471   *
472   * @syscap SystemCapability.Web.Webview.Core
473   * @since 9
474   */
475  constructor();
476
477  /**
478    * Gets the title of this file selector.
479    * @returns { string } Return the title of this file selector.
480    * @syscap SystemCapability.Web.Webview.Core
481    * @since 9
482    */
483  getTitle(): string;
484
485  /**
486    * Gets the FileSelectorMode of this file selector.
487    * @returns { FileSelectorMode } Return the FileSelectorMode of this file selector.
488    * @syscap SystemCapability.Web.Webview.Core
489    * @since 9
490    */
491  getMode(): FileSelectorMode;
492
493  /**
494    * Gets an array of acceptable MMIE type.
495    * @returns { Array<string> } Return an array of acceptable MMIE type.
496    * @syscap SystemCapability.Web.Webview.Core
497    * @since 9
498    */
499  getAcceptType(): Array<string>;
500
501  /**
502   * Gets whether this file selector use a live media captured value.
503   *
504   * @returns { boolean } Return {@code true} if captured media; return {@code false} otherwise.
505   * @syscap SystemCapability.Web.Webview.Core
506   * @since 9
507   */
508  isCapture(): boolean;
509}
510
511/**
512 * Defines the js result.
513 *
514 * @syscap SystemCapability.Web.Webview.Core
515 * @since 8
516 */
517declare class JsResult {
518  /**
519   * Constructor.
520   *
521   * @syscap SystemCapability.Web.Webview.Core
522   * @since 8
523   */
524  constructor();
525
526  /**
527   * Handle the user's JavaScript result if cancel the dialog.
528   *
529   * @syscap SystemCapability.Web.Webview.Core
530   * @since 8
531   */
532  handleCancel(): void;
533
534  /**
535   * Handle the user's JavaScript result if confirm the dialog.
536   *
537   * @syscap SystemCapability.Web.Webview.Core
538   * @since 8
539   */
540  handleConfirm(): void;
541
542  /**
543   * Handle the user's JavaScript result if confirm the prompt dialog.
544   *
545   * @param { string } result
546   * @syscap SystemCapability.Web.Webview.Core
547   * @since 9
548   */
549  handlePromptConfirm(result: string): void;
550}
551
552/**
553 * Defines the file selector result, related to {@link onFileSelectorShow} method.
554 *
555 * @syscap SystemCapability.Web.Webview.Core
556 * @since 9
557 */
558declare class FileSelectorResult {
559  /**
560   * Constructor.
561   *
562   * @syscap SystemCapability.Web.Webview.Core
563   * @since 9
564   */
565  constructor();
566
567  /**
568   * select a list of files.
569   *
570   * @param { Array<string> } fileList
571   * @syscap SystemCapability.Web.Webview.Core
572   * @since 9
573   */
574  handleFileList(fileList: Array<string>): void;
575}
576
577/**
578 * Defines the http auth request result, related to {@link onHttpAuthRequest} method.
579 *
580 * @syscap SystemCapability.Web.Webview.Core
581 * @since 9
582 */
583declare class HttpAuthHandler {
584  /**
585   * Constructor.
586   *
587   * @syscap SystemCapability.Web.Webview.Core
588   * @since 9
589   */
590  constructor();
591
592  /**
593   * confirm.
594   *
595   * @param { string } userName
596   * @param { string } password
597   * @returns { boolean }
598   * @syscap SystemCapability.Web.Webview.Core
599   * @since 9
600   */
601  confirm(userName: string, password: string): boolean;
602
603  /**
604   * cancel.
605   *
606   * @syscap SystemCapability.Web.Webview.Core
607   * @since 9
608   */
609  cancel(): void;
610
611  /**
612   * isHttpAuthInfoSaved.
613   *
614   * @returns { boolean }
615   * @syscap SystemCapability.Web.Webview.Core
616   * @since 9
617   */
618  isHttpAuthInfoSaved(): boolean;
619}
620
621/**
622 * Defines the ssl error request result, related to {@link onSslErrorEventReceive} method.
623 *
624 * @syscap SystemCapability.Web.Webview.Core
625 * @since 9
626 */
627declare class SslErrorHandler {
628  /**
629   * Constructor.
630   *
631   * @syscap SystemCapability.Web.Webview.Core
632   * @since 9
633   */
634  constructor();
635
636  /**
637   * Confirm to use the SSL certificate.
638   *
639   * @syscap SystemCapability.Web.Webview.Core
640   * @since 9
641   */
642  handleConfirm(): void;
643
644  /**
645   * Cancel this request.
646   *
647   * @syscap SystemCapability.Web.Webview.Core
648   * @since 9
649   */
650  handleCancel(): void;
651}
652
653/**
654 * Defines the client certificate request result, related to {@link onClientAuthenticationRequest} method.
655 *
656 * @syscap SystemCapability.Web.Webview.Core
657 * @since 9
658 */
659declare class ClientAuthenticationHandler {
660  /**
661   * Constructor.
662   *
663   * @syscap SystemCapability.Web.Webview.Core
664   * @since 9
665   */
666  constructor();
667
668  /**
669   * Confirm to use the specified private key and client certificate chain.
670   *
671   * @param { string } priKeyFile - The file that store private key.
672   * @param { string } certChainFile - The file that store client certificate chain.
673   * @syscap SystemCapability.Web.Webview.Core
674   * @since 9
675   */
676  confirm(priKeyFile: string, certChainFile: string): void;
677
678  /**
679   * Confirm to use the authUri.The authUri can be obtained from certificate management.
680   *
681   * @param { string } authUri is the key of credentials.The credentials contain sign info and client certificates info.
682   * @syscap SystemCapability.Web.Webview.Core
683   * @since 10
684   */
685  confirm(authUri: string): void;
686
687  /**
688   * Cancel this certificate request.
689   *
690   * @syscap SystemCapability.Web.Webview.Core
691   * @since 9
692   */
693  cancel(): void;
694
695  /**
696   * Ignore this certificate request temporarily.
697   *
698   * @syscap SystemCapability.Web.Webview.Core
699   * @since 9
700   */
701  ignore(): void;
702}
703
704/**
705 * Defines the accessible resource type, related to {@link onPermissionRequest} method.
706 *
707 * @enum { string }
708 * @syscap SystemCapability.Web.Webview.Core
709 * @since 9
710 */
711declare enum ProtectedResourceType {
712  /**
713   * The MidiSysex resource.
714   *
715   * @syscap SystemCapability.Web.Webview.Core
716   * @since 9
717   */
718  MidiSysex = 'TYPE_MIDI_SYSEX',
719
720  /**
721   * The video capture resource, such as camera.
722   *
723   * @syscap SystemCapability.Web.Webview.Core
724   * @since 10
725   */
726  VIDEO_CAPTURE = 'TYPE_VIDEO_CAPTURE',
727
728  /**
729   * The audio capture resource, such as microphone.
730   *
731   * @syscap SystemCapability.Web.Webview.Core
732   * @since 10
733   */
734  AUDIO_CAPTURE = 'TYPE_AUDIO_CAPTURE'
735}
736
737/**
738 * Defines the onPermissionRequest callback, related to {@link onPermissionRequest} method.
739 *
740 * @syscap SystemCapability.Web.Webview.Core
741 * @since 9
742 */
743declare class PermissionRequest {
744  /**
745   * Constructor.
746   *
747   * @syscap SystemCapability.Web.Webview.Core
748   * @since 9
749   */
750  constructor();
751
752  /**
753   * Reject the request.
754   *
755   * @syscap SystemCapability.Web.Webview.Core
756   * @since 9
757   */
758  deny(): void;
759
760  /**
761   * Gets the source if the webpage that attempted to access the restricted resource.
762   *
763   * @returns { string }
764   * @syscap SystemCapability.Web.Webview.Core
765   * @since 9
766   */
767  getOrigin(): string;
768
769  /**
770   * Gets the resource that the webpage is trying to access.
771   *
772   * @returns { Array<string> }
773   * @syscap SystemCapability.Web.Webview.Core
774   * @since 9
775   */
776  getAccessibleResource(): Array<string>;
777
778  /**
779   * Grant origin access to a given resource.
780   *
781   * @param { Array<string> } resources
782   * @syscap SystemCapability.Web.Webview.Core
783   * @since 9
784   */
785  grant(resources: Array<string>): void;
786}
787
788/**
789 * Defines the onScreenCapture callback, related to {@link onScreenCapture} method.
790 * @syscap SystemCapability.Web.Webview.Core
791 * @since 10
792 */
793declare class ScreenCaptureHandler {
794  /**
795   * Constructor.
796   * @syscap SystemCapability.Web.Webview.Core
797   * @since 10
798   */
799  constructor();
800
801  /**
802   * Gets the source of the webpage that attempted to access the restricted resource.
803   *
804   * @returns { string }
805   * @syscap SystemCapability.Web.Webview.Core
806   * @since 10
807   */
808  getOrigin(): string;
809
810  /**
811   * Grant origin access to a given resource.
812   * @param { ScreenCaptureConfig } config The screen capture configuration.
813   * @syscap SystemCapability.Web.Webview.Core
814   * @since 10
815   */
816  grant(config: ScreenCaptureConfig): void;
817
818  /**
819   * Reject the request.
820   * @syscap SystemCapability.Web.Webview.Core
821   * @since 10
822   */
823  deny(): void;
824}
825
826/**
827 * Defines the onDataResubmission callback, related to {@link onDataResubmission} method.
828 *
829 * @syscap SystemCapability.Web.Webview.Core
830 * @since 9
831 */
832declare class DataResubmissionHandler {
833  /**
834   * Constructor.
835   *
836   * @syscap SystemCapability.Web.Webview.Core
837   * @since 9
838   */
839  constructor();
840
841  /**
842   * Resend related form data.
843   *
844   * @syscap SystemCapability.Web.Webview.Core
845   * @since 9
846   */
847  resend(): void;
848
849  /**
850   * Do not resend related form data.
851   *
852   * @syscap SystemCapability.Web.Webview.Core
853   * @since 9
854   */
855  cancel(): void;
856}
857
858/**
859 * Defines the onWindowNew callback, related to {@link onWindowNew} method.
860 *
861 * @syscap SystemCapability.Web.Webview.Core
862 * @since 9
863 */
864declare class ControllerHandler {
865  /**
866   * Constructor.
867   *
868   * @syscap SystemCapability.Web.Webview.Core
869   * @since 9
870   */
871  constructor();
872
873  /**
874   * Set WebController object.
875   *
876   * @param { WebviewController } controller
877   * @syscap SystemCapability.Web.Webview.Core
878   * @since 9
879   */
880  setWebController(controller: WebviewController): void;
881}
882
883/**
884 * Defines the context menu source type, related to {@link onContextMenuShow} method.
885 *
886 * @enum { number }
887 * @syscap SystemCapability.Web.Webview.Core
888 * @since 9
889 */
890declare enum ContextMenuSourceType {
891  /**
892   * Other source types.
893   *
894   * @syscap SystemCapability.Web.Webview.Core
895   * @since 9
896   */
897  None,
898
899  /**
900   * Mouse.
901   *
902   * @syscap SystemCapability.Web.Webview.Core
903   * @since 9
904   */
905  Mouse,
906
907  /**
908   * Long press.
909   *
910   * @syscap SystemCapability.Web.Webview.Core
911   * @since 9
912   */
913  LongPress,
914}
915
916/**
917 * Defines the context menu media type, related to {@link onContextMenuShow} method.
918 *
919 * @enum { number }
920 * @syscap SystemCapability.Web.Webview.Core
921 * @since 9
922 */
923declare enum ContextMenuMediaType {
924  /**
925   * Not a special node or other media types.
926   *
927   * @syscap SystemCapability.Web.Webview.Core
928   * @since 9
929   */
930  None,
931
932  /**
933   * Image.
934   *
935   * @syscap SystemCapability.Web.Webview.Core
936   * @since 9
937   */
938  Image,
939}
940
941/**
942 * Defines the context menu input field type, related to {@link onContextMenuShow} method.
943 *
944 * @enum { number }
945 * @syscap SystemCapability.Web.Webview.Core
946 * @since 9
947 */
948declare enum ContextMenuInputFieldType {
949  /**
950   * Not an input field.
951   *
952   * @syscap SystemCapability.Web.Webview.Core
953   * @since 9
954   */
955  None,
956
957  /**
958   * The plain text type.
959   *
960   * @syscap SystemCapability.Web.Webview.Core
961   * @since 9
962   */
963  PlainText,
964
965  /**
966   * The password type.
967   *
968   * @syscap SystemCapability.Web.Webview.Core
969   * @since 9
970   */
971  Password,
972
973  /**
974   * The number type.
975   *
976   * @syscap SystemCapability.Web.Webview.Core
977   * @since 9
978   */
979  Number,
980
981  /**
982   * The telephone type.
983   *
984   * @syscap SystemCapability.Web.Webview.Core
985   * @since 9
986   */
987  Telephone,
988
989  /**
990   * Other types.
991   *
992   * @syscap SystemCapability.Web.Webview.Core
993   * @since 9
994   */
995  Other,
996}
997
998/**
999 * Defines the context menu supported event bit flags, related to {@link onContextMenuShow} method.
1000 *
1001 * @enum { number }
1002 * @syscap SystemCapability.Web.Webview.Core
1003 * @since 9
1004 */
1005declare enum ContextMenuEditStateFlags {
1006  NONE = 0,
1007  CAN_CUT = 1 << 0,
1008  CAN_COPY = 1 << 1,
1009  CAN_PASTE = 1 << 2,
1010  CAN_SELECT_ALL = 1 << 3,
1011}
1012
1013/**
1014 * Defines the context menu param, related to {@link WebContextMenuParam} method.
1015 *
1016 * @syscap SystemCapability.Web.Webview.Core
1017 * @since 9
1018 */
1019declare class WebContextMenuParam {
1020  /**
1021   * Constructor.
1022   *
1023   * @syscap SystemCapability.Web.Webview.Core
1024   * @since 9
1025   */
1026  constructor();
1027
1028  /**
1029   * Horizontal offset coordinates of the menu within the Web component.
1030   *
1031   * @returns { number } The context menu x coordinate.
1032   * @syscap SystemCapability.Web.Webview.Core
1033   * @since 9
1034   */
1035  x(): number;
1036
1037  /**
1038   * Vertical offset coordinates for the menu within the Web component.
1039   *
1040   * @returns { number } The context menu y coordinate.
1041   * @syscap SystemCapability.Web.Webview.Core
1042   * @since 9
1043   */
1044  y(): number;
1045
1046  /**
1047   * If the long-press location is the link returns the link's security-checked URL.
1048   *
1049   * @returns { string } If relate to a link return link url, else return null.
1050   * @syscap SystemCapability.Web.Webview.Core
1051   * @since 9
1052   */
1053  getLinkUrl(): string;
1054
1055  /**
1056   * If the long-press location is the link returns the link's original URL.
1057   *
1058   * @returns { string } If relate to a link return unfiltered link url, else return null.
1059   * @syscap SystemCapability.Web.Webview.Core
1060   * @since 9
1061   */
1062  getUnfilteredLinkUrl(): string;
1063
1064  /**
1065   * Returns the SRC URL if the selected element has a SRC attribute.
1066   *
1067   * @returns { string } If this context menu is "src" attribute, return link url, else return null.
1068   * @syscap SystemCapability.Web.Webview.Core
1069   * @since 9
1070   */
1071  getSourceUrl(): string;
1072
1073  /**
1074   * Long press menu location has image content.
1075   *
1076   * @returns { boolean } Return whether this context menu has image content.
1077   * @syscap SystemCapability.Web.Webview.Core
1078   * @since 9
1079   */
1080  existsImageContents(): boolean;
1081
1082  /**
1083   * Returns the type of context node.
1084   *
1085   * @returns { ContextMenuMediaType } Returns the type of context node.
1086   * @syscap SystemCapability.Web.Webview.Core
1087   * @since 9
1088   */
1089  getMediaType(): ContextMenuMediaType;
1090
1091  /**
1092   * Returns the text of the selection.
1093   *
1094   * @returns { string } Returns the text of the selection.
1095   * @syscap SystemCapability.Web.Webview.Core
1096   * @since 9
1097   */
1098  getSelectionText(): string;
1099
1100  /**
1101   * Returns the context menu source type.
1102   *
1103   * @returns { ContextMenuSourceType }
1104   * @syscap SystemCapability.Web.Webview.Core
1105   * @since 9
1106   */
1107  getSourceType(): ContextMenuSourceType;
1108
1109  /**
1110   * Returns input field type if the context menu was invoked on an input field.
1111   *
1112   * @returns { ContextMenuInputFieldType } Input field type if the context menu was invoked on an input field.
1113   * @syscap SystemCapability.Web.Webview.Core
1114   * @since 9
1115   */
1116  getInputFieldType(): ContextMenuInputFieldType;
1117
1118  /**
1119   * Returns whether the context is editable.
1120   *
1121   * @returns { boolean }
1122   * @syscap SystemCapability.Web.Webview.Core
1123   * @since 9
1124   */
1125  isEditable(): boolean;
1126
1127  /**
1128   * Returns the context editable flags {@link ContextMenuEditStateFlags}.
1129   *
1130   * @returns { number }
1131   * @syscap SystemCapability.Web.Webview.Core
1132   * @since 9
1133   */
1134  getEditStateFlags(): number;
1135}
1136
1137/**
1138 * Defines the context menu result, related to {@link WebContextMenuResult} method.
1139 *
1140 * @syscap SystemCapability.Web.Webview.Core
1141 * @since 9
1142 */
1143declare class WebContextMenuResult {
1144  /**
1145   * Constructor.
1146   *
1147   * @syscap SystemCapability.Web.Webview.Core
1148   * @since 9
1149   */
1150  constructor();
1151
1152  /**
1153   * When close context menu without other call in WebContextMenuResult,
1154   * User should call this function to close menu
1155   *
1156   * @syscap SystemCapability.Web.Webview.Core
1157   * @since 9
1158   */
1159  closeContextMenu(): void;
1160
1161  /**
1162   * If WebContextMenuParam has image content, this function will copy image related to this context menu.
1163   * If WebContextMenuParam has no image content, this function will do nothing.
1164   *
1165   * @syscap SystemCapability.Web.Webview.Core
1166   * @since 9
1167   */
1168  copyImage(): void;
1169
1170  /**
1171   * Executes the copy operation related to this context menu.
1172   *
1173   * @syscap SystemCapability.Web.Webview.Core
1174   * @since 9
1175   */
1176  copy(): void;
1177
1178  /**
1179   * Executes the paste operation related to this context menu.
1180   *
1181   * @syscap SystemCapability.Web.Webview.Core
1182   * @since 9
1183   */
1184  paste(): void;
1185
1186  /**
1187   * Executes the cut operation related to this context menu.
1188   *
1189   * @syscap SystemCapability.Web.Webview.Core
1190   * @since 9
1191   */
1192  cut(): void;
1193
1194  /**
1195   * Executes the selectAll operation related to this context menu.
1196   *
1197   * @syscap SystemCapability.Web.Webview.Core
1198   * @since 9
1199   */
1200  selectAll(): void;
1201}
1202
1203/**
1204 * Encompassed message information as parameters to {@link onConsole} method.
1205 *
1206 * @syscap SystemCapability.Web.Webview.Core
1207 * @since 8
1208 */
1209declare class ConsoleMessage {
1210  /**
1211   * Constructor.
1212   *
1213   * @param { string } message - The console message.
1214   * @param { string } sourceId - The Web source file's path and name.
1215   * @param { number } lineNumber - The line number of the console message.
1216   * @param { MessageLevel } messageLevel - The console log level.
1217   * @syscap SystemCapability.Web.Webview.Core
1218   * @since 8
1219   * @deprecated since 9
1220   * @useinstead ohos.web.ConsoleMessage#constructor
1221   */
1222  constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel);
1223
1224  /**
1225   * Constructor.
1226   *
1227   * @syscap SystemCapability.Web.Webview.Core
1228   * @since 9
1229   */
1230  constructor();
1231
1232  /**
1233   * Gets the message of a console message.
1234   *
1235   * @returns { string } Return the message of a console message.
1236   * @syscap SystemCapability.Web.Webview.Core
1237   * @since 8
1238   */
1239  getMessage(): string;
1240
1241  /**
1242   * Gets the Web source file's path and name of a console message.
1243   *
1244   * @returns { string } Return the Web source file's path and name of a console message.
1245   * @syscap SystemCapability.Web.Webview.Core
1246   * @since 8
1247   */
1248  getSourceId(): string;
1249
1250  /**
1251   * Gets the line number of a console message.
1252   *
1253   * @returns { number } Return the line number of a console message.
1254   * @syscap SystemCapability.Web.Webview.Core
1255   * @since 8
1256   */
1257  getLineNumber(): number;
1258
1259  /**
1260   * Gets the message level of a console message.
1261   *
1262   * @returns { MessageLevel } Return the message level of a console message, which can be {@link MessageLevel}.
1263   * @syscap SystemCapability.Web.Webview.Core
1264   * @since 8
1265   */
1266  getMessageLevel(): MessageLevel;
1267}
1268
1269/**
1270 * Encompassed message information as parameters to {@link onConsole} method.
1271 *
1272 * @syscap SystemCapability.Web.Webview.Core
1273 * @since 8
1274 */
1275/**
1276 * Defines the Web resource request.
1277 *
1278 * @syscap SystemCapability.Web.Webview.Core
1279 * @since 8
1280 */
1281/**
1282 * Defines the Web resource request.
1283 *
1284 * @syscap SystemCapability.Web.Webview.Core
1285 * @crossplatform
1286 * @since 10
1287 */
1288declare class WebResourceRequest {
1289  /**
1290   * Constructor.
1291   *
1292   * @syscap SystemCapability.Web.Webview.Core
1293   * @since 8
1294   */
1295  /**
1296   * Constructor.
1297   *
1298   * @syscap SystemCapability.Web.Webview.Core
1299   * @crossplatform
1300   * @since 10
1301   */
1302  constructor();
1303
1304  /**
1305   * Gets request headers.
1306   *
1307   * @returns { Array<Header> } Return the request headers
1308   * @syscap SystemCapability.Web.Webview.Core
1309   * @since 8
1310   */
1311  getRequestHeader(): Array<Header>;
1312
1313  /**
1314   * Gets the request URL.
1315   *
1316   * @returns { string } Return the request URL.
1317   * @syscap SystemCapability.Web.Webview.Core
1318   * @since 8
1319   */
1320  /**
1321   * Gets the request URL.
1322   *
1323   * @returns { string } Return the request URL.
1324   * @syscap SystemCapability.Web.Webview.Core
1325   * @crossplatform
1326   * @since 10
1327   */
1328  getRequestUrl(): string;
1329
1330  /**
1331   * Check whether the request is associated with gesture.
1332   *
1333   * @returns { boolean } Return {@code true} if the request is associated with gesture;return {@code false} otherwise.
1334   * @syscap SystemCapability.Web.Webview.Core
1335   * @since 8
1336   */
1337  isRequestGesture(): boolean;
1338
1339  /**
1340   * Check whether the request is for getting the main frame.
1341   *
1342   * @returns { boolean } Return {@code true} if the request is associated with gesture for getting the main frame; return {@code false} otherwise.
1343   * @syscap SystemCapability.Web.Webview.Core
1344   * @since 8
1345   */
1346  isMainFrame(): boolean;
1347
1348  /**
1349   * Check whether the request redirects.
1350   *
1351   * @returns { boolean } Return {@code true} if the request redirects; return {@code false} otherwise.
1352   * @syscap SystemCapability.Web.Webview.Core
1353   * @since 8
1354   */
1355  isRedirect(): boolean;
1356
1357  /**
1358   * Get request method.
1359   *
1360   * @returns { string } Return the request method.
1361   * @syscap SystemCapability.Web.Webview.Core
1362   * @since 9
1363   */
1364  getRequestMethod(): string;
1365}
1366
1367/**
1368 * Defines the Web resource response.
1369 *
1370 * @syscap SystemCapability.Web.Webview.Core
1371 * @since 8
1372 */
1373declare class WebResourceResponse {
1374  /**
1375   * Constructor.
1376   *
1377   * @syscap SystemCapability.Web.Webview.Core
1378   * @since 8
1379   */
1380  constructor();
1381
1382  /**
1383   * Gets the response data.
1384   *
1385   * @returns { string } Return the response data.
1386   * @syscap SystemCapability.Web.Webview.Core
1387   * @since 8
1388   */
1389  getResponseData(): string;
1390
1391  /**
1392   * Gets the response encoding.
1393   *
1394   * @returns { string } Return the response encoding.
1395   * @syscap SystemCapability.Web.Webview.Core
1396   * @since 8
1397   */
1398  getResponseEncoding(): string;
1399
1400  /**
1401   * Gets the response MIME type.
1402   *
1403   * @returns { string } Return the response MIME type.
1404   * @syscap SystemCapability.Web.Webview.Core
1405   * @since 8
1406   */
1407  getResponseMimeType(): string;
1408
1409  /**
1410   * Gets the reason message.
1411   *
1412   * @returns { string } Return the reason message.
1413   * @syscap SystemCapability.Web.Webview.Core
1414   * @since 8
1415   */
1416  getReasonMessage(): string;
1417
1418  /**
1419   * Gets the response headers.
1420   *
1421   * @returns { Array<Header> } Return the response headers.
1422   * @syscap SystemCapability.Web.Webview.Core
1423   * @since 8
1424   */
1425  getResponseHeader(): Array<Header>;
1426
1427  /**
1428   * Gets the response code.
1429   *
1430   * @returns { number } Return the response code.
1431   * @syscap SystemCapability.Web.Webview.Core
1432   * @since 8
1433   */
1434  getResponseCode(): number;
1435
1436  /**
1437   * Sets the response data.
1438   *
1439   * @param { string | number | Resource } data - the response data.
1440   * @syscap SystemCapability.Web.Webview.Core
1441   * @since 9
1442   */
1443  /**
1444   * Sets the response data.
1445   * Sets the response data.
1446   * Sets the response data.
1447   * Number represents file handle
1448   *
1449   * @param { string | number | Resource } data - the response data.
1450   *                                              string type indicate strings in HTML format.
1451   *                                              number type indicate file handle.
1452   *                                              Resource type indicate $rawfile resource.
1453   * @syscap SystemCapability.Web.Webview.Core
1454   * @since 10
1455   */
1456  setResponseData(data: string | number | Resource);
1457
1458  /**
1459   * Sets the response encoding.
1460   *
1461   * @param { string } encoding the response encoding.
1462   * @syscap SystemCapability.Web.Webview.Core
1463   * @since 9
1464   */
1465  setResponseEncoding(encoding: string);
1466
1467  /**
1468   * Sets the response MIME type.
1469   *
1470   * @param { string } mimeType the response MIME type.
1471   * @syscap SystemCapability.Web.Webview.Core
1472   * @since 9
1473   */
1474  setResponseMimeType(mimeType: string);
1475
1476  /**
1477   * Sets the reason message.
1478   *
1479   * @param { string } reason the reason message.
1480   * @syscap SystemCapability.Web.Webview.Core
1481   * @since 9
1482   */
1483  setReasonMessage(reason: string);
1484
1485  /**
1486   * Sets the response headers.
1487   *
1488   * @param { Array<Header> } header the response headers.
1489   * @syscap SystemCapability.Web.Webview.Core
1490   * @since 9
1491   */
1492  setResponseHeader(header: Array<Header>);
1493
1494  /**
1495   * Sets the response code.
1496   *
1497   * @param { number } code the response code.
1498   * @syscap SystemCapability.Web.Webview.Core
1499   * @since 9
1500   */
1501  setResponseCode(code: number);
1502
1503  /**
1504   * Sets the response is ready or not.
1505   *
1506   * @param { boolean } IsReady whether the response is ready.
1507   * @syscap SystemCapability.Web.Webview.Core
1508   * @since 9
1509   */
1510  setResponseIsReady(IsReady: boolean);
1511}
1512
1513/**
1514 * Defines the Web's request/response header.
1515 *
1516 * @interface Header
1517 * @syscap SystemCapability.Web.Webview.Core
1518 * @since 8
1519 */
1520declare interface Header {
1521  /**
1522   * Gets the key of the request/response header.
1523   *
1524   * @type { string }
1525   * @syscap SystemCapability.Web.Webview.Core
1526   * @since 8
1527   */
1528  headerKey: string;
1529
1530  /**
1531   * Gets the value of the request/response header.
1532   *
1533   * @type { string }
1534   * @syscap SystemCapability.Web.Webview.Core
1535   * @since 8
1536   */
1537  headerValue: string;
1538}
1539
1540/**
1541 * Defines the Web resource error.
1542 *
1543 * @syscap SystemCapability.Web.Webview.Core
1544 * @since 8
1545 */
1546/**
1547 * Defines the Web resource error.
1548 *
1549 * @syscap SystemCapability.Web.Webview.Core
1550 * @crossplatform
1551 * @since 10
1552 */
1553declare class WebResourceError {
1554  /**
1555   * Constructor.
1556   *
1557   * @syscap SystemCapability.Web.Webview.Core
1558   * @since 8
1559   */
1560  /**
1561   * Constructor.
1562   *
1563   * @syscap SystemCapability.Web.Webview.Core
1564   * @crossplatform
1565   * @since 10
1566   */
1567  constructor();
1568
1569  /**
1570   * Gets the info of the Web resource error.
1571   *
1572   * @returns { string } Return the info of the Web resource error.
1573   * @syscap SystemCapability.Web.Webview.Core
1574   * @since 8
1575   */
1576  /**
1577   * Gets the info of the Web resource error.
1578   *
1579   * @returns { string } Return the info of the Web resource error.
1580   * @syscap SystemCapability.Web.Webview.Core
1581   * @crossplatform
1582   * @since 10
1583   */
1584  getErrorInfo(): string;
1585
1586  /**
1587   * Gets the code of the Web resource error.
1588   *
1589   * @returns { number } Return the code of the Web resource error.
1590   * @syscap SystemCapability.Web.Webview.Core
1591   * @since 8
1592   */
1593  /**
1594   * Gets the code of the Web resource error.
1595   *
1596   * @returns { number } Return the code of the Web resource error.
1597   * @syscap SystemCapability.Web.Webview.Core
1598   * @crossplatform
1599   * @since 10
1600   */
1601  getErrorCode(): number;
1602}
1603
1604/**
1605 * Defines the js geolocation request.
1606 *
1607 * @syscap SystemCapability.Web.Webview.Core
1608 * @since 8
1609 */
1610declare class JsGeolocation {
1611  /**
1612   * Constructor.
1613   *
1614   * @syscap SystemCapability.Web.Webview.Core
1615   * @since 8
1616   */
1617  constructor();
1618
1619  /**
1620   * Report the geolocation permission status from users.
1621   *
1622   * @param { string } origin - The origin that ask for the geolocation permission.
1623   * @param { boolean } allow - The geolocation permission status.
1624   * @param { boolean } retain - Whether to allow the geolocation permission status to be saved to the system.
1625   * @syscap SystemCapability.Web.Webview.Core
1626   * @since 8
1627   */
1628  invoke(origin: string, allow: boolean, retain: boolean): void;
1629}
1630
1631/**
1632 * Defines the Web cookie.
1633 *
1634 * @syscap SystemCapability.Web.Webview.Core
1635 * @since 8
1636 */
1637declare class WebCookie {
1638  /**
1639   * Constructor.
1640   *
1641   * @syscap SystemCapability.Web.Webview.Core
1642   * @since 8
1643   */
1644  constructor();
1645
1646  /**
1647   * Sets the cookie.
1648   *
1649   * @syscap SystemCapability.Web.Webview.Core
1650   * @since 8
1651   * @deprecated since 9
1652   * @useinstead ohos.web.webview.webview.WebCookieManager#setCookie
1653   */
1654  setCookie();
1655
1656  /**
1657   * Saves the cookies.
1658   *
1659   * @syscap SystemCapability.Web.Webview.Core
1660   * @since 8
1661   * @deprecated since 9
1662   * @useinstead ohos.web.webview.webview.WebCookieManager#saveCookieAsync
1663   */
1664  saveCookie();
1665}
1666
1667/**
1668 * Defines the Web controller.
1669 *
1670 * @syscap SystemCapability.Web.Webview.Core
1671 * @since 8
1672 * @deprecated since 9
1673 * @useinstead ohos.web.webview.webview.WebviewController
1674 */
1675declare class WebController {
1676  /**
1677   * Constructor.
1678   *
1679   * @syscap SystemCapability.Web.Webview.Core
1680   * @since 8
1681   * @deprecated since 9
1682   */
1683  constructor();
1684
1685  /**
1686   * Let the Web inactive.
1687   *
1688   * @syscap SystemCapability.Web.Webview.Core
1689   * @since 8
1690   * @deprecated since 9
1691   * @useinstead ohos.web.webview.webview.WebviewController#onInactive
1692   */
1693  onInactive(): void;
1694
1695  /**
1696   * Let the Web active.
1697   *
1698   * @syscap SystemCapability.Web.Webview.Core
1699   * @since 8
1700   * @deprecated since 9
1701   * @useinstead ohos.web.webview.webview.WebviewController#onActive
1702   */
1703  onActive(): void;
1704
1705  /**
1706   * Let the Web zoom by.
1707   *
1708   * @param { number } factor The zoom factor.
1709   * @syscap SystemCapability.Web.Webview.Core
1710   * @since 8
1711   * @deprecated since 9
1712   * @useinstead ohos.web.webview.webview.WebviewController#zoom
1713   */
1714  zoom(factor: number): void;
1715
1716  /**
1717   * Clears the history in the Web.
1718   *
1719   * @syscap SystemCapability.Web.Webview.Core
1720   * @since 8
1721   * @deprecated since 9
1722   * @useinstead ohos.web.webview.webview.WebviewController#clearHistory
1723   */
1724  clearHistory(): void;
1725
1726  /**
1727   * Loads a piece of code and execute JS code in the context of the currently displayed page.
1728   *
1729   * @param { object } options The options with a piece of code and a callback.
1730   * @syscap SystemCapability.Web.Webview.Core
1731   * @since 8
1732   * @deprecated since 9
1733   * @useinstead ohos.web.webview.webview.WebviewController#runJavaScript
1734   */
1735  runJavaScript(options: { script: string, callback?: (result: string) => void });
1736
1737  /**
1738   * Loads the data or URL.
1739   *
1740   * @param { object } options The options with the data or URL and other information.
1741   * @syscap SystemCapability.Web.Webview.Core
1742   * @since 8
1743   * @deprecated since 9
1744   * @useinstead ohos.web.webview.webview.WebviewController#loadData
1745   */
1746  loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string });
1747
1748  /**
1749   * Loads the given URL.
1750   *
1751   * @param { object } options The options with the URL and other information.
1752   * @syscap SystemCapability.Web.Webview.Core
1753   * @since 8
1754   * @deprecated since 9
1755   * @useinstead ohos.web.webview.webview.WebviewController#loadUrl
1756   */
1757  loadUrl(options: { url: string | Resource, headers?: Array<Header> });
1758
1759  /**
1760   * refreshes the current URL.
1761   *
1762   * @syscap SystemCapability.Web.Webview.Core
1763   * @since 8
1764   * @deprecated since 9
1765   * @useinstead ohos.web.webview.webview.WebviewController#refresh
1766   */
1767  refresh();
1768
1769  /**
1770   * Stops the current load.
1771   *
1772   * @syscap SystemCapability.Web.Webview.Core
1773   * @since 8
1774   * @deprecated since 9
1775   * @useinstead ohos.web.webview.webview.WebviewController#stop
1776   */
1777  stop();
1778
1779  /**
1780   * Registers the JavaScript object and method list.
1781   *
1782   * @param { object } options - The option with the JavaScript object and method list.
1783   * @syscap SystemCapability.Web.Webview.Core
1784   * @since 8
1785   * @deprecated since 9
1786   * @useinstead ohos.web.webview.webview.WebviewController#registerJavaScriptProxy
1787   */
1788  registerJavaScriptProxy(options: { object: object, name: string, methodList: Array<string> });
1789
1790  /**
1791   * Deletes a registered JavaScript object with given name.
1792   *
1793   * @param { string } name - The name of a registered JavaScript object to be deleted.
1794   * @syscap SystemCapability.Web.Webview.Core
1795   * @since 8
1796   * @deprecated since 9
1797   * @useinstead ohos.web.webview.webview.WebviewController#deleteJavaScriptRegister
1798   */
1799  deleteJavaScriptRegister(name: string);
1800
1801  /**
1802   * Gets the type of HitTest.
1803   *
1804   * @returns { HitTestType } The type of HitTest.
1805   * @syscap SystemCapability.Web.Webview.Core
1806   * @since 8
1807   * @deprecated since 9
1808   * @useinstead ohos.web.webview.webview.WebviewController#getHitTest
1809   */
1810  getHitTest(): HitTestType;
1811
1812  /**
1813   * Gets the request focus.
1814   *
1815   * @syscap SystemCapability.Web.Webview.Core
1816   * @since 8
1817   * @deprecated since 9
1818   * @useinstead ohos.web.webview.webview.WebviewController#requestFocus
1819   */
1820  requestFocus();
1821
1822  /**
1823   * Checks whether the web page can go back.
1824   *
1825   * @returns { boolean } Whether the web page can go back.
1826   * @syscap SystemCapability.Web.Webview.Core
1827   * @since 8
1828   * @deprecated since 9
1829   * @useinstead ohos.web.webview.webview.WebviewController#accessBackward
1830   */
1831  accessBackward(): boolean;
1832
1833  /**
1834   * Checks whether the web page can go forward.
1835   *
1836   * @returns { boolean }
1837   * @syscap SystemCapability.Web.Webview.Core
1838   * @since 8
1839   * @deprecated since 9
1840   * @useinstead ohos.web.webview.webview.WebviewController#accessForward
1841   */
1842  accessForward(): boolean;
1843
1844  /**
1845   * Checks whether the web page can go back or forward the given number of steps.
1846   *
1847   * @param { number } step The number of steps.
1848   * @returns { boolean }
1849   * @syscap SystemCapability.Web.Webview.Core
1850   * @since 8
1851   * @deprecated since 9
1852   * @useinstead ohos.web.webview.webview.WebviewController#accessStep
1853   */
1854  accessStep(step: number): boolean;
1855
1856  /**
1857   * Goes back in the history of the web page.
1858   *
1859   * @syscap SystemCapability.Web.Webview.Core
1860   * @since 8
1861   * @deprecated since 9
1862   * @useinstead ohos.web.webview.webview.WebviewController#backward
1863   */
1864  backward();
1865
1866  /**
1867   * Goes forward in the history of the web page.
1868   *
1869   * @syscap SystemCapability.Web.Webview.Core
1870   * @since 8
1871   * @deprecated since 9
1872   * @useinstead ohos.web.webview.webview.WebviewController#forward
1873   */
1874  forward();
1875
1876  /**
1877   * Gets network cookie manager
1878   *
1879   * @returns { WebCookie }
1880   * @syscap SystemCapability.Web.Webview.Core
1881   * @since 9
1882   * @deprecated since 9
1883   */
1884  getCookieManager(): WebCookie
1885}
1886
1887/**
1888 * Defines the Web options.
1889 *
1890 * @interface WebOptions
1891 * @syscap SystemCapability.Web.Webview.Core
1892 * @since 8
1893 */
1894/**
1895 * Defines the Web options.
1896 *
1897 * @interface WebOptions
1898 * @syscap SystemCapability.Web.Webview.Core
1899 * @crossplatform
1900 * @since 10
1901 */
1902declare interface WebOptions {
1903  /**
1904   * Sets the address of the web page to be displayed.
1905   *
1906   * @type { string | Resource }
1907   * @syscap SystemCapability.Web.Webview.Core
1908   * @since 8
1909   */
1910  /**
1911   * Sets the address of the web page to be displayed.
1912   *
1913   * @type { string | Resource }
1914   * @syscap SystemCapability.Web.Webview.Core
1915   * @crossplatform
1916   * @since 10
1917   */
1918  src: string | Resource;
1919  /**
1920   * Sets the controller of the Web.
1921   *
1922   * @type { WebController | WebviewController }
1923   * @syscap SystemCapability.Web.Webview.Core
1924   * @since 8
1925   */
1926  /**
1927   * Sets the controller of the Web.
1928   *
1929   * @type { WebController | WebviewController }
1930   * @syscap SystemCapability.Web.Webview.Core
1931   * @since 9
1932  */
1933  /**
1934   * Sets the controller of the Web.
1935   *
1936   * @type { WebController | WebviewController }
1937   * @syscap SystemCapability.Web.Webview.Core
1938   * @crossplatform
1939   * @since 10
1940  */
1941  controller: WebController | WebviewController;
1942}
1943
1944/**
1945 * Defines the Web interface.
1946 *
1947 * @interface WebInterface
1948 * @syscap SystemCapability.Web.Webview.Core
1949 * @since 8
1950 */
1951/**
1952 * Defines the Web interface.
1953 *
1954 * @interface WebInterface
1955 * @syscap SystemCapability.Web.Webview.Core
1956 * @crossplatform
1957 * @since 8
1958 */
1959interface WebInterface {
1960  /**
1961   * Sets Value.
1962   *
1963   * @param { WebOptions } value
1964   * @returns { WebAttribute }
1965   * @syscap SystemCapability.Web.Webview.Core
1966   * @since 8
1967   */
1968  /**
1969   * Sets Value.
1970   *
1971   * @param { WebOptions } value
1972   * @returns { WebAttribute }
1973   * @syscap SystemCapability.Web.Webview.Core
1974   * @crossplatform
1975   * @since 10
1976   */
1977  (value: WebOptions): WebAttribute;
1978}
1979
1980/**
1981 * Defines the Web attribute functions.
1982 *
1983 * @extends CommonMethod<WebAttribute>
1984 * @syscap SystemCapability.Web.Webview.Core
1985 * @since 8
1986 */
1987/**
1988 * Defines the Web attribute functions.
1989 *
1990 * @extends CommonMethod<WebAttribute>
1991 * @syscap SystemCapability.Web.Webview.Core
1992 * @crossplatform
1993 * @since 8
1994 */
1995declare class WebAttribute extends CommonMethod<WebAttribute> {
1996  /**
1997   * Sets whether the Web allows JavaScript scripts to execute.
1998   *
1999   * @param { boolean } javaScriptAccess - {@code true} means the Web can allows JavaScript scripts to execute; {@code false} otherwise.
2000   * @returns { WebAttribute }
2001   * @syscap SystemCapability.Web.Webview.Core
2002   * @since 8
2003   */
2004  /**
2005   * Sets whether the Web allows JavaScript scripts to execute.
2006   *
2007   * @param { boolean } javaScriptAccess - {@code true} means the Web can allows JavaScript scripts to execute; {@code false} otherwise.
2008   * @returns { WebAttribute }
2009   * @syscap SystemCapability.Web.Webview.Core
2010   * @crossplatform
2011   * @since 10
2012   */
2013  javaScriptAccess(javaScriptAccess: boolean): WebAttribute;
2014
2015  /**
2016   * Sets whether enable local file system access in Web.
2017   *
2018   * @param { boolean } fileAccess - {@code true} means enable local file system access in Web; {@code false} otherwise.
2019   * @returns { WebAttribute }
2020   * @syscap SystemCapability.Web.Webview.Core
2021   * @since 8
2022   */
2023  fileAccess(fileAccess: boolean): WebAttribute;
2024
2025  /**
2026   * Sets whether to allow image resources to be loaded from the network.
2027   *
2028   * @param { boolean } onlineImageAccess - {@code true} means the Web can allow image resources to be loaded from the network;
2029   * {@code false} otherwise.
2030   * @returns { WebAttribute }
2031   * @syscap SystemCapability.Web.Webview.Core
2032   * @since 8
2033   */
2034  onlineImageAccess(onlineImageAccess: boolean): WebAttribute;
2035
2036  /**
2037   * Sets whether to enable the DOM Storage API permission.
2038   *
2039   * @param { boolean } domStorageAccess - {@code true} means enable the DOM Storage API permission in Web; {@code false} otherwise.
2040   * @returns { WebAttribute }
2041   * @syscap SystemCapability.Web.Webview.Core
2042   * @since 8
2043   */
2044  domStorageAccess(domStorageAccess: boolean): WebAttribute;
2045
2046  /**
2047   * Sets whether the Web can automatically load image resources.
2048   *
2049   * @param { boolean } imageAccess - {@code true} means the Web can automatically load image resources; {@code false} otherwise.
2050   * @returns { WebAttribute }
2051   * @syscap SystemCapability.Web.Webview.Core
2052   * @since 8
2053   */
2054  imageAccess(imageAccess: boolean): WebAttribute;
2055
2056  /**
2057   * Sets how to load HTTP and HTTPS content.
2058   *
2059   * @param { MixedMode } mixedMode - The mixed mode, which can be {@link MixedMode}.
2060   * @returns { WebAttribute }
2061   * @syscap SystemCapability.Web.Webview.Core
2062   * @since 8
2063   */
2064  mixedMode(mixedMode: MixedMode): WebAttribute;
2065
2066  /**
2067   * Sets whether the Web supports zooming using gestures.
2068   *
2069   * @param { boolean } zoomAccess {@code true} means the Web supports zooming using gestures; {@code false} otherwise.
2070   * @returns { WebAttribute }
2071   * @syscap SystemCapability.Web.Webview.Core
2072   * @since 8
2073   */
2074  /**
2075   * Sets whether the Web supports zooming using gestures.
2076   *
2077   * @param { boolean } zoomAccess {@code true} means the Web supports zooming using gestures; {@code false} otherwise.
2078   * @returns { WebAttribute }
2079   * @syscap SystemCapability.Web.Webview.Core
2080   * @crossplatform
2081   * @since 10
2082   */
2083  zoomAccess(zoomAccess: boolean): WebAttribute;
2084
2085  /**
2086   * Sets whether to allow access to geographical locations.
2087   *
2088   * @param { boolean } geolocationAccess - {@code true} means the Web allows access to geographical locations; {@code false} otherwise.
2089   * @returns { WebAttribute }
2090   * @syscap SystemCapability.Web.Webview.Core
2091   * @since 8
2092   */
2093  geolocationAccess(geolocationAccess: boolean): WebAttribute;
2094
2095  /**
2096   * Injects the JavaScript object into window and invoke the function in window.
2097   *
2098   * @param { object } javaScriptProxy - The JavaScript object to be injected.
2099   * @returns { WebAttribute }
2100   * @syscap SystemCapability.Web.Webview.Core
2101   * @since 8
2102   */
2103  /**
2104   * Injects the JavaScript object into window and invoke the function in window.
2105   *
2106   * @param { object } javaScriptProxy - The JavaScript object to be injected.
2107   * @returns { WebAttribute }
2108   * @syscap SystemCapability.Web.Webview.Core
2109   * @since 9
2110   */
2111  javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Array<string>,
2112    controller: WebController | WebviewController }): WebAttribute;
2113
2114  /**
2115   * Sets whether the Web should save the password.
2116   *
2117   * @param { boolean } password - {@code true} means the Web can save the password; {@code false} otherwise.
2118   * @returns { WebAttribute }
2119   * @syscap SystemCapability.Web.Webview.Core
2120   * @since 8
2121   * @deprecated since 10
2122   */
2123  password(password: boolean): WebAttribute;
2124
2125  /**
2126   * Sets the mode of cache in Web.
2127   *
2128   * @param { CacheMode } cacheMode - The cache mode, which can be {@link CacheMode}.
2129   * @returns { WebAttribute }
2130   * @syscap SystemCapability.Web.Webview.Core
2131   * @since 8
2132   */
2133  cacheMode(cacheMode: CacheMode): WebAttribute;
2134
2135  /**
2136   * Sets the dark mode of Web.
2137   *
2138   * @param { WebDarkMode } mode - The dark mode, which can be {@link WebDarkMode}.
2139   * @returns { WebAttribute }
2140   * @syscap SystemCapability.Web.Webview.Core
2141   * @since 9
2142   */
2143  darkMode(mode: WebDarkMode): WebAttribute;
2144
2145  /**
2146   * Sets whether to enable forced dark algorithm when the web is in dark mode
2147   *
2148   * @param { boolean } access {@code true} means enable the force dark algorithm; {@code false} otherwise.
2149   * @returns { WebAttribute }
2150   * @syscap SystemCapability.Web.Webview.Core
2151   * @since 9
2152   */
2153  forceDarkAccess(access: boolean): WebAttribute;
2154
2155  /**
2156   * Sets the media options.
2157   *
2158   * @param { WebMediaOptions } options The media options, which can be {@link WebMediaOptions}.
2159   * @returns { WebAttribute }
2160   * @syscap SystemCapability.Web.Webview.Core
2161   * @since 10
2162   */
2163  mediaOptions(options: WebMediaOptions): WebAttribute;
2164
2165  /**
2166   * Sets whether the Web should save the table data.
2167   *
2168   * @param { boolean } tableData {@code true} means the Web can save the table data; {@code false} otherwise.
2169   * @returns { WebAttribute }
2170   * @syscap SystemCapability.Web.Webview.Core
2171   * @since 8
2172   * @deprecated since 10
2173   */
2174  tableData(tableData: boolean): WebAttribute;
2175
2176  /**
2177   * Sets whether the Web access meta 'viewport' in HTML.
2178   *
2179   * @param { boolean } wideViewModeAccess {@code true} means the Web access meta 'viewport' in HTML; {@code false} otherwise.
2180   * @returns { WebAttribute }
2181   * @syscap SystemCapability.Web.Webview.Core
2182   * @since 8
2183   * @deprecated since 10
2184   */
2185  wideViewModeAccess(wideViewModeAccess: boolean): WebAttribute;
2186
2187  /**
2188   * Sets whether the Web access overview mode.
2189   *
2190   * @param { boolean } overviewModeAccess {@code true} means the Web access overview mode; {@code false} otherwise.
2191   * @returns { WebAttribute }
2192   * @syscap SystemCapability.Web.Webview.Core
2193   * @since 8
2194   */
2195  overviewModeAccess(overviewModeAccess: boolean): WebAttribute;
2196
2197  /**
2198   * Sets the ratio of the text zoom.
2199   *
2200   * @param { number } textZoomAtio The ratio of the text zoom.
2201   * @returns { WebAttribute }
2202   * @syscap SystemCapability.Web.Webview.Core
2203   * @since 8
2204   * @deprecated since 9
2205   * @useinstead ohos.web.WebAttribute#textZoomRatio
2206   */
2207  textZoomAtio(textZoomAtio: number): WebAttribute;
2208
2209  /**
2210   * Sets the ratio of the text zoom.
2211   *
2212   * @param { number } textZoomRatio The ratio of the text zoom.
2213   * @returns { WebAttribute }
2214   * @syscap SystemCapability.Web.Webview.Core
2215   * @since 9
2216   */
2217  textZoomRatio(textZoomRatio: number): WebAttribute;
2218
2219  /**
2220   * Sets whether the Web access the database.
2221   *
2222   * @param { boolean } databaseAccess {@code true} means the Web access the database; {@code false} otherwise.
2223   * @returns { WebAttribute }
2224   * @syscap SystemCapability.Web.Webview.Core
2225   * @since 8
2226   */
2227  databaseAccess(databaseAccess: boolean): WebAttribute;
2228
2229  /**
2230   * Sets the initial scale for the Web.
2231   *
2232   * @param { number } percent the initial scale for the Web.
2233   * @returns { WebAttribute }
2234   * @syscap SystemCapability.Web.Webview.Core
2235   * @since 9
2236   */
2237  initialScale(percent: number): WebAttribute;
2238
2239  /**
2240   * Sets the Web's user agent.
2241   *
2242   * @param { string } userAgent The Web's user agent.
2243   * @returns { WebAttribute }
2244   * @syscap SystemCapability.Web.Webview.Core
2245   * @since 8
2246   * @deprecated since 10
2247   * @useinstead ohos.web.webview.webview.WebviewController#setCustomUserAgent
2248   */
2249  userAgent(userAgent: string): WebAttribute;
2250
2251  /**
2252   * Triggered at the end of web page loading.
2253   *
2254   * @param { function } callback The triggered function at the end of web page loading.
2255   * @returns { WebAttribute }
2256   * @syscap SystemCapability.Web.Webview.Core
2257   * @since 8
2258   */
2259  /**
2260   * Triggered at the end of web page loading.
2261   *
2262   * @param { function } callback The triggered function at the end of web page loading.
2263   * @returns { WebAttribute }
2264   * @syscap SystemCapability.Web.Webview.Core
2265   * @crossplatform
2266   * @since 10
2267   */
2268  onPageEnd(callback: (event?: {
2269    /**
2270     * The url of page.
2271     *
2272     * @syscap SystemCapability.Web.Webview.Core
2273     * @crossplatform
2274     * @since 10
2275     */
2276    url: string
2277  }) => void): WebAttribute;
2278
2279  /**
2280   * Triggered at the begin of web page loading.
2281   *
2282   * @param { function } callback The triggered function at the begin of web page loading.
2283   * @returns { WebAttribute }
2284   * @syscap SystemCapability.Web.Webview.Core
2285   * @since 8
2286   */
2287  /**
2288   * Triggered at the begin of web page loading.
2289   *
2290   * @param { function } callback The triggered function at the begin of web page loading.
2291   * @returns { WebAttribute }
2292   * @syscap SystemCapability.Web.Webview.Core
2293   * @crossplatform
2294   * @since 10
2295   */
2296  onPageBegin(callback: (event?: {
2297    /**
2298     * The url of page.
2299     *
2300     * @syscap SystemCapability.Web.Webview.Core
2301     * @crossplatform
2302     * @since 10
2303     */
2304    url: string
2305  }) => void): WebAttribute;
2306
2307  /**
2308   * Triggered when the page loading progress changes.
2309   *
2310   * @param { function } callback The triggered function when the page loading progress changes.
2311   * @returns { WebAttribute }
2312   * @syscap SystemCapability.Web.Webview.Core
2313   * @since 8
2314   */
2315  onProgressChange(callback: (event?: { newProgress: number }) => void): WebAttribute;
2316
2317  /**
2318   * Triggered when the title of the main application document changes.
2319   *
2320   * @param { function } callback The triggered function when the title of the main application document changes.
2321   * @returns { WebAttribute }
2322   * @syscap SystemCapability.Web.Webview.Core
2323   * @since 8
2324   */
2325  onTitleReceive(callback: (event?: { title: string }) => void): WebAttribute;
2326
2327  /**
2328   * Triggered when requesting to hide the geolocation.
2329   *
2330   * @param { function } callback The triggered function when requesting to hide the geolocation permission.
2331   * @returns { WebAttribute }
2332   * @syscap SystemCapability.Web.Webview.Core
2333   * @since 8
2334   */
2335  onGeolocationHide(callback: () => void): WebAttribute;
2336
2337  /**
2338   * Triggered when requesting to show the geolocation permission.
2339   *
2340   * @param { function } callback The triggered function when requesting to show the geolocation permission.
2341   * @returns { WebAttribute }
2342   * @syscap SystemCapability.Web.Webview.Core
2343   * @since 8
2344   */
2345  onGeolocationShow(callback: (event?: { origin: string, geolocation: JsGeolocation }) => void): WebAttribute;
2346
2347  /**
2348   * Triggered when the Web gets the focus.
2349   *
2350   * @param { function } callback The triggered function when the Web gets the focus.
2351   * @returns { WebAttribute }
2352   * @syscap SystemCapability.Web.Webview.Core
2353   * @since 8
2354   */
2355  onRequestSelected(callback: () => void): WebAttribute;
2356
2357  /**
2358   * Triggered when the Web wants to display a JavaScript alert() dialog.
2359   *
2360   * @param { function } callback The triggered function when the web page wants to display a JavaScript alert() dialog.
2361   * @returns { WebAttribute }
2362   * @syscap SystemCapability.Web.Webview.Core
2363   * @since 8
2364   */
2365  onAlert(callback: (event?: { url: string, message: string, result: JsResult }) => boolean): WebAttribute;
2366
2367  /**
2368   * Triggered when the Web wants to confirm navigation from JavaScript onbeforeunload.
2369   *
2370   * @param { function } callback The triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload.
2371   * @returns { WebAttribute }
2372   * @syscap SystemCapability.Web.Webview.Core
2373   * @since 8
2374   */
2375  onBeforeUnload(callback: (event?: { url: string, message: string, result: JsResult }) => boolean): WebAttribute;
2376
2377  /**
2378   * Triggered when the web page wants to display a JavaScript confirm() dialog.
2379   *
2380   * @param { function } callback The Triggered function when the web page wants to display a JavaScript confirm() dialog.
2381   * @returns { WebAttribute }
2382   * @syscap SystemCapability.Web.Webview.Core
2383   * @since 8
2384   */
2385  onConfirm(callback: (event?: { url: string, message: string, result: JsResult }) => boolean): WebAttribute;
2386
2387  /**
2388   * Triggered when the web page wants to display a JavaScript prompt() dialog.
2389   *
2390   * @param { function } callback The Triggered function when the web page wants to display a JavaScript prompt() dialog.
2391   * @returns { WebAttribute }
2392   * @syscap SystemCapability.Web.Webview.Core
2393   * @since 9
2394   */
2395  onPrompt(callback: (event?: { url: string, message: string, value: string, result: JsResult }) => boolean): WebAttribute;
2396
2397  /**
2398   * Triggered when the web page receives a JavaScript console message.
2399   *
2400   * @param { function } callback The triggered function when the web page receives a JavaScript console message.
2401   * @returns { WebAttribute }
2402   * @syscap SystemCapability.Web.Webview.Core
2403   * @since 8
2404   */
2405  onConsole(callback: (event?: { message: ConsoleMessage }) => boolean): WebAttribute;
2406
2407  /**
2408   * Triggered when the web page receives a web resource loading error.
2409   *
2410   * @param { function } callback The triggered function when the web page receives a web resource loading error.
2411   * @returns { WebAttribute }
2412   * @syscap SystemCapability.Web.Webview.Core
2413   * @since 8
2414   */
2415  /**
2416   * Triggered when the web page receives a web resource loading error.
2417   *
2418   * @param { function } callback The triggered function when the web page receives a web resource loading error.
2419   * @returns { WebAttribute }
2420   * @syscap SystemCapability.Web.Webview.Core
2421   * @crossplatform
2422   * @since 10
2423   */
2424  onErrorReceive(callback: (event?: {
2425    /**
2426     * The url of error event.
2427     *
2428     * @syscap SystemCapability.Web.Webview.Core
2429     * @crossplatform
2430     * @since 10
2431     */
2432    request: WebResourceRequest,
2433    /**
2434     * The information of error event.
2435     *
2436     * @syscap SystemCapability.Web.Webview.Core
2437     * @crossplatform
2438     * @since 10
2439     */
2440    error: WebResourceError
2441  }) => void): WebAttribute;
2442
2443  /**
2444   * Triggered when the web page receives a web resource loading HTTP error.
2445   *
2446   * @param { function } callback The triggered function when the web page receives a web resource loading HTTP error.
2447   * @returns { WebAttribute }
2448   * @syscap SystemCapability.Web.Webview.Core
2449   * @since 8
2450   */
2451  onHttpErrorReceive(callback: (event?: { request: WebResourceRequest,
2452    response: WebResourceResponse }) => void): WebAttribute;
2453
2454  /**
2455   * Triggered when starting to download.
2456   *
2457   * @param { function } callback The triggered function when starting to download.
2458   * @returns { WebAttribute }
2459   * @syscap SystemCapability.Web.Webview.Core
2460   * @since 8
2461   */
2462  onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisposition: string, mimetype: string,
2463    contentLength: number }) => void): WebAttribute;
2464
2465  /**
2466   * Triggered when the Web page refreshes accessed history.
2467   *
2468   * @param { function } callback The triggered callback when the Web page refreshes accessed history.
2469   * @returns { WebAttribute }
2470   * @syscap SystemCapability.Web.Webview.Core
2471   * @since 8
2472   */
2473  onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean }) => void): WebAttribute;
2474
2475  /**
2476   * Triggered when the URL loading is intercepted.
2477   *
2478   * @param { function } callback The triggered callback when the URL loading is intercepted.
2479   * @returns { WebAttribute }
2480   * @syscap SystemCapability.Web.Webview.Core
2481   * @since 8
2482   * @deprecated since 10
2483   * @useinstead ohos.web.WebAttribute#onLoadIntercept
2484   */
2485  onUrlLoadIntercept(callback: (event?: { data: string | WebResourceRequest }) => boolean): WebAttribute;
2486
2487  /**
2488   * Triggered when the Web page receives an ssl Error.
2489   *
2490   * @param { function } callback The triggered callback when the Web page receives an ssl Error.
2491   * @returns { WebAttribute }
2492   * @syscap SystemCapability.Web.Webview.Core
2493   * @since 8
2494   * @deprecated since 9
2495   * @useinstead ohos.web.WebAttribute#onSslErrorEventReceive
2496   */
2497  onSslErrorReceive(callback: (event?: { handler: Function, error: object }) => void): WebAttribute;
2498
2499  /**
2500   * Triggered when the render process exits.
2501   *
2502   * @param { function } callback The triggered when the render process exits.
2503   * @returns { WebAttribute }
2504   * @syscap SystemCapability.Web.Webview.Core
2505   * @since 9
2506   */
2507  onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => void): WebAttribute;
2508
2509  /**
2510   * Triggered when the file selector shows.
2511   *
2512   * @param { function } callback The triggered when the file selector shows.
2513   * @returns { WebAttribute }
2514   * @syscap SystemCapability.Web.Webview.Core
2515   * @since 9
2516   */
2517  onShowFileSelector(callback: (event?: { result: FileSelectorResult,
2518    fileSelector: FileSelectorParam }) => boolean): WebAttribute;
2519
2520  /**
2521   * Triggered when the render process exits.
2522   *
2523   * @param { function } callback The triggered when the render process exits.
2524   * @returns { WebAttribute }
2525   * @syscap SystemCapability.Web.Webview.Core
2526   * @since 8
2527   * @deprecated since 9
2528   * @useinstead ohos.web.WebAttribute#onRenderExited
2529   */
2530  onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute;
2531
2532  /**
2533   * Triggered when the file selector shows.
2534   *
2535   * @param { function } callback The triggered when the file selector shows.
2536   * @returns { WebAttribute }
2537   * @syscap SystemCapability.Web.Webview.Core
2538   * @since 8
2539   * @deprecated since 9
2540   * @useinstead ohos.web.WebAttribute#onShowFileSelector
2541   */
2542  onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute;
2543
2544  /**
2545   * Triggered when the url loading.
2546   *
2547   * @param { function } callback The triggered when the url loading.
2548   * @returns { WebAttribute }
2549   * @syscap SystemCapability.Web.Webview.Core
2550   * @since 9
2551   */
2552  onResourceLoad(callback: (event: { url: string }) => void): WebAttribute;
2553
2554  /**
2555   * Triggered when the web component exit the full screen mode.
2556   *
2557   * @param { function } callback The triggered function when the web component exit the full screen mode.
2558   * @returns { WebAttribute }
2559   * @syscap SystemCapability.Web.Webview.Core
2560   * @since 9
2561   */
2562  onFullScreenExit(callback: () => void): WebAttribute;
2563
2564  /**
2565   * Triggered when the web component enter the full screen mode.
2566   *
2567   * @param { function } callback The triggered function when the web component enter the full screen mode.
2568   * @returns { WebAttribute }
2569   * @syscap SystemCapability.Web.Webview.Core
2570   * @since 9
2571   */
2572  onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler }) => void): WebAttribute;
2573
2574  /**
2575   * Triggered when the scale of WebView changed.
2576   *
2577   * @param { function } callback The triggered when the scale of WebView changed.
2578   * @returns { WebAttribute }
2579   * @syscap SystemCapability.Web.Webview.Core
2580   * @since 9
2581   */
2582  onScaleChange(callback: (event: { oldScale: number, newScale: number }) => void): WebAttribute;
2583
2584  /**
2585   * Triggered when the browser needs credentials from the user.
2586   *
2587   * @param { function } callback The triggered when the browser needs credentials from the user.
2588   * @returns { WebAttribute }
2589   * @syscap SystemCapability.Web.Webview.Core
2590   * @since 9
2591   */
2592  onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler, host: string, realm: string }) => boolean): WebAttribute;
2593
2594  /**
2595   * Triggered when the resources loading is intercepted.
2596   *
2597   * @param { function } callback The triggered callback when the resources loading is intercepted.
2598   * @returns { WebAttribute } If the response value is null, the Web will continue to load the resources. Otherwise, the response value will be used
2599   * @syscap SystemCapability.Web.Webview.Core
2600   * @since 9
2601   */
2602  onInterceptRequest(callback: (event?: { request: WebResourceRequest }) => WebResourceResponse): WebAttribute;
2603
2604  /**
2605   * Triggered when the host application that web content from the specified origin is attempting to access the resources.
2606   *
2607   * @param { function } callback The triggered callback when the host application that web content from the specified origin is
2608   *     attempting to access the resources.
2609   * @returns { WebAttribute }
2610   * @syscap SystemCapability.Web.Webview.Core
2611   * @since 9
2612   */
2613  onPermissionRequest(callback: (event?: { request: PermissionRequest }) => void): WebAttribute;
2614
2615  /**
2616   * Triggered when the host application that web content from the specified origin is requesting to capture screen.
2617   * @param { function } callback The triggered callback when the host application that web content from the specified origin is
2618   *     requesting to capture screen.
2619   * @returns { WebAttribute }
2620   * @syscap SystemCapability.Web.Webview.Core
2621   * @since 10
2622   */
2623  onScreenCaptureRequest(callback: (event?: { handler: ScreenCaptureHandler }) => void): WebAttribute;
2624
2625  /**
2626   * Triggered when called to allow custom display of the context menu.
2627   *
2628   * @param { function } callback The triggered callback when called to allow custom display of the context menu.
2629   * @returns { WebAttribute } If custom display return true.Otherwise, default display return false.
2630   * @syscap SystemCapability.Web.Webview.Core
2631   * @since 9
2632   */
2633  onContextMenuShow(callback: (event?: { param: WebContextMenuParam, result: WebContextMenuResult }) => boolean): WebAttribute;
2634
2635  /**
2636   * Set whether media playback needs to be triggered by user gestures.
2637   *
2638   * @param { boolean } access True if it needs to be triggered manually by the user else false.
2639   * @returns { WebAttribute }
2640   * @syscap SystemCapability.Web.Webview.Core
2641   * @since 9
2642   */
2643  mediaPlayGestureAccess(access: boolean): WebAttribute;
2644
2645  /**
2646   * Notify search result to host application through onSearchResultReceive.
2647   *
2648   * @param { function } callback Function Triggered when the host application call searchAllAsync
2649   * or searchNext api on WebController and the request is valid.
2650   * @returns { WebAttribute }
2651   * @syscap SystemCapability.Web.Webview.Core
2652   * @since 9
2653   */
2654  onSearchResultReceive(callback: (event?: { activeMatchOrdinal: number, numberOfMatches: number, isDoneCounting: boolean }) => void): WebAttribute
2655
2656  /**
2657   * Triggered when the scroll bar slides to the specified position.
2658   *
2659   * @param { function } callback Function Triggered when the scroll bar slides to the specified position.
2660   * @returns { WebAttribute }
2661   * @syscap SystemCapability.Web.Webview.Core
2662   * @since 9
2663   */
2664  onScroll(callback: (event: { xOffset: number, yOffset: number }) => void): WebAttribute;
2665
2666  /**
2667   * Triggered when the Web page receives an ssl Error.
2668   *
2669   * @param { function } callback The triggered callback when the Web page receives an ssl Error.
2670   * @returns { WebAttribute }
2671   * @syscap SystemCapability.Web.Webview.Core
2672   * @since 9
2673   */
2674  onSslErrorEventReceive(callback: (event: { handler: SslErrorHandler, error: SslError }) => void): WebAttribute;
2675
2676  /**
2677   * Triggered when the Web page needs ssl client certificate from the user.
2678   *
2679   * @param { function } callback The triggered callback when needs ssl client certificate from the user.
2680   * @returns { WebAttribute }
2681   * @syscap SystemCapability.Web.Webview.Core
2682   * @since 9
2683   */
2684  onClientAuthenticationRequest(callback: (event: {handler : ClientAuthenticationHandler, host : string, port : number,
2685    keyTypes : Array<string>, issuers : Array<string>}) => void): WebAttribute;
2686
2687  /**
2688   * Triggered when web page requires the user to create a window.
2689   *
2690   * @param { function } callback The triggered callback when web page requires the user to create a window.
2691   * @returns { WebAttribute }
2692   * @syscap SystemCapability.Web.Webview.Core
2693   * @since 9
2694   */
2695  onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetUrl: string,
2696    handler: ControllerHandler}) => void): WebAttribute;
2697
2698  /**
2699   * Triggered when web page requires the user to close a window.
2700   *
2701   * @param { function } callback The triggered callback when web page requires the user to close a window.
2702   * @returns { WebAttribute }
2703   * @syscap SystemCapability.Web.Webview.Core
2704   * @since 9
2705   */
2706  onWindowExit(callback: () => void): WebAttribute;
2707
2708  /**
2709   * Set whether multiple windows are supported.
2710   *
2711   * @param { boolean } multiWindow True if it needs to be triggered manually by the user else false.
2712   * @returns { WebAttribute }
2713   * @syscap SystemCapability.Web.Webview.Core
2714   * @since 9
2715   */
2716  multiWindowAccess(multiWindow: boolean): WebAttribute;
2717
2718  /**
2719   * Key events notify the application before the WebView consumes them.
2720   *
2721   * @param { function } callback Key event info.
2722   * @returns { WebAttribute } True if the application consumes key events else false.
2723   * @syscap SystemCapability.Web.Webview.Core
2724   * @since 9
2725   */
2726  onInterceptKeyEvent(callback: (event: KeyEvent) => boolean): WebAttribute;
2727
2728  /**
2729   * Set the font of webview standard font library. The default font is "sans serif".
2730   *
2731   * @param { string } family Standard font set series.
2732   * @returns { WebAttribute }
2733   * @syscap SystemCapability.Web.Webview.Core
2734   * @since 9
2735   */
2736  webStandardFont(family: string): WebAttribute;
2737
2738  /**
2739   * Set the font of webview serif font library. The default font is "serif".
2740   *
2741   * @param { string } family Serif font set series.
2742   * @returns { WebAttribute }
2743   * @syscap SystemCapability.Web.Webview.Core
2744   * @since 9
2745   */
2746  webSerifFont(family: string): WebAttribute;
2747
2748  /**
2749   * Set the font of webview sans serif font library. The default font is "sans-serif".
2750   *
2751   * @param { string } family Sans serif font set series.
2752   * @returns { WebAttribute }
2753   * @syscap SystemCapability.Web.Webview.Core
2754   * @since 9
2755   */
2756  webSansSerifFont(family: string): WebAttribute;
2757
2758  /**
2759   * Set the font of webview fixed font library. The default font is "monospace".
2760   *
2761   * @param { string } family Fixed font set series.
2762   * @returns { WebAttribute }
2763   * @syscap SystemCapability.Web.Webview.Core
2764   * @since 9
2765   */
2766  webFixedFont(family: string): WebAttribute;
2767
2768  /**
2769   * Set the font of webview fantasy font library. The default font is "fantasy".
2770   *
2771   * @param { string } family fantasy font set series.
2772   * @returns { WebAttribute }
2773   * @syscap SystemCapability.Web.Webview.Core
2774   * @since 9
2775   */
2776  webFantasyFont(family: string): WebAttribute;
2777
2778  /**
2779   * Set the font of webview cursive font library. The default font is "cursive".
2780   *
2781   * @param { string } family Cursive font set series.
2782   * @returns { WebAttribute }
2783   * @syscap SystemCapability.Web.Webview.Core
2784   * @since 9
2785   */
2786  webCursiveFont(family: string): WebAttribute;
2787
2788  /**
2789   * Set the default fixed font value of webview. The default value is 13, ranging from 1 to 72.
2790   *
2791   * @param { number } size Font size.
2792   * @returns { WebAttribute }
2793   * @syscap SystemCapability.Web.Webview.Core
2794   * @since 9
2795   */
2796  defaultFixedFontSize(size: number): WebAttribute;
2797
2798  /**
2799  * Set the default font value of webview. The default value is 16, ranging from 1 to 72.
2800   *
2801   * @param { number } size Font size.
2802   * @returns { WebAttribute }
2803   * @syscap SystemCapability.Web.Webview.Core
2804   * @since 9
2805   */
2806  defaultFontSize(size: number): WebAttribute;
2807
2808  /**
2809  * Set the minimum value of webview font. The default value is 8, ranging from 1 to 72.
2810   *
2811   * @param { number } size Font size.
2812   * @returns { WebAttribute }
2813   * @syscap SystemCapability.Web.Webview.Core
2814   * @since 9
2815   */
2816  minFontSize(size: number): WebAttribute;
2817
2818  /**
2819  * Set the logical minimum value of webview font. The default value is 8, ranging from 1 to 72.
2820   *
2821   * @param { number } size Font size.
2822   * @returns { WebAttribute }
2823   * @syscap SystemCapability.Web.Webview.Core
2824   * @since 9
2825   */
2826  minLogicalFontSize(size: number): WebAttribute;
2827
2828  /**
2829   * Whether web component can load resource from network.
2830   *
2831   * @param { boolean } block {@code true} means it can't load resource from network; {@code false} otherwise.
2832   * @returns { WebAttribute }
2833   * @syscap SystemCapability.Web.Webview.Core
2834   * @since 9
2835   */
2836  blockNetwork(block: boolean): WebAttribute;
2837
2838  /**
2839   * Set whether paint horizontal scroll bar.
2840   *
2841   * @param { boolean } horizontalScrollBar True if it needs to paint horizontal scroll bar.
2842   * @returns { WebAttribute }
2843   * @syscap SystemCapability.Web.Webview.Core
2844   * @since 9
2845   */
2846  horizontalScrollBarAccess(horizontalScrollBar: boolean): WebAttribute;
2847
2848  /**
2849   * Set whether paint vertical scroll bar.
2850   *
2851   * @param { boolean } verticalScrollBar True if it needs to paint vertical scroll bar.
2852   * @returns { WebAttribute }
2853   * @syscap SystemCapability.Web.Webview.Core
2854   * @since 9
2855   */
2856  verticalScrollBarAccess(verticalScrollBar: boolean): WebAttribute;
2857
2858  /**
2859   * Triggered when the application receive the url of an apple-touch-icon.
2860   *
2861   * @param { function } callback The triggered callback when the application receive an new url of an
2862   * apple-touch-icon.
2863   * @returns { WebAttribute }
2864   * @syscap SystemCapability.Web.Webview.Core
2865   * @since 9
2866   */
2867  onTouchIconUrlReceived(callback: (event: {url: string,
2868    precomposed: boolean}) => void): WebAttribute;
2869
2870  /**
2871   * Triggered when the application receive a new favicon for the current web page.
2872   *
2873   * @param { function } callback The triggered callback when the application receive a new favicon for the
2874   * current web page.
2875   * @returns { WebAttribute }
2876   * @syscap SystemCapability.Web.Webview.Core
2877   * @since 9
2878   */
2879  onFaviconReceived(callback: (event: { favicon: PixelMap }) => void): WebAttribute;
2880
2881  /**
2882   * Triggered when previous page will no longer be drawn and next page begin to draw.
2883   *
2884   * @param { function } callback The triggered callback when previous page will no longer be drawn and next
2885   * page begin to draw.
2886   * @returns { WebAttribute }
2887   * @syscap SystemCapability.Web.Webview.Core
2888   * @since 9
2889   */
2890  onPageVisible(callback: (event: { url: string }) => void): WebAttribute;
2891
2892  /**
2893   * Triggered when the form could be resubmitted.
2894   *
2895   * @param { function } callback The triggered callback to decision whether resend form data or not.
2896   * @returns { WebAttribute }
2897   * @syscap SystemCapability.Web.Webview.Core
2898   * @since 9
2899   */
2900  onDataResubmitted(callback: (event: { handler: DataResubmissionHandler }) => void): WebAttribute;
2901
2902  /**
2903   * Set whether enable pinch smooth mode.
2904   *
2905   * @param { boolean } isEnabled True if it needs to enable smooth mode.
2906   * @returns { WebAttribute }
2907   * @syscap SystemCapability.Web.Webview.Core
2908   * @since 9
2909   */
2910  pinchSmooth(isEnabled: boolean): WebAttribute;
2911
2912  /**
2913   * Whether the window can be open automatically through JavaScript.
2914   *
2915   * @param { boolean } flag If it is true, the window can be opened automatically through JavaScript.
2916   * If it is false and user behavior, the window can be opened automatically through JavaScript.
2917   * Otherwise, the window cannot be opened.
2918   * @returns { WebAttribute }
2919   * @syscap SystemCapability.Web.Webview.Core
2920   * @since 10
2921   */
2922  allowWindowOpenMethod(flag: boolean): WebAttribute;
2923
2924  /**
2925   * Triggered when the playing state of audio on web page changed.
2926   *
2927   * @param { function } callback The playing state of audio on web page.
2928   * @returns { WebAttribute }
2929   * @syscap SystemCapability.Web.Webview.Core
2930   * @since 10
2931   */
2932  onAudioStateChanged(callback: (event: { playing: boolean }) => void): WebAttribute;
2933
2934  /**
2935   * Triggered when the first content rendering of web page.
2936   *
2937   * @param { function } callback
2938   * @returns { WebAttribute }
2939   * @syscap SystemCapability.Web.Webview.Core
2940   * @since 10
2941   */
2942  onFirstContentfulPaint(callback: (event?: { navigationStartTick: number,
2943    firstContentfulPaintMs: number }) => void): WebAttribute;
2944
2945  /**
2946   * Triggered when the resources loading is intercepted.
2947   *
2948   * @param { function } callback The triggered callback when the resources loading is intercepted.
2949   * @returns { WebAttribute }
2950   * @syscap SystemCapability.Web.Webview.Core
2951   * @since 10
2952   */
2953  onLoadIntercept(callback: (event: { data: WebResourceRequest }) => boolean): WebAttribute;
2954
2955  /**
2956   * Triggered when The controller is bound to the web component, this controller must be a WebviewController.
2957   * This callback can not use the interface about manipulating web pages.
2958   * @param { function } callback The triggered callback when web controller initialization success.
2959   * @returns { WebAttribute }
2960   * @syscap SystemCapability.Web.Webview.Core
2961   * @since 10
2962   */
2963  onControllerAttached(callback: () => void): WebAttribute;
2964
2965  /**
2966   * Triggered when the over scrolling.
2967   * @param { function } callback Function Triggered when the over scrolling.
2968   * @returns { WebAttribute }
2969   * @syscap SystemCapability.Web.Webview.Core
2970   * @since 10
2971   */
2972  onOverScroll(callback: (event: { xOffset: number, yOffset: number }) => void): WebAttribute;
2973}
2974
2975/**
2976 * Defines Web Component.
2977 *
2978 * @syscap SystemCapability.Web.Webview.Core
2979 * @since 8
2980 */
2981/**
2982 * Defines Web Component.
2983 *
2984 * @syscap SystemCapability.Web.Webview.Core
2985 * @crossplatform
2986 * @since 10
2987 */
2988declare const Web: WebInterface;
2989
2990/**
2991 * Defines Web Component instance.
2992 *
2993 * @syscap SystemCapability.Web.Webview.Core
2994 * @since 8
2995 */
2996declare const WebInstance: WebAttribute;
2997