001package Torello.Browser.BrowserAPI;
002
003// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
004// Java-HTML Imports
005// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
006
007import Torello.Browser.*;
008import Torello.Browser.helper.*;
009import Torello.Browser.JavaScriptAPI.*;
010import Torello.JSON.*;
011
012import Torello.Java.ReadOnly.ReadOnlyList;
013import Torello.Java.ReadOnly.ReadOnlyArrayList;
014
015import Torello.JavaDoc.Annotations.StaticFunctional;
016import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg;
017
018import Torello.Browser.BrowserAPI.NestedHelpers.Commands.Browser$$Commands;
019
020
021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
022// JDK Imports
023// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
024
025import javax.json.JsonObject;
026import javax.json.JsonValue;
027
028/**
029 * <SPAN CLASS=COPIEDJDK><B>The Browser domain defines methods and events for browser managing.</B></SPAN>
030 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE>
031 */
032@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE")
033public class Browser
034{
035    // No Pubic Constructors
036    private Browser() { }
037
038
039    // ********************************************************************************************
040    // ********************************************************************************************
041    // Eliminated Types
042    // ********************************************************************************************
043    // ********************************************************************************************
044
045
046    /**
047     * <CODE>[No Description Provided by Google]</CODE>
048     * 
049     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
050
051     * <EMBED CLASS='external-html' DATA-CTAS='String' DATA-FILE-ID=CDP.EliminatedType
052     *     DATA-NAME=BrowserContextID>
053     */
054    public static final String BrowserContextID =
055        "BrowserContextID has been eliminated.\n" +
056        "It was replaced with the standard Java-Type: String";
057
058    /**
059     * <CODE>[No Description Provided by Google]</CODE>
060     * 
061     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
062
063     * <EMBED CLASS='external-html' DATA-CTAS='int' DATA-FILE-ID=CDP.EliminatedType
064     *     DATA-NAME=WindowID>
065     */
066    public static final String WindowID =
067        "WindowID has been eliminated.\n" +
068        "It was replaced with the standard Java-Type: int";
069
070
071    // ********************************************************************************************
072    // ********************************************************************************************
073    // Enumerated String Constants Lists
074    // ********************************************************************************************
075    // ********************************************************************************************
076
077
078    /**
079     * Browser command ids used by executeBrowserCommand.
080     * 
081     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
082     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
083     */
084    public static final ReadOnlyList<String> BrowserCommandId = new ReadOnlyArrayList<>
085        (String.class, "closeTabSearch", "openGlic", "openTabSearch");
086
087    /**
088     * <CODE>[No Description Provided by Google]</CODE>
089     * 
090     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
091     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
092     */
093    public static final ReadOnlyList<String> PermissionSetting = new ReadOnlyArrayList<>
094        (String.class, "denied", "granted", "prompt");
095
096    /**
097     * <CODE>[No Description Provided by Google]</CODE>
098     * 
099     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
100     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
101     */
102    public static final ReadOnlyList<String> PermissionType = new ReadOnlyArrayList<>(
103        String.class, 
104        "ar", "audioCapture", "automaticFullscreen", "backgroundFetch", "backgroundSync",
105        "cameraPanTiltZoom", "capturedSurfaceControl", "clipboardReadWrite",
106        "clipboardSanitizedWrite", "displayCapture", "durableStorage", "geolocation",
107        "handTracking", "idleDetection", "keyboardLock", "localFonts", "localNetworkAccess", "midi",
108        "midiSysex", "nfc", "notifications", "paymentHandler", "periodicBackgroundSync",
109        "pointerLock", "protectedMediaIdentifier", "sensors", "smartCard", "speakerSelection",
110        "storageAccess", "topLevelStorageAccess", "videoCapture", "vr", "wakeLockScreen",
111        "wakeLockSystem", "webAppInstallation", "webPrinting", "windowManagement"
112    );
113
114    /**
115     * <CODE>[No Description Provided by Google]</CODE>
116     * 
117     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
118     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
119     */
120    public static final ReadOnlyList<String> PrivacySandboxAPI = new ReadOnlyArrayList<>
121        (String.class, "BiddingAndAuctionServices", "TrustedKeyValue");
122
123    /**
124     * The state of the browser window.
125     * 
126     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
127     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
128     */
129    public static final ReadOnlyList<String> WindowState = new ReadOnlyArrayList<>
130        (String.class, "fullscreen", "maximized", "minimized", "normal");
131
132
133
134    // ********************************************************************************************
135    // ********************************************************************************************
136    // Basic Types
137    // ********************************************************************************************
138    // ********************************************************************************************
139
140
141    /**
142     * Browser window bounds information
143     * 
144     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
145     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI>
146     */
147    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
148    public static class Bounds
149        extends BaseType<Bounds>
150        implements java.io.Serializable
151    {
152        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
153        protected static final long serialVersionUID = 1;
154
155        private static final NestedHelper<Browser.Bounds> singleton =
156            Torello.Browser.BrowserAPI.NestedHelpers.Types.
157                Browser$$Bounds$$.singleton;
158
159        /**
160         * The offset from the left edge of the screen to the window in pixels.
161         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
162         */
163        public final Integer left;
164
165        /**
166         * The offset from the top edge of the screen to the window in pixels.
167         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
168         */
169        public final Integer top;
170
171        /**
172         * The window width in pixels.
173         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
174         */
175        public final Integer width;
176
177        /**
178         * The window height in pixels.
179         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
180         */
181        public final Integer height;
182
183        /**
184         * The window state. Default to normal.
185         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
186         * <EMBED CLASS='external-html' DATA-D=Browser DATA-C=WindowState DATA-F=windowState DATA-FILE-ID=CDP.EL2>
187         * @see BaseType#enumStrList(String)
188         */
189        public final String windowState;
190
191        /** Constructor.  Please review this class' fields for documentation. */
192        public Bounds(
193                ReadOnlyList<Boolean> isPresent, Integer left, Integer top, Integer width,
194                Integer height, String windowState
195            )
196        {
197            super(singleton, Domains.Browser, "Bounds", 5);
198
199            this.left           = left;
200            this.top            = top;
201            this.width          = width;
202            this.height         = height;
203            this.windowState    = windowState;
204
205            this.isPresent = (isPresent == null)
206                ? singleton.generateIsPresentList(this)
207                : THROWS.check(isPresent, 5, "Browser.Bounds");
208        }
209
210        /** Creates an instance of this class from a {@link JsonObject}.*/
211        public static Bounds fromJSON(JsonObject jo)
212        { return singleton.fromJSON(jo); }
213
214        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
215        public static NestedDescriptor<Bounds> descriptor()
216        { return singleton.descriptor(); }
217    }
218
219    /**
220     * Chrome histogram bucket.
221     * 
222     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
223     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI>
224     */
225    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
226    public static class Bucket
227        extends BaseType<Bucket>
228        implements java.io.Serializable
229    {
230        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
231        protected static final long serialVersionUID = 1;
232
233        private static final NestedHelper<Browser.Bucket> singleton =
234            Torello.Browser.BrowserAPI.NestedHelpers.Types.
235                Browser$$Bucket$$.singleton;
236
237        /** Minimum value (inclusive). */
238        public final int low;
239
240        /** Maximum value (exclusive). */
241        public final int high;
242
243        /** Number of samples. */
244        public final int count;
245
246        /** Constructor.  Please review this class' fields for documentation. */
247        public Bucket(ReadOnlyList<Boolean> isPresent, int low, int high, int count)
248        {
249            super(singleton, Domains.Browser, "Bucket", 3);
250
251            this.low    = low;
252            this.high   = high;
253            this.count  = count;
254
255            this.isPresent = (isPresent == null)
256                ? singleton.generateIsPresentList(this)
257                : THROWS.check(isPresent, 3, "Browser.Bucket");
258        }
259
260        /** Creates an instance of this class from a {@link JsonObject}.*/
261        public static Bucket fromJSON(JsonObject jo)
262        { return singleton.fromJSON(jo); }
263
264        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
265        public static NestedDescriptor<Bucket> descriptor()
266        { return singleton.descriptor(); }
267    }
268
269    /**
270     * Chrome histogram.
271     * 
272     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
273     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI>
274     */
275    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
276    public static class Histogram
277        extends BaseType<Histogram>
278        implements java.io.Serializable
279    {
280        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
281        protected static final long serialVersionUID = 1;
282
283        private static final NestedHelper<Browser.Histogram> singleton =
284            Torello.Browser.BrowserAPI.NestedHelpers.Types.
285                Browser$$Histogram$$.singleton;
286
287        /** Name. */
288        public final String name;
289
290        /** Sum of sample values. */
291        public final int sum;
292
293        /** Total number of samples. */
294        public final int count;
295
296        /** Buckets. */
297        public final Browser.Bucket[] buckets;
298
299        /** Constructor.  Please review this class' fields for documentation. */
300        public Histogram
301            (ReadOnlyList<Boolean> isPresent, String name, int sum, int count, Bucket[] buckets)
302        {
303            super(singleton, Domains.Browser, "Histogram", 4);
304
305            this.name       = name;
306            this.sum        = sum;
307            this.count      = count;
308            this.buckets    = buckets;
309
310            this.isPresent = (isPresent == null)
311                ? singleton.generateIsPresentList(this)
312                : THROWS.check(isPresent, 4, "Browser.Histogram");
313        }
314
315        /** Creates an instance of this class from a {@link JsonObject}.*/
316        public static Histogram fromJSON(JsonObject jo)
317        { return singleton.fromJSON(jo); }
318
319        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
320        public static NestedDescriptor<Histogram> descriptor()
321        { return singleton.descriptor(); }
322    }
323
324    /**
325     * Definition of PermissionDescriptor defined in the Permissions API:
326     * https://w3c.github.io/permissions/#dom-permissiondescriptor.
327     * 
328     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
329     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI>
330     */
331    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
332    public static class PermissionDescriptor
333        extends BaseType<PermissionDescriptor>
334        implements java.io.Serializable
335    {
336        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
337        protected static final long serialVersionUID = 1;
338
339        private static final NestedHelper<Browser.PermissionDescriptor> singleton =
340            Torello.Browser.BrowserAPI.NestedHelpers.Types.
341                Browser$$PermissionDescriptor$$.singleton;
342
343        /**
344         * Name of permission.
345         * See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names.
346         */
347        public final String name;
348
349        /**
350         * For "midi" permission, may also specify sysex control.
351         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
352         */
353        public final Boolean sysex;
354
355        /**
356         * For "push" permission, may specify userVisibleOnly.
357         * Note that userVisibleOnly = true is the only currently supported type.
358         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
359         */
360        public final Boolean userVisibleOnly;
361
362        /**
363         * For "clipboard" permission, may specify allowWithoutSanitization.
364         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
365         */
366        public final Boolean allowWithoutSanitization;
367
368        /**
369         * For "fullscreen" permission, must specify allowWithoutGesture:true.
370         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
371         */
372        public final Boolean allowWithoutGesture;
373
374        /**
375         * For "camera" permission, may specify panTiltZoom.
376         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
377         */
378        public final Boolean panTiltZoom;
379
380        /** Constructor.  Please review this class' fields for documentation. */
381        public PermissionDescriptor(
382                ReadOnlyList<Boolean> isPresent, String name, Boolean sysex,
383                Boolean userVisibleOnly, Boolean allowWithoutSanitization,
384                Boolean allowWithoutGesture, Boolean panTiltZoom
385            )
386        {
387            super(singleton, Domains.Browser, "PermissionDescriptor", 6);
388
389            this.name                       = name;
390            this.sysex                      = sysex;
391            this.userVisibleOnly            = userVisibleOnly;
392            this.allowWithoutSanitization   = allowWithoutSanitization;
393            this.allowWithoutGesture        = allowWithoutGesture;
394            this.panTiltZoom                = panTiltZoom;
395
396            this.isPresent = (isPresent == null)
397                ? singleton.generateIsPresentList(this)
398                : THROWS.check(isPresent, 6, "Browser.PermissionDescriptor");
399        }
400
401        /** Creates an instance of this class from a {@link JsonObject}.*/
402        public static PermissionDescriptor fromJSON(JsonObject jo)
403        { return singleton.fromJSON(jo); }
404
405        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
406        public static NestedDescriptor<PermissionDescriptor> descriptor()
407        { return singleton.descriptor(); }
408    }
409
410
411    // ********************************************************************************************
412    // ********************************************************************************************
413    // Command-Return Types
414    // ********************************************************************************************
415    // ********************************************************************************************
416
417
418    /**
419     * Returns version information.
420     * 
421     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI DATA-CMD=getVersion>
422     * @see Browser#getVersion
423     */
424    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI")
425    public static class getVersion$$RET
426        extends BaseType<getVersion$$RET>
427        implements java.io.Serializable
428    {
429        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
430        protected static final long serialVersionUID = 1;
431
432        private static final NestedHelper<Browser.getVersion$$RET> singleton =
433            Torello.Browser.BrowserAPI.NestedHelpers.CmdReturns.
434                Browser$$getVersion$$RET.singleton;
435
436        /** Protocol version. */
437        public final String protocolVersion;
438
439        /** Product name. */
440        public final String product;
441
442        /** Product revision. */
443        public final String revision;
444
445        /** User-Agent. */
446        public final String userAgent;
447
448        /** V8 version. */
449        public final String jsVersion;
450
451        /** Constructor.  Please review this class' fields for documentation. */
452        public getVersion$$RET(
453                ReadOnlyList<Boolean> isPresent, String protocolVersion, String product,
454                String revision, String userAgent, String jsVersion
455            )
456        {
457            super(singleton, Domains.Browser, "getVersion", 5);
458
459            this.protocolVersion    = protocolVersion;
460            this.product            = product;
461            this.revision           = revision;
462            this.userAgent          = userAgent;
463            this.jsVersion          = jsVersion;
464
465            this.isPresent = (isPresent == null)
466                ? singleton.generateIsPresentList(this)
467                : THROWS.check(isPresent, 5, "Browser.getVersion$$RET");
468        }
469
470        /** Creates an instance of this class from a {@link JsonObject}.*/
471        public static getVersion$$RET fromJSON(JsonObject jo)
472        { return singleton.fromJSON(jo); }
473
474        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
475        public static NestedDescriptor<getVersion$$RET> descriptor()
476        { return singleton.descriptor(); }
477    }
478
479    /**
480     * Get the browser window that contains the devtools target.
481     * 
482     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
483     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI DATA-CMD=getWindowForTarget>
484     * @see Browser#getWindowForTarget
485     */
486    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI")
487    public static class getWindowForTarget$$RET
488        extends BaseType<getWindowForTarget$$RET>
489        implements java.io.Serializable
490    {
491        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
492        protected static final long serialVersionUID = 1;
493
494        private static final NestedHelper<Browser.getWindowForTarget$$RET> singleton =
495            Torello.Browser.BrowserAPI.NestedHelpers.CmdReturns.
496                Browser$$getWindowForTarget$$RET.singleton;
497
498        /** Browser window id. */
499        public final int windowId;
500
501        /**
502         * Bounds information of the window. When window state is 'minimized', the restored window
503         * position and size are returned.
504         */
505        public final Browser.Bounds bounds;
506
507        /** Constructor.  Please review this class' fields for documentation. */
508        public getWindowForTarget$$RET
509            (ReadOnlyList<Boolean> isPresent, int windowId, Bounds bounds)
510        {
511            super(singleton, Domains.Browser, "getWindowForTarget", 2);
512
513            this.windowId   = windowId;
514            this.bounds     = bounds;
515
516            this.isPresent = (isPresent == null)
517                ? singleton.generateIsPresentList(this)
518                : THROWS.check(isPresent, 2, "Browser.getWindowForTarget$$RET");
519        }
520
521        /** Creates an instance of this class from a {@link JsonObject}.*/
522        public static getWindowForTarget$$RET fromJSON(JsonObject jo)
523        { return singleton.fromJSON(jo); }
524
525        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
526        public static NestedDescriptor<getWindowForTarget$$RET> descriptor()
527        { return singleton.descriptor(); }
528    }
529
530
531    // ********************************************************************************************
532    // ********************************************************************************************
533    // Event Types
534    // ********************************************************************************************
535    // ********************************************************************************************
536
537
538    /**
539     * Fired when download makes progress. Last call has |done| == true.
540     * 
541     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
542     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI>
543     */
544    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
545    public static class downloadProgress
546        extends BrowserEvent<downloadProgress>
547        implements java.io.Serializable
548    {
549        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
550        protected static final long serialVersionUID = 1;
551
552        private static final NestedHelper<Browser.downloadProgress> singleton =
553            Torello.Browser.BrowserAPI.NestedHelpers.Events.
554                Browser$$downloadProgress$$.singleton;
555
556        /** Global unique identifier of the download. */
557        public final String guid;
558
559        /** Total expected bytes to download. */
560        public final Number totalBytes;
561
562        /** Total bytes received. */
563        public final Number receivedBytes;
564
565        /**
566         * Download status.
567         * <EMBED CLASS='external-html' DATA-D=Browser DATA-C=downloadProgress DATA-F=state DATA-FILE-ID=CDP.EL1>
568         * @see BaseType#enumStrList(String)
569         */
570        public final String state;
571
572        /**
573         * If download is "completed", provides the path of the downloaded file.
574         * Depending on the platform, it is not guaranteed to be set, nor the file
575         * is guaranteed to exist.
576         * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B>
577         */
578        public final String filePath;
579
580        /** Constructor.  Please review this class' fields for documentation. */
581        public downloadProgress(
582                ReadOnlyList<Boolean> isPresent, String guid, Number totalBytes,
583                Number receivedBytes, String state, String filePath
584            )
585        {
586            super(singleton, Domains.Browser, "downloadProgress", 5);
587
588            this.guid           = guid;
589            this.totalBytes     = totalBytes;
590            this.receivedBytes  = receivedBytes;
591            this.state          = state;
592            this.filePath       = filePath;
593
594            this.isPresent = (isPresent == null)
595                ? singleton.generateIsPresentList(this)
596                : THROWS.check(isPresent, 5, "Browser.downloadProgress");
597        }
598
599        /** Creates an instance of this class from a {@link JsonObject}.*/
600        public static downloadProgress fromJSON(JsonObject jo)
601        { return singleton.fromJSON(jo); }
602
603        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
604        public static NestedDescriptor<downloadProgress> descriptor()
605        { return singleton.descriptor(); }
606    }
607
608    /**
609     * Fired when page is about to start a download.
610     * 
611     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
612     * <EMBED CLASS=globalDefs DATA-DOMAIN=Browser DATA-API=BrowserAPI>
613     */
614    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
615    public static class downloadWillBegin
616        extends BrowserEvent<downloadWillBegin>
617        implements java.io.Serializable
618    {
619        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
620        protected static final long serialVersionUID = 1;
621
622        private static final NestedHelper<Browser.downloadWillBegin> singleton =
623            Torello.Browser.BrowserAPI.NestedHelpers.Events.
624                Browser$$downloadWillBegin$$.singleton;
625
626        /** Id of the frame that caused the download to begin. */
627        public final String frameId;
628
629        /** Global unique identifier of the download. */
630        public final String guid;
631
632        /** URL of the resource being downloaded. */
633        public final String url;
634
635        /** Suggested file name of the resource (the actual name of the file saved on disk may differ). */
636        public final String suggestedFilename;
637
638        /** Constructor.  Please review this class' fields for documentation. */
639        public downloadWillBegin(
640                ReadOnlyList<Boolean> isPresent, String frameId, String guid, String url,
641                String suggestedFilename
642            )
643        {
644            super(singleton, Domains.Browser, "downloadWillBegin", 4);
645
646            this.frameId            = frameId;
647            this.guid               = guid;
648            this.url                = url;
649            this.suggestedFilename  = suggestedFilename;
650
651            this.isPresent = (isPresent == null)
652                ? singleton.generateIsPresentList(this)
653                : THROWS.check(isPresent, 4, "Browser.downloadWillBegin");
654        }
655
656        /** Creates an instance of this class from a {@link JsonObject}.*/
657        public static downloadWillBegin fromJSON(JsonObject jo)
658        { return singleton.fromJSON(jo); }
659
660        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
661        public static NestedDescriptor<downloadWillBegin> descriptor()
662        { return singleton.descriptor(); }
663    }
664
665
666
667
668    // ********************************************************************************************
669    // ********************************************************************************************
670    // Commands
671    // ********************************************************************************************
672    // ********************************************************************************************
673
674
675    /**
676     * Configures encryption keys used with a given privacy sandbox API to talk
677     * to a trusted coordinator.  Since this is intended for test automation only,
678     * coordinatorOrigin must be a .test domain. No existing coordinator
679     * configuration for the origin may exist.
680     * 
681     * @param api -
682     * 
683     * @param coordinatorOrigin -
684     * 
685     * @param keyConfig -
686     * 
687     * @param browserContextId 
688     * BrowserContext to perform the action in. When omitted, default browser
689     * context is used.
690     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
691     * 
692     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
693     *
694     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
695     * browser receives the invocation-request.
696     *
697     * <BR /><BR /><DIV CLASS=JDHint>
698     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
699     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
700     * the Browser Function has run to completion.
701     * </DIV>
702     */
703    public static Script<Void> addPrivacySandboxCoordinatorKeyConfig
704        (String api, String coordinatorOrigin, String keyConfig, String browserContextId)
705    {
706        // Convert all Method Parameters into a JSON Request-Object (as a String)
707        final String requestJSON = WriteJSON.get(
708            Browser$$Commands.addPrivacySandboxCoordinatorKeyConfig$$,
709            "Browser.addPrivacySandboxCoordinatorKeyConfig",
710            api, coordinatorOrigin, keyConfig, browserContextId
711        );
712
713        return Script.NO_RET(Domains.Browser, "addPrivacySandboxCoordinatorKeyConfig", requestJSON);
714    }
715
716    /**
717     * Allows a site to use privacy sandbox features that require enrollment
718     * without the site actually being enrolled. Only supported on page targets.
719     * 
720     * @param url -
721     * 
722     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
723     *
724     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
725     * browser receives the invocation-request.
726     *
727     * <BR /><BR /><DIV CLASS=JDHint>
728     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
729     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
730     * the Browser Function has run to completion.
731     * </DIV>
732     */
733    public static Script<Void> addPrivacySandboxEnrollmentOverride(String url)
734    {
735        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
736        final String requestJSON = WriteJSON.get
737            (CDPTypes.STRING, "url", false, "Browser.addPrivacySandboxEnrollmentOverride", url);
738
739        return Script.NO_RET(Domains.Browser, "addPrivacySandboxEnrollmentOverride", requestJSON);
740    }
741
742    /**
743     * Cancel a download if in progress
744     * 
745     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
746     * 
747     * @param guid Global unique identifier of the download.
748     * 
749     * @param browserContextId BrowserContext to perform the action in. When omitted, default browser context is used.
750     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
751     * 
752     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
753     *
754     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
755     * browser receives the invocation-request.
756     *
757     * <BR /><BR /><DIV CLASS=JDHint>
758     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
759     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
760     * the Browser Function has run to completion.
761     * </DIV>
762     */
763    public static Script<Void> cancelDownload(String guid, String browserContextId)
764    {
765        // Convert all Method Parameters into a JSON Request-Object (as a String)
766        final String requestJSON = WriteJSON.get(
767            Browser$$Commands.cancelDownload$$, "Browser.cancelDownload",
768            guid, browserContextId
769        );
770
771        return Script.NO_RET(Domains.Browser, "cancelDownload", requestJSON);
772    }
773
774    /**
775     * Close browser gracefully.
776     * 
777     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
778     *
779     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
780     * browser receives the invocation-request.
781     *
782     * <BR /><BR /><DIV CLASS=JDHint>
783     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
784     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
785     * the Browser Function has run to completion.
786     * </DIV>
787     */
788    public static Script<Void> close()
789    {
790        // Ultra-Simple Request JSON - Because this method has no parameters
791        final String requestJSON = "{\"method\":\"Browser.close\"}";
792
793        return Script.NO_RET(Domains.Browser, "close", requestJSON);
794    }
795
796    /**
797     * Crashes browser on the main thread.
798     * 
799     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
800     * 
801     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
802     *
803     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
804     * browser receives the invocation-request.
805     *
806     * <BR /><BR /><DIV CLASS=JDHint>
807     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
808     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
809     * the Browser Function has run to completion.
810     * </DIV>
811     */
812    public static Script<Void> crash()
813    {
814        // Ultra-Simple Request JSON - Because this method has no parameters
815        final String requestJSON = "{\"method\":\"Browser.crash\"}";
816
817        return Script.NO_RET(Domains.Browser, "crash", requestJSON);
818    }
819
820    /**
821     * Crashes GPU process.
822     * 
823     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
824     * 
825     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
826     *
827     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
828     * browser receives the invocation-request.
829     *
830     * <BR /><BR /><DIV CLASS=JDHint>
831     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
832     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
833     * the Browser Function has run to completion.
834     * </DIV>
835     */
836    public static Script<Void> crashGpuProcess()
837    {
838        // Ultra-Simple Request JSON - Because this method has no parameters
839        final String requestJSON = "{\"method\":\"Browser.crashGpuProcess\"}";
840
841        return Script.NO_RET(Domains.Browser, "crashGpuProcess", requestJSON);
842    }
843
844    /**
845     * Invoke custom browser commands used by telemetry.
846     * 
847     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
848     * 
849     * @param commandId -
850     * 
851     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
852     *
853     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
854     * browser receives the invocation-request.
855     *
856     * <BR /><BR /><DIV CLASS=JDHint>
857     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
858     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
859     * the Browser Function has run to completion.
860     * </DIV>
861     */
862    public static Script<Void> executeBrowserCommand(String commandId)
863    {
864        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
865        final String requestJSON = WriteJSON.get
866            (CDPTypes.STRING, "commandId", false, "Browser.executeBrowserCommand", commandId);
867
868        return Script.NO_RET(Domains.Browser, "executeBrowserCommand", requestJSON);
869    }
870
871    /**
872     * Returns the command line switches for the browser process if, and only if
873     * --enable-automation is on the commandline.
874     * 
875     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
876     * 
877     * @return An instance of <CODE>{@link Script}&lt;String[]&gt;</CODE>
878     * 
879     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
880     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
881     * <CODE>&lt;String[]&gt;</CODE> will be returned
882     *
883     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
884     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
885     * be retrieved.</I>
886     *
887     * <BR /><BR /><DIV CLASS=JDHint>
888     * This Browser Function's {@code Promise} returns:
889     * <CODE>String[] (<B>arguments</B>)</CODE>
890     * <BR />
891     * Commandline parameters
892     * </DIV>
893     */
894    public static Script<String[]> getBrowserCommandLine()
895    {
896        // Ultra-Simple Request JSON - Because this method has no parameters
897        final String requestJSON = "{\"method\":\"Browser.getBrowserCommandLine\"}";
898
899        return new Script<>(
900            Domains.Browser, "getBrowserCommandLine", requestJSON,
901            Browser$$Commands::getBrowserCommandLine,
902            String[].class
903        );
904    }
905
906    /**
907     * Get a Chrome histogram by name.
908     * 
909     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
910     * 
911     * @param name Requested histogram name.
912     * 
913     * @param delta If true, retrieve delta since last delta call.
914     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
915     * 
916     * @return An instance of <CODE>{@link Script}&lt;{@link Browser.Histogram}&gt;</CODE>
917     * 
918     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
919     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
920     * <CODE>&lt;{@link Browser.Histogram}&gt;</CODE> will be returned
921     *
922     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
923     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
924     * be retrieved.</I>
925     *
926     * <BR /><BR /><DIV CLASS=JDHint>
927     * This Browser Function's {@code Promise} returns:
928     * <CODE>{@link Browser.Histogram} (<B>histogram</B>)</CODE>
929     * <BR />
930     * Histogram.
931     * </DIV>
932     */
933    public static Script<Browser.Histogram> getHistogram(String name, Boolean delta)
934    {
935        // Convert all Method Parameters into a JSON Request-Object (as a String)
936        final String requestJSON = WriteJSON.get(
937            Browser$$Commands.getHistogram$$, "Browser.getHistogram",
938            name, delta
939        );
940
941        return new Script<>(
942            Domains.Browser, "getHistogram", requestJSON,
943            Browser$$Commands::getHistogram,
944            Browser.Histogram.class
945        );
946    }
947
948    /**
949     * Get Chrome histograms.
950     * 
951     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
952     * 
953     * @param query 
954     * Requested substring in name. Only histograms which have query as a
955     * substring in their name are extracted. An empty or absent query returns
956     * all histograms.
957     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
958     * 
959     * @param delta If true, retrieve delta since last delta call.
960     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
961     * 
962     * @return An instance of <CODE>{@link Script}&lt;{@link Browser.Histogram}[]&gt;</CODE>
963     * 
964     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
965     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
966     * <CODE>&lt;{@link Browser.Histogram}[]&gt;</CODE> will be returned
967     *
968     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
969     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
970     * be retrieved.</I>
971     *
972     * <BR /><BR /><DIV CLASS=JDHint>
973     * This Browser Function's {@code Promise} returns:
974     * <CODE>{@link Browser.Histogram}[] (<B>histograms</B>)</CODE>
975     * <BR />
976     * Histograms.
977     * </DIV>
978     */
979    public static Script<Browser.Histogram[]> getHistograms(String query, Boolean delta)
980    {
981        // Convert all Method Parameters into a JSON Request-Object (as a String)
982        final String requestJSON = WriteJSON.get(
983            Browser$$Commands.getHistograms$$, "Browser.getHistograms",
984            query, delta
985        );
986
987        return new Script<>(
988            Domains.Browser, "getHistograms", requestJSON,
989            Browser$$Commands::getHistograms,
990            Browser.Histogram[].class
991        );
992    }
993
994    /**
995     * Returns version information.
996     * 
997     * @return An instance of <CODE>{@link Script}&lt;{@link getVersion$$RET}&gt;</CODE>
998     * 
999     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
1000     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
1001     * <CODE>&lt;{@link getVersion$$RET}&gt;</CODE> will be returned
1002     *
1003     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
1004     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
1005     * be retrieved.</I>
1006     *
1007     * <BR /><BR /><DIV CLASS=JDHint>
1008     * This Browser Function's {@code Promise} returns:{@link getVersion$$RET}
1009     * A dedicated return type implies that the browser may return more than 1 datum
1010     * </DIV>
1011     */
1012    public static Script<getVersion$$RET> getVersion()
1013    {
1014        // Ultra-Simple Request JSON - Because this method has no parameters
1015        final String requestJSON = "{\"method\":\"Browser.getVersion\"}";
1016
1017        return new Script<>(
1018            Domains.Browser, "getVersion", requestJSON,
1019            getVersion$$RET::fromJSON,
1020            getVersion$$RET.class
1021        );
1022    }
1023
1024    /**
1025     * Get position and size of the browser window.
1026     * 
1027     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1028     * 
1029     * @param windowId Browser window id.
1030     * 
1031     * @return An instance of <CODE>{@link Script}&lt;{@link Browser.Bounds}&gt;</CODE>
1032     * 
1033     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
1034     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
1035     * <CODE>&lt;{@link Browser.Bounds}&gt;</CODE> will be returned
1036     *
1037     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
1038     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
1039     * be retrieved.</I>
1040     *
1041     * <BR /><BR /><DIV CLASS=JDHint>
1042     * This Browser Function's {@code Promise} returns:
1043     * <CODE>{@link Browser.Bounds} (<B>bounds</B>)</CODE>
1044     * <BR />
1045     * Bounds information of the window. When window state is 'minimized', the restored window
1046     *     position and size are returned.
1047     * </DIV>
1048     */
1049    public static Script<Browser.Bounds> getWindowBounds(int windowId)
1050    {
1051        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
1052        final String requestJSON = WriteJSON.get
1053            (CDPTypes.PRIMITIVE_INT, "windowId", false, "Browser.getWindowBounds", windowId);
1054
1055        return new Script<>(
1056            Domains.Browser, "getWindowBounds", requestJSON,
1057            Browser$$Commands::getWindowBounds,
1058            Browser.Bounds.class
1059        );
1060    }
1061
1062    /**
1063     * Get the browser window that contains the devtools target.
1064     * 
1065     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1066     * 
1067     * @param targetId Devtools agent host id. If called as a part of the session, associated targetId is used.
1068     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1069     * 
1070     * @return An instance of <CODE>{@link Script}&lt;{@link getWindowForTarget$$RET}&gt;</CODE>
1071     * 
1072     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
1073     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
1074     * <CODE>&lt;{@link getWindowForTarget$$RET}&gt;</CODE> will be returned
1075     *
1076     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
1077     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
1078     * be retrieved.</I>
1079     *
1080     * <BR /><BR /><DIV CLASS=JDHint>
1081     * This Browser Function's {@code Promise} returns:{@link getWindowForTarget$$RET}
1082     * A dedicated return type implies that the browser may return more than 1 datum
1083     * </DIV>
1084     */
1085    public static Script<getWindowForTarget$$RET> getWindowForTarget(String targetId)
1086    {
1087        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
1088        final String requestJSON = WriteJSON.get
1089            (CDPTypes.STRING, "targetId", true, "Browser.getWindowForTarget", targetId);
1090
1091        return new Script<>(
1092            Domains.Browser, "getWindowForTarget", requestJSON,
1093            getWindowForTarget$$RET::fromJSON,
1094            getWindowForTarget$$RET.class
1095        );
1096    }
1097
1098    /**
1099     * Grant specific permissions to the given origin and reject all others.
1100     * 
1101     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1102     * 
1103     * @param permissions -
1104     * 
1105     * @param origin Origin the permission applies to, all origins if not specified.
1106     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1107     * 
1108     * @param browserContextId BrowserContext to override permissions. When omitted, default browser context is used.
1109     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1110     * 
1111     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
1112     *
1113     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1114     * browser receives the invocation-request.
1115     *
1116     * <BR /><BR /><DIV CLASS=JDHint>
1117     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
1118     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
1119     * the Browser Function has run to completion.
1120     * </DIV>
1121     */
1122    public static Script<Void> grantPermissions
1123        (String[] permissions, String origin, String browserContextId)
1124    {
1125        // Convert all Method Parameters into a JSON Request-Object (as a String)
1126        final String requestJSON = WriteJSON.get(
1127            Browser$$Commands.grantPermissions$$, "Browser.grantPermissions",
1128            permissions, origin, browserContextId
1129        );
1130
1131        return Script.NO_RET(Domains.Browser, "grantPermissions", requestJSON);
1132    }
1133
1134    /**
1135     * Reset all permission management for all origins.
1136     * 
1137     * @param browserContextId BrowserContext to reset permissions. When omitted, default browser context is used.
1138     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1139     * 
1140     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
1141     *
1142     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1143     * browser receives the invocation-request.
1144     *
1145     * <BR /><BR /><DIV CLASS=JDHint>
1146     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
1147     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
1148     * the Browser Function has run to completion.
1149     * </DIV>
1150     */
1151    public static Script<Void> resetPermissions(String browserContextId)
1152    {
1153        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
1154        final String requestJSON = WriteJSON.get(
1155            CDPTypes.STRING, "browserContextId", true, "Browser.resetPermissions",
1156            browserContextId
1157        );
1158
1159        return Script.NO_RET(Domains.Browser, "resetPermissions", requestJSON);
1160    }
1161
1162    /**
1163     * Set size of the browser contents resizing browser window as necessary.
1164     * 
1165     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1166     * 
1167     * @param windowId Browser window id.
1168     * 
1169     * @param width 
1170     * The window contents width in DIP. Assumes current width if omitted.
1171     * Must be specified if 'height' is omitted.
1172     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1173     * 
1174     * @param height 
1175     * The window contents height in DIP. Assumes current height if omitted.
1176     * Must be specified if 'width' is omitted.
1177     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1178     * 
1179     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
1180     *
1181     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1182     * browser receives the invocation-request.
1183     *
1184     * <BR /><BR /><DIV CLASS=JDHint>
1185     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
1186     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
1187     * the Browser Function has run to completion.
1188     * </DIV>
1189     */
1190    public static Script<Void> setContentsSize(int windowId, Integer width, Integer height)
1191    {
1192        // Convert all Method Parameters into a JSON Request-Object (as a String)
1193        final String requestJSON = WriteJSON.get(
1194            Browser$$Commands.setContentsSize$$, "Browser.setContentsSize",
1195            windowId, width, height
1196        );
1197
1198        return Script.NO_RET(Domains.Browser, "setContentsSize", requestJSON);
1199    }
1200
1201    /**
1202     * Set dock tile details, platform-specific.
1203     * 
1204     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1205     * 
1206     * @param badgeLabel -
1207     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1208     * 
1209     * @param image Png encoded image. (Encoded as a base64 string when passed over JSON)
1210     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1211     * 
1212     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
1213     *
1214     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1215     * browser receives the invocation-request.
1216     *
1217     * <BR /><BR /><DIV CLASS=JDHint>
1218     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
1219     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
1220     * the Browser Function has run to completion.
1221     * </DIV>
1222     */
1223    public static Script<Void> setDockTile(String badgeLabel, String image)
1224    {
1225        // Convert all Method Parameters into a JSON Request-Object (as a String)
1226        final String requestJSON = WriteJSON.get(
1227            Browser$$Commands.setDockTile$$, "Browser.setDockTile",
1228            badgeLabel, image
1229        );
1230
1231        return Script.NO_RET(Domains.Browser, "setDockTile", requestJSON);
1232    }
1233
1234    /**
1235     * Set the behavior when downloading a file.
1236     * 
1237     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1238     * 
1239     * @param behavior 
1240     * Whether to allow all or deny all download requests, or use default Chrome behavior if
1241     * available (otherwise deny). |allowAndName| allows download and names files according to
1242     * their download guids.
1243     * <BR />Acceptable Values: ["allow", "allowAndName", "default", "deny"]
1244     * 
1245     * @param browserContextId BrowserContext to set download behavior. When omitted, default browser context is used.
1246     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1247     * 
1248     * @param downloadPath 
1249     * The default path to save downloaded files to. This is required if behavior is set to 'allow'
1250     * or 'allowAndName'.
1251     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1252     * 
1253     * @param eventsEnabled Whether to emit download events (defaults to false).
1254     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1255     * 
1256     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
1257     *
1258     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1259     * browser receives the invocation-request.
1260     *
1261     * <BR /><BR /><DIV CLASS=JDHint>
1262     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
1263     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
1264     * the Browser Function has run to completion.
1265     * </DIV>
1266     */
1267    public static Script<Void> setDownloadBehavior
1268        (String behavior, String browserContextId, String downloadPath, Boolean eventsEnabled)
1269    {
1270        // Convert all Method Parameters into a JSON Request-Object (as a String)
1271        final String requestJSON = WriteJSON.get(
1272            Browser$$Commands.setDownloadBehavior$$, "Browser.setDownloadBehavior",
1273            behavior, browserContextId, downloadPath, eventsEnabled
1274        );
1275
1276        return Script.NO_RET(Domains.Browser, "setDownloadBehavior", requestJSON);
1277    }
1278
1279    /**
1280     * Set permission settings for given origin.
1281     * 
1282     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1283     * 
1284     * @param permission Descriptor of permission to override.
1285     * 
1286     * @param setting Setting of the permission.
1287     * 
1288     * @param origin Origin the permission applies to, all origins if not specified.
1289     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1290     * 
1291     * @param browserContextId Context to override. When omitted, default browser context is used.
1292     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
1293     * 
1294     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
1295     *
1296     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1297     * browser receives the invocation-request.
1298     *
1299     * <BR /><BR /><DIV CLASS=JDHint>
1300     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
1301     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
1302     * the Browser Function has run to completion.
1303     * </DIV>
1304     */
1305    public static Script<Void> setPermission
1306        (PermissionDescriptor permission, String setting, String origin, String browserContextId)
1307    {
1308        // Convert all Method Parameters into a JSON Request-Object (as a String)
1309        final String requestJSON = WriteJSON.get(
1310            Browser$$Commands.setPermission$$, "Browser.setPermission",
1311            permission, setting, origin, browserContextId
1312        );
1313
1314        return Script.NO_RET(Domains.Browser, "setPermission", requestJSON);
1315    }
1316
1317    /**
1318     * Set position and/or size of the browser window.
1319     * 
1320     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1321     * 
1322     * @param windowId Browser window id.
1323     * 
1324     * @param bounds 
1325     * New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined
1326     * with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
1327     * 
1328     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
1329     *
1330     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1331     * browser receives the invocation-request.
1332     *
1333     * <BR /><BR /><DIV CLASS=JDHint>
1334     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
1335     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
1336     * the Browser Function has run to completion.
1337     * </DIV>
1338     */
1339    public static Script<Void> setWindowBounds(int windowId, Bounds bounds)
1340    {
1341        // Convert all Method Parameters into a JSON Request-Object (as a String)
1342        final String requestJSON = WriteJSON.get(
1343            Browser$$Commands.setWindowBounds$$, "Browser.setWindowBounds",
1344            windowId, bounds
1345        );
1346
1347        return Script.NO_RET(Domains.Browser, "setWindowBounds", requestJSON);
1348    }
1349
1350
1351}