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
018
019// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
020// JDK Imports
021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
022
023import javax.json.JsonObject;
024import javax.json.JsonValue;
025
026/**
027 * <SPAN CLASS=COPIEDJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN>
028 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE>
029 */
030@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE")
031public class Preload
032{
033    // No Pubic Constructors
034    private Preload() { }
035
036
037    // ********************************************************************************************
038    // ********************************************************************************************
039    // Eliminated Types
040    // ********************************************************************************************
041    // ********************************************************************************************
042
043
044    /**
045     * Chrome manages different types of preloads together using a
046     * concept of preloading pipeline. For example, if a site uses a
047     * SpeculationRules for prerender, Chrome first starts a prefetch and
048     * then upgrades it to prerender.
049     * 
050     * CDP events for them are emitted separately but they share
051     * <CODE>PreloadPipelineId</CODE>.
052
053     * <EMBED CLASS='external-html' DATA-CTAS='String' DATA-FILE-ID=CDP.EliminatedType
054     *     DATA-NAME=PreloadPipelineId>
055     */
056    public static final String PreloadPipelineId =
057        "PreloadPipelineId has been eliminated.\n" +
058        "It was replaced with the standard Java-Type: String";
059
060    /**
061     * Unique id
062
063     * <EMBED CLASS='external-html' DATA-CTAS='String' DATA-FILE-ID=CDP.EliminatedType
064     *     DATA-NAME=RuleSetId>
065     */
066    public static final String RuleSetId =
067        "RuleSetId has been eliminated.\n" +
068        "It was replaced with the standard Java-Type: String";
069
070
071    // ********************************************************************************************
072    // ********************************************************************************************
073    // Enumerated String Constants Lists
074    // ********************************************************************************************
075    // ********************************************************************************************
076
077
078    /**
079     * TODO(https://crbug.com/1384419): revisit the list of PrefetchStatus and
080     * filter out the ones that aren't necessary to the developers.
081     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
082     */
083    public static final ReadOnlyList<String> PrefetchStatus = new ReadOnlyArrayList<>(
084        String.class, 
085        "PrefetchAllowed", "PrefetchEvictedAfterBrowsingDataRemoved",
086        "PrefetchEvictedAfterCandidateRemoved", "PrefetchEvictedForNewerPrefetch",
087        "PrefetchFailedIneligibleRedirect", "PrefetchFailedInvalidRedirect",
088        "PrefetchFailedMIMENotSupported", "PrefetchFailedNetError", "PrefetchFailedNon2XX",
089        "PrefetchHeldback", "PrefetchIneligibleRetryAfter", "PrefetchIsPrivacyDecoy",
090        "PrefetchIsStale", "PrefetchNotEligibleBatterySaverEnabled",
091        "PrefetchNotEligibleBrowserContextOffTheRecord", "PrefetchNotEligibleDataSaverEnabled",
092        "PrefetchNotEligibleExistingProxy", "PrefetchNotEligibleHostIsNonUnique",
093        "PrefetchNotEligibleNonDefaultStoragePartition", "PrefetchNotEligiblePreloadingDisabled",
094        "PrefetchNotEligibleRedirectFromServiceWorker",
095        "PrefetchNotEligibleRedirectToServiceWorker",
096        "PrefetchNotEligibleSameSiteCrossOriginPrefetchRequiredProxy",
097        "PrefetchNotEligibleSchemeIsNotHttps", "PrefetchNotEligibleUserHasCookies",
098        "PrefetchNotEligibleUserHasServiceWorker",
099        "PrefetchNotEligibleUserHasServiceWorkerNoFetchHandler", "PrefetchNotFinishedInTime",
100        "PrefetchNotStarted", "PrefetchNotUsedCookiesChanged", "PrefetchNotUsedProbeFailed",
101        "PrefetchProxyNotAvailable", "PrefetchResponseUsed", "PrefetchSuccessfulButNotUsed"
102    );
103
104    /**
105     * Preloading status values, see also PreloadingTriggeringOutcome. This
106     * status is shared by prefetchStatusUpdated and prerenderStatusUpdated.
107     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
108     */
109    public static final ReadOnlyList<String> PreloadingStatus = new ReadOnlyArrayList<>
110        (String.class, "Failure", "NotSupported", "Pending", "Ready", "Running", "Success");
111
112    /**
113     * List of FinalStatus reasons for Prerender2.
114     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
115     */
116    public static final ReadOnlyList<String> PrerenderFinalStatus = new ReadOnlyArrayList<>(
117        String.class, 
118        "Activated", "ActivatedBeforeStarted", "ActivatedDuringMainFrameNavigation",
119        "ActivatedInBackground", "ActivatedWithAuxiliaryBrowsingContexts",
120        "ActivationFramePolicyNotCompatible", "ActivationNavigationDestroyedBeforeSuccess",
121        "ActivationNavigationParameterMismatch", "ActivationUrlHasEffectiveUrl",
122        "AllPrerenderingCanceled", "AudioOutputDeviceRequested", "BatterySaverEnabled",
123        "BlockedByClient", "BrowsingDataRemoved", "CancelAllHostsForTesting", "ClientCertRequested",
124        "CrossSiteNavigationInInitialNavigation", "CrossSiteNavigationInMainFrameNavigation",
125        "CrossSiteRedirectInInitialNavigation", "CrossSiteRedirectInMainFrameNavigation",
126        "DataSaverEnabled", "Destroyed", "DidFailLoad", "Download", "EmbedderHostDisallowed",
127        "InactivePageRestriction", "InvalidSchemeNavigation", "InvalidSchemeRedirect",
128        "JavaScriptInterfaceAdded", "JavaScriptInterfaceRemoved", "LoginAuthRequested",
129        "LowEndDevice", "MaxNumOfRunningEagerPrerendersExceeded",
130        "MaxNumOfRunningEmbedderPrerendersExceeded", "MaxNumOfRunningNonEagerPrerendersExceeded",
131        "MemoryLimitExceeded", "MemoryPressureAfterTriggered", "MemoryPressureOnTrigger",
132        "MixedContent", "MojoBinderPolicy", "NavigationBadHttpStatus", "NavigationNotCommitted",
133        "NavigationRequestBlockedByCsp", "NavigationRequestNetworkError",
134        "OtherPrerenderedPageActivated", "PreloadingDisabled", "PreloadingUnsupportedByWebContents",
135        "PrerenderFailedDuringPrefetch", "PrerenderHostReused", "PrerenderingDisabledByDevTools",
136        "PrerenderingUrlHasEffectiveUrl", "PrimaryMainFrameRendererProcessCrashed",
137        "PrimaryMainFrameRendererProcessKilled", "RedirectedPrerenderingUrlHasEffectiveUrl",
138        "RendererProcessCrashed", "RendererProcessKilled",
139        "SameSiteCrossOriginNavigationNotOptInInInitialNavigation",
140        "SameSiteCrossOriginNavigationNotOptInInMainFrameNavigation",
141        "SameSiteCrossOriginRedirectNotOptInInInitialNavigation",
142        "SameSiteCrossOriginRedirectNotOptInInMainFrameNavigation", "SlowNetwork",
143        "SpeculationRuleRemoved", "SslCertificateError", "StartFailed", "Stop",
144        "TabClosedByUserGesture", "TabClosedWithoutUserGesture", "TimeoutBackgrounded",
145        "TriggerBackgrounded", "TriggerDestroyed", "TriggerUrlHasEffectiveUrl",
146        "UaChangeRequiresReload", "V8OptimizerDisabled", "WindowClosed"
147    );
148
149    /**
150     * <CODE>[No Description Provided by Google]</CODE>
151     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
152     */
153    public static final ReadOnlyList<String> RuleSetErrorType = new ReadOnlyArrayList<>
154        (String.class, "InvalidRulesSkipped", "InvalidRulesetLevelTag", "SourceIsNotJsonObject");
155
156    /**
157     * The type of preloading attempted. It corresponds to
158     * mojom::SpeculationAction (although PrefetchWithSubresources is omitted as it
159     * isn't being used by clients).
160     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
161     */
162    public static final ReadOnlyList<String> SpeculationAction = new ReadOnlyArrayList<>
163        (String.class, "Prefetch", "Prerender");
164
165    /**
166     * Corresponds to mojom::SpeculationTargetHint.
167     * See https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints
168     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
169     */
170    public static final ReadOnlyList<String> SpeculationTargetHint = new ReadOnlyArrayList<>
171        (String.class, "Blank", "Self");
172
173
174
175    // ********************************************************************************************
176    // ********************************************************************************************
177    // Basic Types
178    // ********************************************************************************************
179    // ********************************************************************************************
180
181
182    /**
183     * A key that identifies a preloading attempt.
184     * 
185     * The url used is the url specified by the trigger (i.e. the initial URL), and
186     * not the final url that is navigated to. For example, prerendering allows
187     * same-origin main frame navigations during the attempt, but the attempt is
188     * still keyed with the initial URL.
189     * 
190     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
191     */
192    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
193    public static class PreloadingAttemptKey
194        extends BaseType<PreloadingAttemptKey>
195        implements java.io.Serializable
196    {
197        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
198        protected static final long serialVersionUID = 1;
199
200        private static final NestedHelper<Preload.PreloadingAttemptKey> singleton =
201            Torello.Browser.BrowserAPI.NestedHelpers.Types.
202                Preload$$PreloadingAttemptKey$$.singleton;
203
204        /** <CODE>[No Description Provided by Google]</CODE> */
205        public final String loaderId;
206
207        /**
208         * <CODE>[No Description Provided by Google]</CODE>
209         * <EMBED CLASS='external-html' DATA-D=Preload DATA-C=SpeculationAction DATA-F=action DATA-FILE-ID=CDP.EL2>
210         * @see BaseType#enumStrList(String)
211         */
212        public final String action;
213
214        /** <CODE>[No Description Provided by Google]</CODE> */
215        public final String url;
216
217        /**
218         * <CODE>[No Description Provided by Google]</CODE>
219         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
220         * <EMBED CLASS='external-html' DATA-D=Preload DATA-C=SpeculationTargetHint DATA-F=targetHint DATA-FILE-ID=CDP.EL2>
221         * @see BaseType#enumStrList(String)
222         */
223        public final String targetHint;
224
225        /** Constructor.  Please review this class' fields for documentation. */
226        public PreloadingAttemptKey(
227                ReadOnlyList<Boolean> isPresent, String loaderId, String action, String url,
228                String targetHint
229            )
230        {
231            super(singleton, Domains.Preload, "PreloadingAttemptKey", 4);
232
233            this.loaderId   = loaderId;
234            this.action     = action;
235            this.url        = url;
236            this.targetHint = targetHint;
237
238            this.isPresent = (isPresent == null)
239                ? singleton.generateIsPresentList(this)
240                : THROWS.check(isPresent, 4, "Preload.PreloadingAttemptKey");
241        }
242
243        /** Creates an instance of this class from a {@link JsonObject}.*/
244        public static PreloadingAttemptKey fromJSON(JsonObject jo)
245        { return singleton.fromJSON(jo); }
246
247        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
248        public static NestedDescriptor<PreloadingAttemptKey> descriptor()
249        { return singleton.descriptor(); }
250    }
251
252    /**
253     * Lists sources for a preloading attempt, specifically the ids of rule sets
254     * that had a speculation rule that triggered the attempt, and the
255     * BackendNodeIds of {@code <a href> or <area href>} elements that triggered the
256     * attempt (in the case of attempts triggered by a document rule). It is
257     * possible for multiple rule sets and links to trigger a single attempt.
258     * 
259     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
260     */
261    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
262    public static class PreloadingAttemptSource
263        extends BaseType<PreloadingAttemptSource>
264        implements java.io.Serializable
265    {
266        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
267        protected static final long serialVersionUID = 1;
268
269        private static final NestedHelper<Preload.PreloadingAttemptSource> singleton =
270            Torello.Browser.BrowserAPI.NestedHelpers.Types.
271                Preload$$PreloadingAttemptSource$$.singleton;
272
273        /** <CODE>[No Description Provided by Google]</CODE> */
274        public final Preload.PreloadingAttemptKey key;
275
276        /** <CODE>[No Description Provided by Google]</CODE> */
277        public final String[] ruleSetIds;
278
279        /** <CODE>[No Description Provided by Google]</CODE> */
280        public final int[] nodeIds;
281
282        /** Constructor.  Please review this class' fields for documentation. */
283        public PreloadingAttemptSource(
284                ReadOnlyList<Boolean> isPresent, PreloadingAttemptKey key, String[] ruleSetIds,
285                int[] nodeIds
286            )
287        {
288            super(singleton, Domains.Preload, "PreloadingAttemptSource", 3);
289
290            this.key        = key;
291            this.ruleSetIds = ruleSetIds;
292            this.nodeIds    = nodeIds;
293
294            this.isPresent = (isPresent == null)
295                ? singleton.generateIsPresentList(this)
296                : THROWS.check(isPresent, 3, "Preload.PreloadingAttemptSource");
297        }
298
299        /** Creates an instance of this class from a {@link JsonObject}.*/
300        public static PreloadingAttemptSource fromJSON(JsonObject jo)
301        { return singleton.fromJSON(jo); }
302
303        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
304        public static NestedDescriptor<PreloadingAttemptSource> descriptor()
305        { return singleton.descriptor(); }
306    }
307
308    /**
309     * Information of headers to be displayed when the header mismatch occurred.
310     * 
311     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
312     */
313    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
314    public static class PrerenderMismatchedHeaders
315        extends BaseType<PrerenderMismatchedHeaders>
316        implements java.io.Serializable
317    {
318        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
319        protected static final long serialVersionUID = 1;
320
321        private static final NestedHelper<Preload.PrerenderMismatchedHeaders> singleton =
322            Torello.Browser.BrowserAPI.NestedHelpers.Types.
323                Preload$$PrerenderMismatchedHeaders$$.singleton;
324
325        /** <CODE>[No Description Provided by Google]</CODE> */
326        public final String headerName;
327
328        /**
329         * <CODE>[No Description Provided by Google]</CODE>
330         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
331         */
332        public final String initialValue;
333
334        /**
335         * <CODE>[No Description Provided by Google]</CODE>
336         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
337         */
338        public final String activationValue;
339
340        /** Constructor.  Please review this class' fields for documentation. */
341        public PrerenderMismatchedHeaders(
342                ReadOnlyList<Boolean> isPresent, String headerName, String initialValue,
343                String activationValue
344            )
345        {
346            super(singleton, Domains.Preload, "PrerenderMismatchedHeaders", 3);
347
348            this.headerName         = headerName;
349            this.initialValue       = initialValue;
350            this.activationValue    = activationValue;
351
352            this.isPresent = (isPresent == null)
353                ? singleton.generateIsPresentList(this)
354                : THROWS.check(isPresent, 3, "Preload.PrerenderMismatchedHeaders");
355        }
356
357        /** Creates an instance of this class from a {@link JsonObject}.*/
358        public static PrerenderMismatchedHeaders fromJSON(JsonObject jo)
359        { return singleton.fromJSON(jo); }
360
361        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
362        public static NestedDescriptor<PrerenderMismatchedHeaders> descriptor()
363        { return singleton.descriptor(); }
364    }
365
366    /**
367     * Corresponds to SpeculationRuleSet
368     * 
369     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
370     */
371    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
372    public static class RuleSet
373        extends BaseType<RuleSet>
374        implements java.io.Serializable
375    {
376        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
377        protected static final long serialVersionUID = 1;
378
379        private static final NestedHelper<Preload.RuleSet> singleton =
380            Torello.Browser.BrowserAPI.NestedHelpers.Types.
381                Preload$$RuleSet$$.singleton;
382
383        /** <CODE>[No Description Provided by Google]</CODE> */
384        public final String id;
385
386        /** Identifies a document which the rule set is associated with. */
387        public final String loaderId;
388
389        /**
390         * Source text of JSON representing the rule set. If it comes from
391         * <CODE>{@code <script>}</CODE> tag, it is the textContent of the node. Note that it is
392         * a JSON for valid case.
393         * 
394         * See also:
395         * - https://wicg.github.io/nav-speculation/speculation-rules.html
396         * - https://github.com/WICG/nav-speculation/blob/main/triggers.md
397         */
398        public final String sourceText;
399
400        /**
401         * A speculation rule set is either added through an inline
402         * <CODE>{@code <script>}</CODE> tag or through an external resource via the
403         * 'Speculation-Rules' HTTP header. For the first case, we include
404         * the BackendNodeId of the relevant <CODE>{@code <script>}</CODE> tag. For the second
405         * case, we include the external URL where the rule set was loaded
406         * from, and also RequestId if Network domain is enabled.
407         * 
408         * See also:
409         * - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-script
410         * - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-header
411         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
412         */
413        public final Integer backendNodeId;
414
415        /**
416         * <CODE>[No Description Provided by Google]</CODE>
417         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
418         */
419        public final String url;
420
421        /**
422         * <CODE>[No Description Provided by Google]</CODE>
423         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
424         */
425        public final String requestId;
426
427        /**
428         * Error information
429         * <CODE>errorMessage</CODE> is null iff <CODE>errorType</CODE> is null.
430         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
431         * <EMBED CLASS='external-html' DATA-D=Preload DATA-C=RuleSetErrorType DATA-F=errorType DATA-FILE-ID=CDP.EL2>
432         * @see BaseType#enumStrList(String)
433         */
434        public final String errorType;
435
436        /**
437         * TODO(https://crbug.com/1425354): Replace this property with structured error.
438         * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Dep-Top>DEPRECATED</B>
439         */
440        public final String errorMessage;
441
442        /** Constructor.  Please review this class' fields for documentation. */
443        public RuleSet(
444                ReadOnlyList<Boolean> isPresent, String id, String loaderId, String sourceText,
445                Integer backendNodeId, String url, String requestId, String errorType,
446                String errorMessage
447            )
448        {
449            super(singleton, Domains.Preload, "RuleSet", 8);
450
451            this.id             = id;
452            this.loaderId       = loaderId;
453            this.sourceText     = sourceText;
454            this.backendNodeId  = backendNodeId;
455            this.url            = url;
456            this.requestId      = requestId;
457            this.errorType      = errorType;
458            this.errorMessage   = errorMessage;
459
460            this.isPresent = (isPresent == null)
461                ? singleton.generateIsPresentList(this)
462                : THROWS.check(isPresent, 8, "Preload.RuleSet");
463        }
464
465        /** Creates an instance of this class from a {@link JsonObject}.*/
466        public static RuleSet fromJSON(JsonObject jo)
467        { return singleton.fromJSON(jo); }
468
469        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
470        public static NestedDescriptor<RuleSet> descriptor()
471        { return singleton.descriptor(); }
472    }
473
474
475    // ********************************************************************************************
476    // ********************************************************************************************
477    // Event Types
478    // ********************************************************************************************
479    // ********************************************************************************************
480
481
482    /**
483     * Fired when a prefetch attempt is updated.
484     * 
485     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
486     */
487    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
488    public static class prefetchStatusUpdated
489        extends BrowserEvent<prefetchStatusUpdated>
490        implements java.io.Serializable
491    {
492        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
493        protected static final long serialVersionUID = 1;
494
495        private static final NestedHelper<Preload.prefetchStatusUpdated> singleton =
496            Torello.Browser.BrowserAPI.NestedHelpers.Events.
497                Preload$$prefetchStatusUpdated$$.singleton;
498
499        /** <CODE>[No Description Provided by Google]</CODE> */
500        public final Preload.PreloadingAttemptKey key;
501
502        /** <CODE>[No Description Provided by Google]</CODE> */
503        public final String pipelineId;
504
505        /** The frame id of the frame initiating prefetch. */
506        public final String initiatingFrameId;
507
508        /** <CODE>[No Description Provided by Google]</CODE> */
509        public final String prefetchUrl;
510
511        /**
512         * <CODE>[No Description Provided by Google]</CODE>
513         * <EMBED CLASS='external-html' DATA-D=Preload DATA-C=PreloadingStatus DATA-F=status DATA-FILE-ID=CDP.EL2>
514         * @see BaseType#enumStrList(String)
515         */
516        public final String status;
517
518        /**
519         * <CODE>[No Description Provided by Google]</CODE>
520         * <EMBED CLASS='external-html' DATA-D=Preload DATA-C=PrefetchStatus DATA-F=prefetchStatus DATA-FILE-ID=CDP.EL2>
521         * @see BaseType#enumStrList(String)
522         */
523        public final String prefetchStatus;
524
525        /** <CODE>[No Description Provided by Google]</CODE> */
526        public final String requestId;
527
528        /** Constructor.  Please review this class' fields for documentation. */
529        public prefetchStatusUpdated(
530                ReadOnlyList<Boolean> isPresent, PreloadingAttemptKey key, String pipelineId,
531                String initiatingFrameId, String prefetchUrl, String status, String prefetchStatus,
532                String requestId
533            )
534        {
535            super(singleton, Domains.Preload, "prefetchStatusUpdated", 7);
536
537            this.key                = key;
538            this.pipelineId         = pipelineId;
539            this.initiatingFrameId  = initiatingFrameId;
540            this.prefetchUrl        = prefetchUrl;
541            this.status             = status;
542            this.prefetchStatus     = prefetchStatus;
543            this.requestId          = requestId;
544
545            this.isPresent = (isPresent == null)
546                ? singleton.generateIsPresentList(this)
547                : THROWS.check(isPresent, 7, "Preload.prefetchStatusUpdated");
548        }
549
550        /** Creates an instance of this class from a {@link JsonObject}.*/
551        public static prefetchStatusUpdated fromJSON(JsonObject jo)
552        { return singleton.fromJSON(jo); }
553
554        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
555        public static NestedDescriptor<prefetchStatusUpdated> descriptor()
556        { return singleton.descriptor(); }
557    }
558
559    /**
560     * Fired when a preload enabled state is updated.
561     * 
562     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
563     */
564    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
565    public static class preloadEnabledStateUpdated
566        extends BrowserEvent<preloadEnabledStateUpdated>
567        implements java.io.Serializable
568    {
569        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
570        protected static final long serialVersionUID = 1;
571
572        private static final NestedHelper<Preload.preloadEnabledStateUpdated> singleton =
573            Torello.Browser.BrowserAPI.NestedHelpers.Events.
574                Preload$$preloadEnabledStateUpdated$$.singleton;
575
576        /** <CODE>[No Description Provided by Google]</CODE> */
577        public final boolean disabledByPreference;
578
579        /** <CODE>[No Description Provided by Google]</CODE> */
580        public final boolean disabledByDataSaver;
581
582        /** <CODE>[No Description Provided by Google]</CODE> */
583        public final boolean disabledByBatterySaver;
584
585        /** <CODE>[No Description Provided by Google]</CODE> */
586        public final boolean disabledByHoldbackPrefetchSpeculationRules;
587
588        /** <CODE>[No Description Provided by Google]</CODE> */
589        public final boolean disabledByHoldbackPrerenderSpeculationRules;
590
591        /** Constructor.  Please review this class' fields for documentation. */
592        public preloadEnabledStateUpdated(
593                ReadOnlyList<Boolean> isPresent, boolean disabledByPreference,
594                boolean disabledByDataSaver, boolean disabledByBatterySaver,
595                boolean disabledByHoldbackPrefetchSpeculationRules,
596                boolean disabledByHoldbackPrerenderSpeculationRules
597            )
598        {
599            super(singleton, Domains.Preload, "preloadEnabledStateUpdated", 5);
600
601            this.disabledByPreference                           = disabledByPreference;
602            this.disabledByDataSaver                            = disabledByDataSaver;
603            this.disabledByBatterySaver                         = disabledByBatterySaver;
604            this.disabledByHoldbackPrefetchSpeculationRules     = disabledByHoldbackPrefetchSpeculationRules;
605            this.disabledByHoldbackPrerenderSpeculationRules    = disabledByHoldbackPrerenderSpeculationRules;
606
607            this.isPresent = (isPresent == null)
608                ? singleton.generateIsPresentList(this)
609                : THROWS.check(isPresent, 5, "Preload.preloadEnabledStateUpdated");
610        }
611
612        /** Creates an instance of this class from a {@link JsonObject}.*/
613        public static preloadEnabledStateUpdated fromJSON(JsonObject jo)
614        { return singleton.fromJSON(jo); }
615
616        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
617        public static NestedDescriptor<preloadEnabledStateUpdated> descriptor()
618        { return singleton.descriptor(); }
619    }
620
621    /**
622     * Send a list of sources for all preloading attempts in a document.
623     * 
624     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
625     */
626    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
627    public static class preloadingAttemptSourcesUpdated
628        extends BrowserEvent<preloadingAttemptSourcesUpdated>
629        implements java.io.Serializable
630    {
631        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
632        protected static final long serialVersionUID = 1;
633
634        private static final NestedHelper<Preload.preloadingAttemptSourcesUpdated> singleton =
635            Torello.Browser.BrowserAPI.NestedHelpers.Events.
636                Preload$$preloadingAttemptSourcesUpdated$$.singleton;
637
638        /** <CODE>[No Description Provided by Google]</CODE> */
639        public final String loaderId;
640
641        /** <CODE>[No Description Provided by Google]</CODE> */
642        public final Preload.PreloadingAttemptSource[] preloadingAttemptSources;
643
644        /** Constructor.  Please review this class' fields for documentation. */
645        public preloadingAttemptSourcesUpdated(
646                ReadOnlyList<Boolean> isPresent, String loaderId,
647                PreloadingAttemptSource[] preloadingAttemptSources
648            )
649        {
650            super(singleton, Domains.Preload, "preloadingAttemptSourcesUpdated", 2);
651
652            this.loaderId                   = loaderId;
653            this.preloadingAttemptSources   = preloadingAttemptSources;
654
655            this.isPresent = (isPresent == null)
656                ? singleton.generateIsPresentList(this)
657                : THROWS.check(isPresent, 2, "Preload.preloadingAttemptSourcesUpdated");
658        }
659
660        /** Creates an instance of this class from a {@link JsonObject}.*/
661        public static preloadingAttemptSourcesUpdated fromJSON(JsonObject jo)
662        { return singleton.fromJSON(jo); }
663
664        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
665        public static NestedDescriptor<preloadingAttemptSourcesUpdated> descriptor()
666        { return singleton.descriptor(); }
667    }
668
669    /**
670     * Fired when a prerender attempt is updated.
671     * 
672     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
673     */
674    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
675    public static class prerenderStatusUpdated
676        extends BrowserEvent<prerenderStatusUpdated>
677        implements java.io.Serializable
678    {
679        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
680        protected static final long serialVersionUID = 1;
681
682        private static final NestedHelper<Preload.prerenderStatusUpdated> singleton =
683            Torello.Browser.BrowserAPI.NestedHelpers.Events.
684                Preload$$prerenderStatusUpdated$$.singleton;
685
686        /** <CODE>[No Description Provided by Google]</CODE> */
687        public final Preload.PreloadingAttemptKey key;
688
689        /** <CODE>[No Description Provided by Google]</CODE> */
690        public final String pipelineId;
691
692        /**
693         * <CODE>[No Description Provided by Google]</CODE>
694         * <EMBED CLASS='external-html' DATA-D=Preload DATA-C=PreloadingStatus DATA-F=status DATA-FILE-ID=CDP.EL2>
695         * @see BaseType#enumStrList(String)
696         */
697        public final String status;
698
699        /**
700         * <CODE>[No Description Provided by Google]</CODE>
701         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
702         * <EMBED CLASS='external-html' DATA-D=Preload DATA-C=PrerenderFinalStatus DATA-F=prerenderStatus DATA-FILE-ID=CDP.EL2>
703         * @see BaseType#enumStrList(String)
704         */
705        public final String prerenderStatus;
706
707        /**
708         * This is used to give users more information about the name of Mojo interface
709         * that is incompatible with prerender and has caused the cancellation of the attempt.
710         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
711         */
712        public final String disallowedMojoInterface;
713
714        /**
715         * <CODE>[No Description Provided by Google]</CODE>
716         * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
717         */
718        public final Preload.PrerenderMismatchedHeaders[] mismatchedHeaders;
719
720        /** Constructor.  Please review this class' fields for documentation. */
721        public prerenderStatusUpdated(
722                ReadOnlyList<Boolean> isPresent, PreloadingAttemptKey key, String pipelineId,
723                String status, String prerenderStatus, String disallowedMojoInterface,
724                PrerenderMismatchedHeaders[] mismatchedHeaders
725            )
726        {
727            super(singleton, Domains.Preload, "prerenderStatusUpdated", 6);
728
729            this.key                        = key;
730            this.pipelineId                 = pipelineId;
731            this.status                     = status;
732            this.prerenderStatus            = prerenderStatus;
733            this.disallowedMojoInterface    = disallowedMojoInterface;
734            this.mismatchedHeaders          = mismatchedHeaders;
735
736            this.isPresent = (isPresent == null)
737                ? singleton.generateIsPresentList(this)
738                : THROWS.check(isPresent, 6, "Preload.prerenderStatusUpdated");
739        }
740
741        /** Creates an instance of this class from a {@link JsonObject}.*/
742        public static prerenderStatusUpdated fromJSON(JsonObject jo)
743        { return singleton.fromJSON(jo); }
744
745        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
746        public static NestedDescriptor<prerenderStatusUpdated> descriptor()
747        { return singleton.descriptor(); }
748    }
749
750    /**
751     * <CODE>[No Description Provided by Google]</CODE>
752     * 
753     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
754     */
755    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
756    public static class ruleSetRemoved
757        extends BrowserEvent<ruleSetRemoved>
758        implements java.io.Serializable
759    {
760        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
761        protected static final long serialVersionUID = 1;
762
763        private static final NestedHelper<Preload.ruleSetRemoved> singleton =
764            Torello.Browser.BrowserAPI.NestedHelpers.Events.
765                Preload$$ruleSetRemoved$$.singleton;
766
767        /** <CODE>[No Description Provided by Google]</CODE> */
768        public final String id;
769
770        /** Constructor.  Please review this class' fields for documentation. */
771        public ruleSetRemoved(ReadOnlyList<Boolean> isPresent, String id)
772        {
773            super(singleton, Domains.Preload, "ruleSetRemoved", 1);
774
775            this.id = id;
776
777            this.isPresent = (isPresent == null)
778                ? singleton.generateIsPresentList(this)
779                : THROWS.check(isPresent, 1, "Preload.ruleSetRemoved");
780        }
781
782        /** Creates an instance of this class from a {@link JsonObject}.*/
783        public static ruleSetRemoved fromJSON(JsonObject jo)
784        { return singleton.fromJSON(jo); }
785
786        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
787        public static NestedDescriptor<ruleSetRemoved> descriptor()
788        { return singleton.descriptor(); }
789    }
790
791    /**
792     * Upsert. Currently, it is only emitted when a rule set added.
793     * 
794     * <EMBED CLASS=globalDefs DATA-DOMAIN=Preload DATA-API=BrowserAPI>
795     */
796    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI")
797    public static class ruleSetUpdated
798        extends BrowserEvent<ruleSetUpdated>
799        implements java.io.Serializable
800    {
801        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
802        protected static final long serialVersionUID = 1;
803
804        private static final NestedHelper<Preload.ruleSetUpdated> singleton =
805            Torello.Browser.BrowserAPI.NestedHelpers.Events.
806                Preload$$ruleSetUpdated$$.singleton;
807
808        /** <CODE>[No Description Provided by Google]</CODE> */
809        public final Preload.RuleSet ruleSet;
810
811        /** Constructor.  Please review this class' fields for documentation. */
812        public ruleSetUpdated(ReadOnlyList<Boolean> isPresent, RuleSet ruleSet)
813        {
814            super(singleton, Domains.Preload, "ruleSetUpdated", 1);
815
816            this.ruleSet = ruleSet;
817
818            this.isPresent = (isPresent == null)
819                ? singleton.generateIsPresentList(this)
820                : THROWS.check(isPresent, 1, "Preload.ruleSetUpdated");
821        }
822
823        /** Creates an instance of this class from a {@link JsonObject}.*/
824        public static ruleSetUpdated fromJSON(JsonObject jo)
825        { return singleton.fromJSON(jo); }
826
827        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
828        public static NestedDescriptor<ruleSetUpdated> descriptor()
829        { return singleton.descriptor(); }
830    }
831
832
833
834
835    // ********************************************************************************************
836    // ********************************************************************************************
837    // Commands
838    // ********************************************************************************************
839    // ********************************************************************************************
840
841
842    /**
843     * <CODE>[No Description Provided by Google]</CODE>
844     * 
845     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
846     *
847     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
848     * browser receives the invocation-request.
849     *
850     * <BR /><BR /><DIV CLASS=JDHint>
851     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
852     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
853     * the Browser Function has run to completion.
854     * </DIV>
855     */
856    public static Script<Void> disable()
857    {
858        // Ultra-Simple Request JSON - Because this method has no parameters
859        final String requestJSON = "{\"method\":\"Preload.disable\"}";
860
861        return Script.NO_RET(Domains.Preload, "disable", requestJSON);
862    }
863
864    /**
865     * <CODE>[No Description Provided by Google]</CODE>
866     * 
867     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
868     *
869     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
870     * browser receives the invocation-request.
871     *
872     * <BR /><BR /><DIV CLASS=JDHint>
873     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
874     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
875     * the Browser Function has run to completion.
876     * </DIV>
877     */
878    public static Script<Void> enable()
879    {
880        // Ultra-Simple Request JSON - Because this method has no parameters
881        final String requestJSON = "{\"method\":\"Preload.enable\"}";
882
883        return Script.NO_RET(Domains.Preload, "enable", requestJSON);
884    }
885
886
887}