Skip to main content

browser_protocol/page/
mod.rs

1//! Actions and events related to the inspected page belong to the page domain.
2
3
4use serde::{Serialize, Deserialize};
5use serde_json::Value as JsonValue;
6use std::borrow::Cow;
7
8/// Unique frame identifier.
9
10pub type FrameId<'a> = Cow<'a, str>;
11
12/// Indicates whether a frame has been identified as an ad.
13
14#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
15pub enum AdFrameType {
16    #[default]
17    #[serde(rename = "none")]
18    None,
19    #[serde(rename = "child")]
20    Child,
21    #[serde(rename = "root")]
22    Root,
23}
24
25
26#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
27pub enum AdFrameExplanation {
28    #[default]
29    #[serde(rename = "ParentIsAd")]
30    ParentIsAd,
31    #[serde(rename = "CreatedByAdScript")]
32    CreatedByAdScript,
33    #[serde(rename = "MatchedBlockingRule")]
34    MatchedBlockingRule,
35}
36
37/// Indicates whether a frame has been identified as an ad and why.
38
39#[derive(Debug, Clone, Serialize, Deserialize, Default)]
40#[serde(rename_all = "camelCase")]
41pub struct AdFrameStatus {
42    #[serde(rename = "adFrameType")]
43    ad_frame_type: AdFrameType,
44    #[serde(skip_serializing_if = "Option::is_none")]
45    explanations: Option<Vec<AdFrameExplanation>>,
46}
47
48impl AdFrameStatus {
49    /// Creates a builder for this type with the required parameters:
50    /// * `ad_frame_type`: 
51    pub fn builder(ad_frame_type: impl Into<AdFrameType>) -> AdFrameStatusBuilder {
52        AdFrameStatusBuilder {
53            ad_frame_type: ad_frame_type.into(),
54            explanations: None,
55        }
56    }
57    pub fn ad_frame_type(&self) -> &AdFrameType { &self.ad_frame_type }
58    pub fn explanations(&self) -> Option<&[AdFrameExplanation]> { self.explanations.as_deref() }
59}
60
61
62pub struct AdFrameStatusBuilder {
63    ad_frame_type: AdFrameType,
64    explanations: Option<Vec<AdFrameExplanation>>,
65}
66
67impl AdFrameStatusBuilder {
68    pub fn explanations(mut self, explanations: Vec<AdFrameExplanation>) -> Self { self.explanations = Some(explanations); self }
69    pub fn build(self) -> AdFrameStatus {
70        AdFrameStatus {
71            ad_frame_type: self.ad_frame_type,
72            explanations: self.explanations,
73        }
74    }
75}
76
77/// Indicates whether the frame is a secure context and why it is the case.
78
79#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
80pub enum SecureContextType {
81    #[default]
82    #[serde(rename = "Secure")]
83    Secure,
84    #[serde(rename = "SecureLocalhost")]
85    SecureLocalhost,
86    #[serde(rename = "InsecureScheme")]
87    InsecureScheme,
88    #[serde(rename = "InsecureAncestor")]
89    InsecureAncestor,
90}
91
92/// Indicates whether the frame is cross-origin isolated and why it is the case.
93
94#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
95pub enum CrossOriginIsolatedContextType {
96    #[default]
97    #[serde(rename = "Isolated")]
98    Isolated,
99    #[serde(rename = "NotIsolated")]
100    NotIsolated,
101    #[serde(rename = "NotIsolatedFeatureDisabled")]
102    NotIsolatedFeatureDisabled,
103}
104
105
106#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
107pub enum GatedAPIFeatures {
108    #[default]
109    #[serde(rename = "SharedArrayBuffers")]
110    SharedArrayBuffers,
111    #[serde(rename = "SharedArrayBuffersTransferAllowed")]
112    SharedArrayBuffersTransferAllowed,
113    #[serde(rename = "PerformanceMeasureMemory")]
114    PerformanceMeasureMemory,
115    #[serde(rename = "PerformanceProfile")]
116    PerformanceProfile,
117}
118
119/// All Permissions Policy features. This enum should match the one defined
120/// in services/network/public/cpp/permissions_policy/permissions_policy_features.json5.
121/// LINT.IfChange(PermissionsPolicyFeature)
122
123#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
124pub enum PermissionsPolicyFeature {
125    #[default]
126    #[serde(rename = "accelerometer")]
127    Accelerometer,
128    #[serde(rename = "all-screens-capture")]
129    AllScreensCapture,
130    #[serde(rename = "ambient-light-sensor")]
131    AmbientLightSensor,
132    #[serde(rename = "aria-notify")]
133    AriaNotify,
134    #[serde(rename = "attribution-reporting")]
135    AttributionReporting,
136    #[serde(rename = "autofill")]
137    Autofill,
138    #[serde(rename = "autoplay")]
139    Autoplay,
140    #[serde(rename = "bluetooth")]
141    Bluetooth,
142    #[serde(rename = "browsing-topics")]
143    BrowsingTopics,
144    #[serde(rename = "camera")]
145    Camera,
146    #[serde(rename = "captured-surface-control")]
147    CapturedSurfaceControl,
148    #[serde(rename = "ch-dpr")]
149    ChDpr,
150    #[serde(rename = "ch-device-memory")]
151    ChDeviceMemory,
152    #[serde(rename = "ch-downlink")]
153    ChDownlink,
154    #[serde(rename = "ch-ect")]
155    ChEct,
156    #[serde(rename = "ch-prefers-color-scheme")]
157    ChPrefersColorScheme,
158    #[serde(rename = "ch-prefers-reduced-motion")]
159    ChPrefersReducedMotion,
160    #[serde(rename = "ch-prefers-reduced-transparency")]
161    ChPrefersReducedTransparency,
162    #[serde(rename = "ch-rtt")]
163    ChRtt,
164    #[serde(rename = "ch-save-data")]
165    ChSaveData,
166    #[serde(rename = "ch-ua")]
167    ChUa,
168    #[serde(rename = "ch-ua-arch")]
169    ChUaArch,
170    #[serde(rename = "ch-ua-bitness")]
171    ChUaBitness,
172    #[serde(rename = "ch-ua-high-entropy-values")]
173    ChUaHighEntropyValues,
174    #[serde(rename = "ch-ua-platform")]
175    ChUaPlatform,
176    #[serde(rename = "ch-ua-model")]
177    ChUaModel,
178    #[serde(rename = "ch-ua-mobile")]
179    ChUaMobile,
180    #[serde(rename = "ch-ua-form-factors")]
181    ChUaFormFactors,
182    #[serde(rename = "ch-ua-full-version")]
183    ChUaFullVersion,
184    #[serde(rename = "ch-ua-full-version-list")]
185    ChUaFullVersionList,
186    #[serde(rename = "ch-ua-platform-version")]
187    ChUaPlatformVersion,
188    #[serde(rename = "ch-ua-wow64")]
189    ChUaWow64,
190    #[serde(rename = "ch-viewport-height")]
191    ChViewportHeight,
192    #[serde(rename = "ch-viewport-width")]
193    ChViewportWidth,
194    #[serde(rename = "ch-width")]
195    ChWidth,
196    #[serde(rename = "clipboard-read")]
197    ClipboardRead,
198    #[serde(rename = "clipboard-write")]
199    ClipboardWrite,
200    #[serde(rename = "compute-pressure")]
201    ComputePressure,
202    #[serde(rename = "controlled-frame")]
203    ControlledFrame,
204    #[serde(rename = "cross-origin-isolated")]
205    CrossOriginIsolated,
206    #[serde(rename = "deferred-fetch")]
207    DeferredFetch,
208    #[serde(rename = "deferred-fetch-minimal")]
209    DeferredFetchMinimal,
210    #[serde(rename = "device-attributes")]
211    DeviceAttributes,
212    #[serde(rename = "digital-credentials-create")]
213    DigitalCredentialsCreate,
214    #[serde(rename = "digital-credentials-get")]
215    DigitalCredentialsGet,
216    #[serde(rename = "direct-sockets")]
217    DirectSockets,
218    #[serde(rename = "direct-sockets-multicast")]
219    DirectSocketsMulticast,
220    #[serde(rename = "direct-sockets-private")]
221    DirectSocketsPrivate,
222    #[serde(rename = "display-capture")]
223    DisplayCapture,
224    #[serde(rename = "document-domain")]
225    DocumentDomain,
226    #[serde(rename = "encrypted-media")]
227    EncryptedMedia,
228    #[serde(rename = "execution-while-out-of-viewport")]
229    ExecutionWhileOutOfViewport,
230    #[serde(rename = "execution-while-not-rendered")]
231    ExecutionWhileNotRendered,
232    #[serde(rename = "focus-without-user-activation")]
233    FocusWithoutUserActivation,
234    #[serde(rename = "fullscreen")]
235    Fullscreen,
236    #[serde(rename = "frobulate")]
237    Frobulate,
238    #[serde(rename = "gamepad")]
239    Gamepad,
240    #[serde(rename = "geolocation")]
241    Geolocation,
242    #[serde(rename = "gyroscope")]
243    Gyroscope,
244    #[serde(rename = "hid")]
245    Hid,
246    #[serde(rename = "identity-credentials-get")]
247    IdentityCredentialsGet,
248    #[serde(rename = "idle-detection")]
249    IdleDetection,
250    #[serde(rename = "interest-cohort")]
251    InterestCohort,
252    #[serde(rename = "join-ad-interest-group")]
253    JoinAdInterestGroup,
254    #[serde(rename = "keyboard-map")]
255    KeyboardMap,
256    #[serde(rename = "language-detector")]
257    LanguageDetector,
258    #[serde(rename = "language-model")]
259    LanguageModel,
260    #[serde(rename = "local-fonts")]
261    LocalFonts,
262    #[serde(rename = "local-network")]
263    LocalNetwork,
264    #[serde(rename = "local-network-access")]
265    LocalNetworkAccess,
266    #[serde(rename = "loopback-network")]
267    LoopbackNetwork,
268    #[serde(rename = "magnetometer")]
269    Magnetometer,
270    #[serde(rename = "manual-text")]
271    ManualText,
272    #[serde(rename = "media-playback-while-not-visible")]
273    MediaPlaybackWhileNotVisible,
274    #[serde(rename = "microphone")]
275    Microphone,
276    #[serde(rename = "midi")]
277    Midi,
278    #[serde(rename = "on-device-speech-recognition")]
279    OnDeviceSpeechRecognition,
280    #[serde(rename = "otp-credentials")]
281    OtpCredentials,
282    #[serde(rename = "payment")]
283    Payment,
284    #[serde(rename = "picture-in-picture")]
285    PictureInPicture,
286    #[serde(rename = "private-aggregation")]
287    PrivateAggregation,
288    #[serde(rename = "private-state-token-issuance")]
289    PrivateStateTokenIssuance,
290    #[serde(rename = "private-state-token-redemption")]
291    PrivateStateTokenRedemption,
292    #[serde(rename = "publickey-credentials-create")]
293    PublickeyCredentialsCreate,
294    #[serde(rename = "publickey-credentials-get")]
295    PublickeyCredentialsGet,
296    #[serde(rename = "record-ad-auction-events")]
297    RecordAdAuctionEvents,
298    #[serde(rename = "rewriter")]
299    Rewriter,
300    #[serde(rename = "run-ad-auction")]
301    RunAdAuction,
302    #[serde(rename = "screen-wake-lock")]
303    ScreenWakeLock,
304    #[serde(rename = "serial")]
305    Serial,
306    #[serde(rename = "shared-storage")]
307    SharedStorage,
308    #[serde(rename = "shared-storage-select-url")]
309    SharedStorageSelectUrl,
310    #[serde(rename = "smart-card")]
311    SmartCard,
312    #[serde(rename = "speaker-selection")]
313    SpeakerSelection,
314    #[serde(rename = "storage-access")]
315    StorageAccess,
316    #[serde(rename = "sub-apps")]
317    SubApps,
318    #[serde(rename = "summarizer")]
319    Summarizer,
320    #[serde(rename = "sync-xhr")]
321    SyncXhr,
322    #[serde(rename = "tools")]
323    Tools,
324    #[serde(rename = "translator")]
325    Translator,
326    #[serde(rename = "unload")]
327    Unload,
328    #[serde(rename = "usb")]
329    Usb,
330    #[serde(rename = "usb-unrestricted")]
331    UsbUnrestricted,
332    #[serde(rename = "vertical-scroll")]
333    VerticalScroll,
334    #[serde(rename = "web-app-installation")]
335    WebAppInstallation,
336    #[serde(rename = "web-printing")]
337    WebPrinting,
338    #[serde(rename = "web-share")]
339    WebShare,
340    #[serde(rename = "window-management")]
341    WindowManagement,
342    #[serde(rename = "writer")]
343    Writer,
344    #[serde(rename = "xr-spatial-tracking")]
345    XrSpatialTracking,
346}
347
348/// Reason for a permissions policy feature to be disabled.
349
350#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
351pub enum PermissionsPolicyBlockReason {
352    #[default]
353    #[serde(rename = "Header")]
354    Header,
355    #[serde(rename = "IframeAttribute")]
356    IframeAttribute,
357    #[serde(rename = "InFencedFrameTree")]
358    InFencedFrameTree,
359    #[serde(rename = "InIsolatedApp")]
360    InIsolatedApp,
361}
362
363
364#[derive(Debug, Clone, Serialize, Deserialize, Default)]
365#[serde(rename_all = "camelCase")]
366pub struct PermissionsPolicyBlockLocator<'a> {
367    #[serde(rename = "frameId")]
368    frame_id: FrameId<'a>,
369    #[serde(rename = "blockReason")]
370    block_reason: PermissionsPolicyBlockReason,
371}
372
373impl<'a> PermissionsPolicyBlockLocator<'a> {
374    /// Creates a builder for this type with the required parameters:
375    /// * `frame_id`: 
376    /// * `block_reason`: 
377    pub fn builder(frame_id: impl Into<FrameId<'a>>, block_reason: impl Into<PermissionsPolicyBlockReason>) -> PermissionsPolicyBlockLocatorBuilder<'a> {
378        PermissionsPolicyBlockLocatorBuilder {
379            frame_id: frame_id.into(),
380            block_reason: block_reason.into(),
381        }
382    }
383    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
384    pub fn block_reason(&self) -> &PermissionsPolicyBlockReason { &self.block_reason }
385}
386
387
388pub struct PermissionsPolicyBlockLocatorBuilder<'a> {
389    frame_id: FrameId<'a>,
390    block_reason: PermissionsPolicyBlockReason,
391}
392
393impl<'a> PermissionsPolicyBlockLocatorBuilder<'a> {
394    pub fn build(self) -> PermissionsPolicyBlockLocator<'a> {
395        PermissionsPolicyBlockLocator {
396            frame_id: self.frame_id,
397            block_reason: self.block_reason,
398        }
399    }
400}
401
402
403#[derive(Debug, Clone, Serialize, Deserialize, Default)]
404#[serde(rename_all = "camelCase")]
405pub struct PermissionsPolicyFeatureState<'a> {
406    feature: PermissionsPolicyFeature,
407    allowed: bool,
408    #[serde(skip_serializing_if = "Option::is_none")]
409    locator: Option<PermissionsPolicyBlockLocator<'a>>,
410}
411
412impl<'a> PermissionsPolicyFeatureState<'a> {
413    /// Creates a builder for this type with the required parameters:
414    /// * `feature`: 
415    /// * `allowed`: 
416    pub fn builder(feature: impl Into<PermissionsPolicyFeature>, allowed: bool) -> PermissionsPolicyFeatureStateBuilder<'a> {
417        PermissionsPolicyFeatureStateBuilder {
418            feature: feature.into(),
419            allowed: allowed,
420            locator: None,
421        }
422    }
423    pub fn feature(&self) -> &PermissionsPolicyFeature { &self.feature }
424    pub fn allowed(&self) -> bool { self.allowed }
425    pub fn locator(&self) -> Option<&PermissionsPolicyBlockLocator<'a>> { self.locator.as_ref() }
426}
427
428
429pub struct PermissionsPolicyFeatureStateBuilder<'a> {
430    feature: PermissionsPolicyFeature,
431    allowed: bool,
432    locator: Option<PermissionsPolicyBlockLocator<'a>>,
433}
434
435impl<'a> PermissionsPolicyFeatureStateBuilder<'a> {
436    pub fn locator(mut self, locator: PermissionsPolicyBlockLocator<'a>) -> Self { self.locator = Some(locator); self }
437    pub fn build(self) -> PermissionsPolicyFeatureState<'a> {
438        PermissionsPolicyFeatureState {
439            feature: self.feature,
440            allowed: self.allowed,
441            locator: self.locator,
442        }
443    }
444}
445
446/// Origin Trial(<https://www.chromium.org/blink/origin-trials>) support.
447/// Status for an Origin Trial token.
448
449#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
450pub enum OriginTrialTokenStatus {
451    #[default]
452    #[serde(rename = "Success")]
453    Success,
454    #[serde(rename = "NotSupported")]
455    NotSupported,
456    #[serde(rename = "Insecure")]
457    Insecure,
458    #[serde(rename = "Expired")]
459    Expired,
460    #[serde(rename = "WrongOrigin")]
461    WrongOrigin,
462    #[serde(rename = "InvalidSignature")]
463    InvalidSignature,
464    #[serde(rename = "Malformed")]
465    Malformed,
466    #[serde(rename = "WrongVersion")]
467    WrongVersion,
468    #[serde(rename = "FeatureDisabled")]
469    FeatureDisabled,
470    #[serde(rename = "TokenDisabled")]
471    TokenDisabled,
472    #[serde(rename = "FeatureDisabledForUser")]
473    FeatureDisabledForUser,
474    #[serde(rename = "UnknownTrial")]
475    UnknownTrial,
476}
477
478/// Status for an Origin Trial.
479
480#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
481pub enum OriginTrialStatus {
482    #[default]
483    #[serde(rename = "Enabled")]
484    Enabled,
485    #[serde(rename = "ValidTokenNotProvided")]
486    ValidTokenNotProvided,
487    #[serde(rename = "OSNotSupported")]
488    OSNotSupported,
489    #[serde(rename = "TrialNotAllowed")]
490    TrialNotAllowed,
491}
492
493
494#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
495pub enum OriginTrialUsageRestriction {
496    #[default]
497    #[serde(rename = "None")]
498    None,
499    #[serde(rename = "Subset")]
500    Subset,
501}
502
503
504#[derive(Debug, Clone, Serialize, Deserialize, Default)]
505#[serde(rename_all = "camelCase")]
506pub struct OriginTrialToken<'a> {
507    origin: Cow<'a, str>,
508    #[serde(rename = "matchSubDomains")]
509    match_sub_domains: bool,
510    #[serde(rename = "trialName")]
511    trial_name: Cow<'a, str>,
512    #[serde(rename = "expiryTime")]
513    expiry_time: crate::network::TimeSinceEpoch,
514    #[serde(rename = "isThirdParty")]
515    is_third_party: bool,
516    #[serde(rename = "usageRestriction")]
517    usage_restriction: OriginTrialUsageRestriction,
518}
519
520impl<'a> OriginTrialToken<'a> {
521    /// Creates a builder for this type with the required parameters:
522    /// * `origin`: 
523    /// * `match_sub_domains`: 
524    /// * `trial_name`: 
525    /// * `expiry_time`: 
526    /// * `is_third_party`: 
527    /// * `usage_restriction`: 
528    pub fn builder(origin: impl Into<Cow<'a, str>>, match_sub_domains: bool, trial_name: impl Into<Cow<'a, str>>, expiry_time: crate::network::TimeSinceEpoch, is_third_party: bool, usage_restriction: impl Into<OriginTrialUsageRestriction>) -> OriginTrialTokenBuilder<'a> {
529        OriginTrialTokenBuilder {
530            origin: origin.into(),
531            match_sub_domains: match_sub_domains,
532            trial_name: trial_name.into(),
533            expiry_time: expiry_time,
534            is_third_party: is_third_party,
535            usage_restriction: usage_restriction.into(),
536        }
537    }
538    pub fn origin(&self) -> &str { self.origin.as_ref() }
539    pub fn match_sub_domains(&self) -> bool { self.match_sub_domains }
540    pub fn trial_name(&self) -> &str { self.trial_name.as_ref() }
541    pub fn expiry_time(&self) -> &crate::network::TimeSinceEpoch { &self.expiry_time }
542    pub fn is_third_party(&self) -> bool { self.is_third_party }
543    pub fn usage_restriction(&self) -> &OriginTrialUsageRestriction { &self.usage_restriction }
544}
545
546
547pub struct OriginTrialTokenBuilder<'a> {
548    origin: Cow<'a, str>,
549    match_sub_domains: bool,
550    trial_name: Cow<'a, str>,
551    expiry_time: crate::network::TimeSinceEpoch,
552    is_third_party: bool,
553    usage_restriction: OriginTrialUsageRestriction,
554}
555
556impl<'a> OriginTrialTokenBuilder<'a> {
557    pub fn build(self) -> OriginTrialToken<'a> {
558        OriginTrialToken {
559            origin: self.origin,
560            match_sub_domains: self.match_sub_domains,
561            trial_name: self.trial_name,
562            expiry_time: self.expiry_time,
563            is_third_party: self.is_third_party,
564            usage_restriction: self.usage_restriction,
565        }
566    }
567}
568
569
570#[derive(Debug, Clone, Serialize, Deserialize, Default)]
571#[serde(rename_all = "camelCase")]
572pub struct OriginTrialTokenWithStatus<'a> {
573    #[serde(rename = "rawTokenText")]
574    raw_token_text: Cow<'a, str>,
575    /// 'parsedToken' is present only when the token is extractable and
576    /// parsable.
577    #[serde(skip_serializing_if = "Option::is_none", rename = "parsedToken")]
578    parsed_token: Option<OriginTrialToken<'a>>,
579    status: OriginTrialTokenStatus,
580}
581
582impl<'a> OriginTrialTokenWithStatus<'a> {
583    /// Creates a builder for this type with the required parameters:
584    /// * `raw_token_text`: 
585    /// * `status`: 
586    pub fn builder(raw_token_text: impl Into<Cow<'a, str>>, status: impl Into<OriginTrialTokenStatus>) -> OriginTrialTokenWithStatusBuilder<'a> {
587        OriginTrialTokenWithStatusBuilder {
588            raw_token_text: raw_token_text.into(),
589            parsed_token: None,
590            status: status.into(),
591        }
592    }
593    pub fn raw_token_text(&self) -> &str { self.raw_token_text.as_ref() }
594    /// 'parsedToken' is present only when the token is extractable and
595    /// parsable.
596    pub fn parsed_token(&self) -> Option<&OriginTrialToken<'a>> { self.parsed_token.as_ref() }
597    pub fn status(&self) -> &OriginTrialTokenStatus { &self.status }
598}
599
600
601pub struct OriginTrialTokenWithStatusBuilder<'a> {
602    raw_token_text: Cow<'a, str>,
603    parsed_token: Option<OriginTrialToken<'a>>,
604    status: OriginTrialTokenStatus,
605}
606
607impl<'a> OriginTrialTokenWithStatusBuilder<'a> {
608    /// 'parsedToken' is present only when the token is extractable and
609    /// parsable.
610    pub fn parsed_token(mut self, parsed_token: OriginTrialToken<'a>) -> Self { self.parsed_token = Some(parsed_token); self }
611    pub fn build(self) -> OriginTrialTokenWithStatus<'a> {
612        OriginTrialTokenWithStatus {
613            raw_token_text: self.raw_token_text,
614            parsed_token: self.parsed_token,
615            status: self.status,
616        }
617    }
618}
619
620
621#[derive(Debug, Clone, Serialize, Deserialize, Default)]
622#[serde(rename_all = "camelCase")]
623pub struct OriginTrial<'a> {
624    #[serde(rename = "trialName")]
625    trial_name: Cow<'a, str>,
626    status: OriginTrialStatus,
627    #[serde(rename = "tokensWithStatus")]
628    tokens_with_status: Vec<OriginTrialTokenWithStatus<'a>>,
629}
630
631impl<'a> OriginTrial<'a> {
632    /// Creates a builder for this type with the required parameters:
633    /// * `trial_name`: 
634    /// * `status`: 
635    /// * `tokens_with_status`: 
636    pub fn builder(trial_name: impl Into<Cow<'a, str>>, status: impl Into<OriginTrialStatus>, tokens_with_status: Vec<OriginTrialTokenWithStatus<'a>>) -> OriginTrialBuilder<'a> {
637        OriginTrialBuilder {
638            trial_name: trial_name.into(),
639            status: status.into(),
640            tokens_with_status: tokens_with_status,
641        }
642    }
643    pub fn trial_name(&self) -> &str { self.trial_name.as_ref() }
644    pub fn status(&self) -> &OriginTrialStatus { &self.status }
645    pub fn tokens_with_status(&self) -> &[OriginTrialTokenWithStatus<'a>] { &self.tokens_with_status }
646}
647
648
649pub struct OriginTrialBuilder<'a> {
650    trial_name: Cow<'a, str>,
651    status: OriginTrialStatus,
652    tokens_with_status: Vec<OriginTrialTokenWithStatus<'a>>,
653}
654
655impl<'a> OriginTrialBuilder<'a> {
656    pub fn build(self) -> OriginTrial<'a> {
657        OriginTrial {
658            trial_name: self.trial_name,
659            status: self.status,
660            tokens_with_status: self.tokens_with_status,
661        }
662    }
663}
664
665/// Additional information about the frame document's security origin.
666
667#[derive(Debug, Clone, Serialize, Deserialize, Default)]
668#[serde(rename_all = "camelCase")]
669pub struct SecurityOriginDetails {
670    /// Indicates whether the frame document's security origin is one
671    /// of the local hostnames (e.g. "localhost") or IP addresses (IPv4
672    /// 127.0.0.0/8 or IPv6 ::1).
673    #[serde(rename = "isLocalhost")]
674    is_localhost: bool,
675}
676
677impl SecurityOriginDetails {
678    /// Creates a builder for this type with the required parameters:
679    /// * `is_localhost`: Indicates whether the frame document's security origin is one of the local hostnames (e.g. "localhost") or IP addresses (IPv4 127.0.0.0/8 or IPv6 ::1).
680    pub fn builder(is_localhost: bool) -> SecurityOriginDetailsBuilder {
681        SecurityOriginDetailsBuilder {
682            is_localhost: is_localhost,
683        }
684    }
685    /// Indicates whether the frame document's security origin is one
686    /// of the local hostnames (e.g. "localhost") or IP addresses (IPv4
687    /// 127.0.0.0/8 or IPv6 ::1).
688    pub fn is_localhost(&self) -> bool { self.is_localhost }
689}
690
691
692pub struct SecurityOriginDetailsBuilder {
693    is_localhost: bool,
694}
695
696impl SecurityOriginDetailsBuilder {
697    pub fn build(self) -> SecurityOriginDetails {
698        SecurityOriginDetails {
699            is_localhost: self.is_localhost,
700        }
701    }
702}
703
704/// Information about the Frame on the page.
705
706#[derive(Debug, Clone, Serialize, Deserialize, Default)]
707#[serde(rename_all = "camelCase")]
708pub struct Frame<'a> {
709    /// Frame unique identifier.
710    id: FrameId<'a>,
711    /// Parent frame identifier.
712    #[serde(skip_serializing_if = "Option::is_none", rename = "parentId")]
713    parent_id: Option<FrameId<'a>>,
714    /// Identifier of the loader associated with this frame.
715    #[serde(rename = "loaderId")]
716    loader_id: crate::network::LoaderId<'a>,
717    /// Frame's name as specified in the tag.
718    #[serde(skip_serializing_if = "Option::is_none")]
719    name: Option<Cow<'a, str>>,
720    /// Frame document's URL without fragment.
721    url: Cow<'a, str>,
722    /// Frame document's URL fragment including the '#'.
723    #[serde(skip_serializing_if = "Option::is_none", rename = "urlFragment")]
724    url_fragment: Option<Cow<'a, str>>,
725    /// Frame document's registered domain, taking the public suffixes list into account.
726    /// Extracted from the Frame's url.
727    /// Example URLs: <http://www.google.com/file.html> -\> "google.com"
728    /// <http://a.b.co.uk/file.html>      -\> "b.co.uk"
729    #[serde(rename = "domainAndRegistry")]
730    domain_and_registry: Cow<'a, str>,
731    /// Frame document's security origin.
732    #[serde(rename = "securityOrigin")]
733    security_origin: Cow<'a, str>,
734    /// Additional details about the frame document's security origin.
735    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOriginDetails")]
736    security_origin_details: Option<SecurityOriginDetails>,
737    /// Frame document's mimeType as determined by the browser.
738    #[serde(rename = "mimeType")]
739    mime_type: Cow<'a, str>,
740    /// If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment.
741    #[serde(skip_serializing_if = "Option::is_none", rename = "unreachableUrl")]
742    unreachable_url: Option<Cow<'a, str>>,
743    /// Indicates whether this frame was tagged as an ad and why.
744    #[serde(skip_serializing_if = "Option::is_none", rename = "adFrameStatus")]
745    ad_frame_status: Option<AdFrameStatus>,
746    /// Indicates whether the main document is a secure context and explains why that is the case.
747    #[serde(rename = "secureContextType")]
748    secure_context_type: SecureContextType,
749    /// Indicates whether this is a cross origin isolated context.
750    #[serde(rename = "crossOriginIsolatedContextType")]
751    cross_origin_isolated_context_type: CrossOriginIsolatedContextType,
752    /// Indicated which gated APIs / features are available.
753    #[serde(rename = "gatedAPIFeatures")]
754    gated_api_features: Vec<GatedAPIFeatures>,
755}
756
757impl<'a> Frame<'a> {
758    /// Creates a builder for this type with the required parameters:
759    /// * `id`: Frame unique identifier.
760    /// * `loader_id`: Identifier of the loader associated with this frame.
761    /// * `url`: Frame document's URL without fragment.
762    /// * `domain_and_registry`: Frame document's registered domain, taking the public suffixes list into account. Extracted from the Frame's url. Example URLs: <http://www.google.com/file.html> -\> "google.com"               <http://a.b.co.uk/file.html>      -\> "b.co.uk"
763    /// * `security_origin`: Frame document's security origin.
764    /// * `mime_type`: Frame document's mimeType as determined by the browser.
765    /// * `secure_context_type`: Indicates whether the main document is a secure context and explains why that is the case.
766    /// * `cross_origin_isolated_context_type`: Indicates whether this is a cross origin isolated context.
767    /// * `gated_api_features`: Indicated which gated APIs / features are available.
768    pub fn builder(id: impl Into<FrameId<'a>>, loader_id: crate::network::LoaderId<'a>, url: impl Into<Cow<'a, str>>, domain_and_registry: impl Into<Cow<'a, str>>, security_origin: impl Into<Cow<'a, str>>, mime_type: impl Into<Cow<'a, str>>, secure_context_type: impl Into<SecureContextType>, cross_origin_isolated_context_type: impl Into<CrossOriginIsolatedContextType>, gated_api_features: Vec<GatedAPIFeatures>) -> FrameBuilder<'a> {
769        FrameBuilder {
770            id: id.into(),
771            parent_id: None,
772            loader_id: loader_id,
773            name: None,
774            url: url.into(),
775            url_fragment: None,
776            domain_and_registry: domain_and_registry.into(),
777            security_origin: security_origin.into(),
778            security_origin_details: None,
779            mime_type: mime_type.into(),
780            unreachable_url: None,
781            ad_frame_status: None,
782            secure_context_type: secure_context_type.into(),
783            cross_origin_isolated_context_type: cross_origin_isolated_context_type.into(),
784            gated_api_features: gated_api_features,
785        }
786    }
787    /// Frame unique identifier.
788    pub fn id(&self) -> &FrameId<'a> { &self.id }
789    /// Parent frame identifier.
790    pub fn parent_id(&self) -> Option<&FrameId<'a>> { self.parent_id.as_ref() }
791    /// Identifier of the loader associated with this frame.
792    pub fn loader_id(&self) -> &crate::network::LoaderId<'a> { &self.loader_id }
793    /// Frame's name as specified in the tag.
794    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
795    /// Frame document's URL without fragment.
796    pub fn url(&self) -> &str { self.url.as_ref() }
797    /// Frame document's URL fragment including the '#'.
798    pub fn url_fragment(&self) -> Option<&str> { self.url_fragment.as_deref() }
799    /// Frame document's registered domain, taking the public suffixes list into account.
800    /// Extracted from the Frame's url.
801    /// Example URLs: <http://www.google.com/file.html> -\> "google.com"
802    /// <http://a.b.co.uk/file.html>      -\> "b.co.uk"
803    pub fn domain_and_registry(&self) -> &str { self.domain_and_registry.as_ref() }
804    /// Frame document's security origin.
805    pub fn security_origin(&self) -> &str { self.security_origin.as_ref() }
806    /// Additional details about the frame document's security origin.
807    pub fn security_origin_details(&self) -> Option<&SecurityOriginDetails> { self.security_origin_details.as_ref() }
808    /// Frame document's mimeType as determined by the browser.
809    pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
810    /// If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment.
811    pub fn unreachable_url(&self) -> Option<&str> { self.unreachable_url.as_deref() }
812    /// Indicates whether this frame was tagged as an ad and why.
813    pub fn ad_frame_status(&self) -> Option<&AdFrameStatus> { self.ad_frame_status.as_ref() }
814    /// Indicates whether the main document is a secure context and explains why that is the case.
815    pub fn secure_context_type(&self) -> &SecureContextType { &self.secure_context_type }
816    /// Indicates whether this is a cross origin isolated context.
817    pub fn cross_origin_isolated_context_type(&self) -> &CrossOriginIsolatedContextType { &self.cross_origin_isolated_context_type }
818    /// Indicated which gated APIs / features are available.
819    pub fn gated_api_features(&self) -> &[GatedAPIFeatures] { &self.gated_api_features }
820}
821
822
823pub struct FrameBuilder<'a> {
824    id: FrameId<'a>,
825    parent_id: Option<FrameId<'a>>,
826    loader_id: crate::network::LoaderId<'a>,
827    name: Option<Cow<'a, str>>,
828    url: Cow<'a, str>,
829    url_fragment: Option<Cow<'a, str>>,
830    domain_and_registry: Cow<'a, str>,
831    security_origin: Cow<'a, str>,
832    security_origin_details: Option<SecurityOriginDetails>,
833    mime_type: Cow<'a, str>,
834    unreachable_url: Option<Cow<'a, str>>,
835    ad_frame_status: Option<AdFrameStatus>,
836    secure_context_type: SecureContextType,
837    cross_origin_isolated_context_type: CrossOriginIsolatedContextType,
838    gated_api_features: Vec<GatedAPIFeatures>,
839}
840
841impl<'a> FrameBuilder<'a> {
842    /// Parent frame identifier.
843    pub fn parent_id(mut self, parent_id: impl Into<FrameId<'a>>) -> Self { self.parent_id = Some(parent_id.into()); self }
844    /// Frame's name as specified in the tag.
845    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
846    /// Frame document's URL fragment including the '#'.
847    pub fn url_fragment(mut self, url_fragment: impl Into<Cow<'a, str>>) -> Self { self.url_fragment = Some(url_fragment.into()); self }
848    /// Additional details about the frame document's security origin.
849    pub fn security_origin_details(mut self, security_origin_details: SecurityOriginDetails) -> Self { self.security_origin_details = Some(security_origin_details); self }
850    /// If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment.
851    pub fn unreachable_url(mut self, unreachable_url: impl Into<Cow<'a, str>>) -> Self { self.unreachable_url = Some(unreachable_url.into()); self }
852    /// Indicates whether this frame was tagged as an ad and why.
853    pub fn ad_frame_status(mut self, ad_frame_status: AdFrameStatus) -> Self { self.ad_frame_status = Some(ad_frame_status); self }
854    pub fn build(self) -> Frame<'a> {
855        Frame {
856            id: self.id,
857            parent_id: self.parent_id,
858            loader_id: self.loader_id,
859            name: self.name,
860            url: self.url,
861            url_fragment: self.url_fragment,
862            domain_and_registry: self.domain_and_registry,
863            security_origin: self.security_origin,
864            security_origin_details: self.security_origin_details,
865            mime_type: self.mime_type,
866            unreachable_url: self.unreachable_url,
867            ad_frame_status: self.ad_frame_status,
868            secure_context_type: self.secure_context_type,
869            cross_origin_isolated_context_type: self.cross_origin_isolated_context_type,
870            gated_api_features: self.gated_api_features,
871        }
872    }
873}
874
875/// Information about the Resource on the page.
876
877#[derive(Debug, Clone, Serialize, Deserialize, Default)]
878#[serde(rename_all = "camelCase")]
879pub struct FrameResource<'a> {
880    /// Resource URL.
881    url: Cow<'a, str>,
882    /// Type of this resource.
883    #[serde(rename = "type")]
884    type_: crate::network::ResourceType,
885    /// Resource mimeType as determined by the browser.
886    #[serde(rename = "mimeType")]
887    mime_type: Cow<'a, str>,
888    /// last-modified timestamp as reported by server.
889    #[serde(skip_serializing_if = "Option::is_none", rename = "lastModified")]
890    last_modified: Option<crate::network::TimeSinceEpoch>,
891    /// Resource content size.
892    #[serde(skip_serializing_if = "Option::is_none", rename = "contentSize")]
893    content_size: Option<f64>,
894    /// True if the resource failed to load.
895    #[serde(skip_serializing_if = "Option::is_none")]
896    failed: Option<bool>,
897    /// True if the resource was canceled during loading.
898    #[serde(skip_serializing_if = "Option::is_none")]
899    canceled: Option<bool>,
900}
901
902impl<'a> FrameResource<'a> {
903    /// Creates a builder for this type with the required parameters:
904    /// * `url`: Resource URL.
905    /// * `type_`: Type of this resource.
906    /// * `mime_type`: Resource mimeType as determined by the browser.
907    pub fn builder(url: impl Into<Cow<'a, str>>, type_: crate::network::ResourceType, mime_type: impl Into<Cow<'a, str>>) -> FrameResourceBuilder<'a> {
908        FrameResourceBuilder {
909            url: url.into(),
910            type_: type_,
911            mime_type: mime_type.into(),
912            last_modified: None,
913            content_size: None,
914            failed: None,
915            canceled: None,
916        }
917    }
918    /// Resource URL.
919    pub fn url(&self) -> &str { self.url.as_ref() }
920    /// Type of this resource.
921    pub fn type_(&self) -> &crate::network::ResourceType { &self.type_ }
922    /// Resource mimeType as determined by the browser.
923    pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
924    /// last-modified timestamp as reported by server.
925    pub fn last_modified(&self) -> Option<&crate::network::TimeSinceEpoch> { self.last_modified.as_ref() }
926    /// Resource content size.
927    pub fn content_size(&self) -> Option<f64> { self.content_size }
928    /// True if the resource failed to load.
929    pub fn failed(&self) -> Option<bool> { self.failed }
930    /// True if the resource was canceled during loading.
931    pub fn canceled(&self) -> Option<bool> { self.canceled }
932}
933
934
935pub struct FrameResourceBuilder<'a> {
936    url: Cow<'a, str>,
937    type_: crate::network::ResourceType,
938    mime_type: Cow<'a, str>,
939    last_modified: Option<crate::network::TimeSinceEpoch>,
940    content_size: Option<f64>,
941    failed: Option<bool>,
942    canceled: Option<bool>,
943}
944
945impl<'a> FrameResourceBuilder<'a> {
946    /// last-modified timestamp as reported by server.
947    pub fn last_modified(mut self, last_modified: crate::network::TimeSinceEpoch) -> Self { self.last_modified = Some(last_modified); self }
948    /// Resource content size.
949    pub fn content_size(mut self, content_size: f64) -> Self { self.content_size = Some(content_size); self }
950    /// True if the resource failed to load.
951    pub fn failed(mut self, failed: bool) -> Self { self.failed = Some(failed); self }
952    /// True if the resource was canceled during loading.
953    pub fn canceled(mut self, canceled: bool) -> Self { self.canceled = Some(canceled); self }
954    pub fn build(self) -> FrameResource<'a> {
955        FrameResource {
956            url: self.url,
957            type_: self.type_,
958            mime_type: self.mime_type,
959            last_modified: self.last_modified,
960            content_size: self.content_size,
961            failed: self.failed,
962            canceled: self.canceled,
963        }
964    }
965}
966
967/// Information about the Frame hierarchy along with their cached resources.
968
969#[derive(Debug, Clone, Serialize, Deserialize, Default)]
970#[serde(rename_all = "camelCase")]
971pub struct FrameResourceTree<'a> {
972    /// Frame information for this tree item.
973    frame: Frame<'a>,
974    /// Child frames.
975    #[serde(skip_serializing_if = "Option::is_none", rename = "childFrames")]
976    child_frames: Option<Vec<Box<FrameResourceTree<'a>>>>,
977    /// Information about frame resources.
978    resources: Vec<FrameResource<'a>>,
979}
980
981impl<'a> FrameResourceTree<'a> {
982    /// Creates a builder for this type with the required parameters:
983    /// * `frame`: Frame information for this tree item.
984    /// * `resources`: Information about frame resources.
985    pub fn builder(frame: Frame<'a>, resources: Vec<FrameResource<'a>>) -> FrameResourceTreeBuilder<'a> {
986        FrameResourceTreeBuilder {
987            frame: frame,
988            child_frames: None,
989            resources: resources,
990        }
991    }
992    /// Frame information for this tree item.
993    pub fn frame(&self) -> &Frame<'a> { &self.frame }
994    /// Child frames.
995    pub fn child_frames(&self) -> Option<&[Box<FrameResourceTree<'a>>]> { self.child_frames.as_deref() }
996    /// Information about frame resources.
997    pub fn resources(&self) -> &[FrameResource<'a>] { &self.resources }
998}
999
1000
1001pub struct FrameResourceTreeBuilder<'a> {
1002    frame: Frame<'a>,
1003    child_frames: Option<Vec<Box<FrameResourceTree<'a>>>>,
1004    resources: Vec<FrameResource<'a>>,
1005}
1006
1007impl<'a> FrameResourceTreeBuilder<'a> {
1008    /// Child frames.
1009    pub fn child_frames(mut self, child_frames: Vec<Box<FrameResourceTree<'a>>>) -> Self { self.child_frames = Some(child_frames); self }
1010    pub fn build(self) -> FrameResourceTree<'a> {
1011        FrameResourceTree {
1012            frame: self.frame,
1013            child_frames: self.child_frames,
1014            resources: self.resources,
1015        }
1016    }
1017}
1018
1019/// Information about the Frame hierarchy.
1020
1021#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1022#[serde(rename_all = "camelCase")]
1023pub struct FrameTree<'a> {
1024    /// Frame information for this tree item.
1025    frame: Frame<'a>,
1026    /// Child frames.
1027    #[serde(skip_serializing_if = "Option::is_none", rename = "childFrames")]
1028    child_frames: Option<Vec<Box<FrameTree<'a>>>>,
1029}
1030
1031impl<'a> FrameTree<'a> {
1032    /// Creates a builder for this type with the required parameters:
1033    /// * `frame`: Frame information for this tree item.
1034    pub fn builder(frame: Frame<'a>) -> FrameTreeBuilder<'a> {
1035        FrameTreeBuilder {
1036            frame: frame,
1037            child_frames: None,
1038        }
1039    }
1040    /// Frame information for this tree item.
1041    pub fn frame(&self) -> &Frame<'a> { &self.frame }
1042    /// Child frames.
1043    pub fn child_frames(&self) -> Option<&[Box<FrameTree<'a>>]> { self.child_frames.as_deref() }
1044}
1045
1046
1047pub struct FrameTreeBuilder<'a> {
1048    frame: Frame<'a>,
1049    child_frames: Option<Vec<Box<FrameTree<'a>>>>,
1050}
1051
1052impl<'a> FrameTreeBuilder<'a> {
1053    /// Child frames.
1054    pub fn child_frames(mut self, child_frames: Vec<Box<FrameTree<'a>>>) -> Self { self.child_frames = Some(child_frames); self }
1055    pub fn build(self) -> FrameTree<'a> {
1056        FrameTree {
1057            frame: self.frame,
1058            child_frames: self.child_frames,
1059        }
1060    }
1061}
1062
1063/// Unique script identifier.
1064
1065pub type ScriptIdentifier<'a> = Cow<'a, str>;
1066
1067/// Transition type.
1068
1069#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1070pub enum TransitionType {
1071    #[default]
1072    #[serde(rename = "link")]
1073    Link,
1074    #[serde(rename = "typed")]
1075    Typed,
1076    #[serde(rename = "address_bar")]
1077    AddressBar,
1078    #[serde(rename = "auto_bookmark")]
1079    AutoBookmark,
1080    #[serde(rename = "auto_subframe")]
1081    AutoSubframe,
1082    #[serde(rename = "manual_subframe")]
1083    ManualSubframe,
1084    #[serde(rename = "generated")]
1085    Generated,
1086    #[serde(rename = "auto_toplevel")]
1087    AutoToplevel,
1088    #[serde(rename = "form_submit")]
1089    FormSubmit,
1090    #[serde(rename = "reload")]
1091    Reload,
1092    #[serde(rename = "keyword")]
1093    Keyword,
1094    #[serde(rename = "keyword_generated")]
1095    KeywordGenerated,
1096    #[serde(rename = "other")]
1097    Other,
1098}
1099
1100/// Navigation history entry.
1101
1102#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1103#[serde(rename_all = "camelCase")]
1104pub struct NavigationEntry<'a> {
1105    /// Unique id of the navigation history entry.
1106    id: u64,
1107    /// URL of the navigation history entry.
1108    url: Cow<'a, str>,
1109    /// URL that the user typed in the url bar.
1110    #[serde(rename = "userTypedURL")]
1111    user_typed_url: Cow<'a, str>,
1112    /// Title of the navigation history entry.
1113    title: Cow<'a, str>,
1114    /// Transition type.
1115    #[serde(rename = "transitionType")]
1116    transition_type: TransitionType,
1117}
1118
1119impl<'a> NavigationEntry<'a> {
1120    /// Creates a builder for this type with the required parameters:
1121    /// * `id`: Unique id of the navigation history entry.
1122    /// * `url`: URL of the navigation history entry.
1123    /// * `user_typed_url`: URL that the user typed in the url bar.
1124    /// * `title`: Title of the navigation history entry.
1125    /// * `transition_type`: Transition type.
1126    pub fn builder(id: u64, url: impl Into<Cow<'a, str>>, user_typed_url: impl Into<Cow<'a, str>>, title: impl Into<Cow<'a, str>>, transition_type: impl Into<TransitionType>) -> NavigationEntryBuilder<'a> {
1127        NavigationEntryBuilder {
1128            id: id,
1129            url: url.into(),
1130            user_typed_url: user_typed_url.into(),
1131            title: title.into(),
1132            transition_type: transition_type.into(),
1133        }
1134    }
1135    /// Unique id of the navigation history entry.
1136    pub fn id(&self) -> u64 { self.id }
1137    /// URL of the navigation history entry.
1138    pub fn url(&self) -> &str { self.url.as_ref() }
1139    /// URL that the user typed in the url bar.
1140    pub fn user_typed_url(&self) -> &str { self.user_typed_url.as_ref() }
1141    /// Title of the navigation history entry.
1142    pub fn title(&self) -> &str { self.title.as_ref() }
1143    /// Transition type.
1144    pub fn transition_type(&self) -> &TransitionType { &self.transition_type }
1145}
1146
1147
1148pub struct NavigationEntryBuilder<'a> {
1149    id: u64,
1150    url: Cow<'a, str>,
1151    user_typed_url: Cow<'a, str>,
1152    title: Cow<'a, str>,
1153    transition_type: TransitionType,
1154}
1155
1156impl<'a> NavigationEntryBuilder<'a> {
1157    pub fn build(self) -> NavigationEntry<'a> {
1158        NavigationEntry {
1159            id: self.id,
1160            url: self.url,
1161            user_typed_url: self.user_typed_url,
1162            title: self.title,
1163            transition_type: self.transition_type,
1164        }
1165    }
1166}
1167
1168/// Screencast frame metadata.
1169
1170#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1171#[serde(rename_all = "camelCase")]
1172pub struct ScreencastFrameMetadata {
1173    /// Top offset in DIP.
1174    #[serde(rename = "offsetTop")]
1175    offset_top: f64,
1176    /// Page scale factor.
1177    #[serde(rename = "pageScaleFactor")]
1178    page_scale_factor: f64,
1179    /// Device screen width in DIP.
1180    #[serde(rename = "deviceWidth")]
1181    device_width: f64,
1182    /// Device screen height in DIP.
1183    #[serde(rename = "deviceHeight")]
1184    device_height: f64,
1185    /// Position of horizontal scroll in CSS pixels.
1186    #[serde(rename = "scrollOffsetX")]
1187    scroll_offset_x: f64,
1188    /// Position of vertical scroll in CSS pixels.
1189    #[serde(rename = "scrollOffsetY")]
1190    scroll_offset_y: f64,
1191    /// Frame swap timestamp.
1192    #[serde(skip_serializing_if = "Option::is_none")]
1193    timestamp: Option<crate::network::TimeSinceEpoch>,
1194}
1195
1196impl ScreencastFrameMetadata {
1197    /// Creates a builder for this type with the required parameters:
1198    /// * `offset_top`: Top offset in DIP.
1199    /// * `page_scale_factor`: Page scale factor.
1200    /// * `device_width`: Device screen width in DIP.
1201    /// * `device_height`: Device screen height in DIP.
1202    /// * `scroll_offset_x`: Position of horizontal scroll in CSS pixels.
1203    /// * `scroll_offset_y`: Position of vertical scroll in CSS pixels.
1204    pub fn builder(offset_top: f64, page_scale_factor: f64, device_width: f64, device_height: f64, scroll_offset_x: f64, scroll_offset_y: f64) -> ScreencastFrameMetadataBuilder {
1205        ScreencastFrameMetadataBuilder {
1206            offset_top: offset_top,
1207            page_scale_factor: page_scale_factor,
1208            device_width: device_width,
1209            device_height: device_height,
1210            scroll_offset_x: scroll_offset_x,
1211            scroll_offset_y: scroll_offset_y,
1212            timestamp: None,
1213        }
1214    }
1215    /// Top offset in DIP.
1216    pub fn offset_top(&self) -> f64 { self.offset_top }
1217    /// Page scale factor.
1218    pub fn page_scale_factor(&self) -> f64 { self.page_scale_factor }
1219    /// Device screen width in DIP.
1220    pub fn device_width(&self) -> f64 { self.device_width }
1221    /// Device screen height in DIP.
1222    pub fn device_height(&self) -> f64 { self.device_height }
1223    /// Position of horizontal scroll in CSS pixels.
1224    pub fn scroll_offset_x(&self) -> f64 { self.scroll_offset_x }
1225    /// Position of vertical scroll in CSS pixels.
1226    pub fn scroll_offset_y(&self) -> f64 { self.scroll_offset_y }
1227    /// Frame swap timestamp.
1228    pub fn timestamp(&self) -> Option<&crate::network::TimeSinceEpoch> { self.timestamp.as_ref() }
1229}
1230
1231
1232pub struct ScreencastFrameMetadataBuilder {
1233    offset_top: f64,
1234    page_scale_factor: f64,
1235    device_width: f64,
1236    device_height: f64,
1237    scroll_offset_x: f64,
1238    scroll_offset_y: f64,
1239    timestamp: Option<crate::network::TimeSinceEpoch>,
1240}
1241
1242impl ScreencastFrameMetadataBuilder {
1243    /// Frame swap timestamp.
1244    pub fn timestamp(mut self, timestamp: crate::network::TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
1245    pub fn build(self) -> ScreencastFrameMetadata {
1246        ScreencastFrameMetadata {
1247            offset_top: self.offset_top,
1248            page_scale_factor: self.page_scale_factor,
1249            device_width: self.device_width,
1250            device_height: self.device_height,
1251            scroll_offset_x: self.scroll_offset_x,
1252            scroll_offset_y: self.scroll_offset_y,
1253            timestamp: self.timestamp,
1254        }
1255    }
1256}
1257
1258/// Javascript dialog type.
1259
1260#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1261pub enum DialogType {
1262    #[default]
1263    #[serde(rename = "alert")]
1264    Alert,
1265    #[serde(rename = "confirm")]
1266    Confirm,
1267    #[serde(rename = "prompt")]
1268    Prompt,
1269    #[serde(rename = "beforeunload")]
1270    Beforeunload,
1271}
1272
1273/// Error while paring app manifest.
1274
1275#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1276#[serde(rename_all = "camelCase")]
1277pub struct AppManifestError<'a> {
1278    /// Error message.
1279    message: Cow<'a, str>,
1280    /// If critical, this is a non-recoverable parse error.
1281    critical: i64,
1282    /// Error line.
1283    line: i64,
1284    /// Error column.
1285    column: i64,
1286}
1287
1288impl<'a> AppManifestError<'a> {
1289    /// Creates a builder for this type with the required parameters:
1290    /// * `message`: Error message.
1291    /// * `critical`: If critical, this is a non-recoverable parse error.
1292    /// * `line`: Error line.
1293    /// * `column`: Error column.
1294    pub fn builder(message: impl Into<Cow<'a, str>>, critical: i64, line: i64, column: i64) -> AppManifestErrorBuilder<'a> {
1295        AppManifestErrorBuilder {
1296            message: message.into(),
1297            critical: critical,
1298            line: line,
1299            column: column,
1300        }
1301    }
1302    /// Error message.
1303    pub fn message(&self) -> &str { self.message.as_ref() }
1304    /// If critical, this is a non-recoverable parse error.
1305    pub fn critical(&self) -> i64 { self.critical }
1306    /// Error line.
1307    pub fn line(&self) -> i64 { self.line }
1308    /// Error column.
1309    pub fn column(&self) -> i64 { self.column }
1310}
1311
1312
1313pub struct AppManifestErrorBuilder<'a> {
1314    message: Cow<'a, str>,
1315    critical: i64,
1316    line: i64,
1317    column: i64,
1318}
1319
1320impl<'a> AppManifestErrorBuilder<'a> {
1321    pub fn build(self) -> AppManifestError<'a> {
1322        AppManifestError {
1323            message: self.message,
1324            critical: self.critical,
1325            line: self.line,
1326            column: self.column,
1327        }
1328    }
1329}
1330
1331/// Parsed app manifest properties.
1332
1333#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1334#[serde(rename_all = "camelCase")]
1335pub struct AppManifestParsedProperties<'a> {
1336    /// Computed scope value
1337    scope: Cow<'a, str>,
1338}
1339
1340impl<'a> AppManifestParsedProperties<'a> {
1341    /// Creates a builder for this type with the required parameters:
1342    /// * `scope`: Computed scope value
1343    pub fn builder(scope: impl Into<Cow<'a, str>>) -> AppManifestParsedPropertiesBuilder<'a> {
1344        AppManifestParsedPropertiesBuilder {
1345            scope: scope.into(),
1346        }
1347    }
1348    /// Computed scope value
1349    pub fn scope(&self) -> &str { self.scope.as_ref() }
1350}
1351
1352
1353pub struct AppManifestParsedPropertiesBuilder<'a> {
1354    scope: Cow<'a, str>,
1355}
1356
1357impl<'a> AppManifestParsedPropertiesBuilder<'a> {
1358    pub fn build(self) -> AppManifestParsedProperties<'a> {
1359        AppManifestParsedProperties {
1360            scope: self.scope,
1361        }
1362    }
1363}
1364
1365/// Layout viewport position and dimensions.
1366
1367#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1368#[serde(rename_all = "camelCase")]
1369pub struct LayoutViewport {
1370    /// Horizontal offset relative to the document (CSS pixels).
1371    #[serde(rename = "pageX")]
1372    page_x: i64,
1373    /// Vertical offset relative to the document (CSS pixels).
1374    #[serde(rename = "pageY")]
1375    page_y: i64,
1376    /// Width (CSS pixels), excludes scrollbar if present.
1377    #[serde(rename = "clientWidth")]
1378    client_width: u64,
1379    /// Height (CSS pixels), excludes scrollbar if present.
1380    #[serde(rename = "clientHeight")]
1381    client_height: i64,
1382}
1383
1384impl LayoutViewport {
1385    /// Creates a builder for this type with the required parameters:
1386    /// * `page_x`: Horizontal offset relative to the document (CSS pixels).
1387    /// * `page_y`: Vertical offset relative to the document (CSS pixels).
1388    /// * `client_width`: Width (CSS pixels), excludes scrollbar if present.
1389    /// * `client_height`: Height (CSS pixels), excludes scrollbar if present.
1390    pub fn builder(page_x: i64, page_y: i64, client_width: u64, client_height: i64) -> LayoutViewportBuilder {
1391        LayoutViewportBuilder {
1392            page_x: page_x,
1393            page_y: page_y,
1394            client_width: client_width,
1395            client_height: client_height,
1396        }
1397    }
1398    /// Horizontal offset relative to the document (CSS pixels).
1399    pub fn page_x(&self) -> i64 { self.page_x }
1400    /// Vertical offset relative to the document (CSS pixels).
1401    pub fn page_y(&self) -> i64 { self.page_y }
1402    /// Width (CSS pixels), excludes scrollbar if present.
1403    pub fn client_width(&self) -> u64 { self.client_width }
1404    /// Height (CSS pixels), excludes scrollbar if present.
1405    pub fn client_height(&self) -> i64 { self.client_height }
1406}
1407
1408
1409pub struct LayoutViewportBuilder {
1410    page_x: i64,
1411    page_y: i64,
1412    client_width: u64,
1413    client_height: i64,
1414}
1415
1416impl LayoutViewportBuilder {
1417    pub fn build(self) -> LayoutViewport {
1418        LayoutViewport {
1419            page_x: self.page_x,
1420            page_y: self.page_y,
1421            client_width: self.client_width,
1422            client_height: self.client_height,
1423        }
1424    }
1425}
1426
1427/// Visual viewport position, dimensions, and scale.
1428
1429#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1430#[serde(rename_all = "camelCase")]
1431pub struct VisualViewport {
1432    /// Horizontal offset relative to the layout viewport (CSS pixels).
1433    #[serde(rename = "offsetX")]
1434    offset_x: f64,
1435    /// Vertical offset relative to the layout viewport (CSS pixels).
1436    #[serde(rename = "offsetY")]
1437    offset_y: f64,
1438    /// Horizontal offset relative to the document (CSS pixels).
1439    #[serde(rename = "pageX")]
1440    page_x: f64,
1441    /// Vertical offset relative to the document (CSS pixels).
1442    #[serde(rename = "pageY")]
1443    page_y: f64,
1444    /// Width (CSS pixels), excludes scrollbar if present.
1445    #[serde(rename = "clientWidth")]
1446    client_width: f64,
1447    /// Height (CSS pixels), excludes scrollbar if present.
1448    #[serde(rename = "clientHeight")]
1449    client_height: f64,
1450    /// Scale relative to the ideal viewport (size at width=device-width).
1451    scale: f64,
1452    /// Page zoom factor (CSS to device independent pixels ratio).
1453    #[serde(skip_serializing_if = "Option::is_none")]
1454    zoom: Option<f64>,
1455}
1456
1457impl VisualViewport {
1458    /// Creates a builder for this type with the required parameters:
1459    /// * `offset_x`: Horizontal offset relative to the layout viewport (CSS pixels).
1460    /// * `offset_y`: Vertical offset relative to the layout viewport (CSS pixels).
1461    /// * `page_x`: Horizontal offset relative to the document (CSS pixels).
1462    /// * `page_y`: Vertical offset relative to the document (CSS pixels).
1463    /// * `client_width`: Width (CSS pixels), excludes scrollbar if present.
1464    /// * `client_height`: Height (CSS pixels), excludes scrollbar if present.
1465    /// * `scale`: Scale relative to the ideal viewport (size at width=device-width).
1466    pub fn builder(offset_x: f64, offset_y: f64, page_x: f64, page_y: f64, client_width: f64, client_height: f64, scale: f64) -> VisualViewportBuilder {
1467        VisualViewportBuilder {
1468            offset_x: offset_x,
1469            offset_y: offset_y,
1470            page_x: page_x,
1471            page_y: page_y,
1472            client_width: client_width,
1473            client_height: client_height,
1474            scale: scale,
1475            zoom: None,
1476        }
1477    }
1478    /// Horizontal offset relative to the layout viewport (CSS pixels).
1479    pub fn offset_x(&self) -> f64 { self.offset_x }
1480    /// Vertical offset relative to the layout viewport (CSS pixels).
1481    pub fn offset_y(&self) -> f64 { self.offset_y }
1482    /// Horizontal offset relative to the document (CSS pixels).
1483    pub fn page_x(&self) -> f64 { self.page_x }
1484    /// Vertical offset relative to the document (CSS pixels).
1485    pub fn page_y(&self) -> f64 { self.page_y }
1486    /// Width (CSS pixels), excludes scrollbar if present.
1487    pub fn client_width(&self) -> f64 { self.client_width }
1488    /// Height (CSS pixels), excludes scrollbar if present.
1489    pub fn client_height(&self) -> f64 { self.client_height }
1490    /// Scale relative to the ideal viewport (size at width=device-width).
1491    pub fn scale(&self) -> f64 { self.scale }
1492    /// Page zoom factor (CSS to device independent pixels ratio).
1493    pub fn zoom(&self) -> Option<f64> { self.zoom }
1494}
1495
1496
1497pub struct VisualViewportBuilder {
1498    offset_x: f64,
1499    offset_y: f64,
1500    page_x: f64,
1501    page_y: f64,
1502    client_width: f64,
1503    client_height: f64,
1504    scale: f64,
1505    zoom: Option<f64>,
1506}
1507
1508impl VisualViewportBuilder {
1509    /// Page zoom factor (CSS to device independent pixels ratio).
1510    pub fn zoom(mut self, zoom: f64) -> Self { self.zoom = Some(zoom); self }
1511    pub fn build(self) -> VisualViewport {
1512        VisualViewport {
1513            offset_x: self.offset_x,
1514            offset_y: self.offset_y,
1515            page_x: self.page_x,
1516            page_y: self.page_y,
1517            client_width: self.client_width,
1518            client_height: self.client_height,
1519            scale: self.scale,
1520            zoom: self.zoom,
1521        }
1522    }
1523}
1524
1525/// Viewport for capturing screenshot.
1526
1527#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1528#[serde(rename_all = "camelCase")]
1529pub struct Viewport {
1530    /// X offset in device independent pixels (dip).
1531    x: f64,
1532    /// Y offset in device independent pixels (dip).
1533    y: f64,
1534    /// Rectangle width in device independent pixels (dip).
1535    width: f64,
1536    /// Rectangle height in device independent pixels (dip).
1537    height: f64,
1538    /// Page scale factor.
1539    scale: f64,
1540}
1541
1542impl Viewport {
1543    /// Creates a builder for this type with the required parameters:
1544    /// * `x`: X offset in device independent pixels (dip).
1545    /// * `y`: Y offset in device independent pixels (dip).
1546    /// * `width`: Rectangle width in device independent pixels (dip).
1547    /// * `height`: Rectangle height in device independent pixels (dip).
1548    /// * `scale`: Page scale factor.
1549    pub fn builder(x: f64, y: f64, width: f64, height: f64, scale: f64) -> ViewportBuilder {
1550        ViewportBuilder {
1551            x: x,
1552            y: y,
1553            width: width,
1554            height: height,
1555            scale: scale,
1556        }
1557    }
1558    /// X offset in device independent pixels (dip).
1559    pub fn x(&self) -> f64 { self.x }
1560    /// Y offset in device independent pixels (dip).
1561    pub fn y(&self) -> f64 { self.y }
1562    /// Rectangle width in device independent pixels (dip).
1563    pub fn width(&self) -> f64 { self.width }
1564    /// Rectangle height in device independent pixels (dip).
1565    pub fn height(&self) -> f64 { self.height }
1566    /// Page scale factor.
1567    pub fn scale(&self) -> f64 { self.scale }
1568}
1569
1570
1571pub struct ViewportBuilder {
1572    x: f64,
1573    y: f64,
1574    width: f64,
1575    height: f64,
1576    scale: f64,
1577}
1578
1579impl ViewportBuilder {
1580    pub fn build(self) -> Viewport {
1581        Viewport {
1582            x: self.x,
1583            y: self.y,
1584            width: self.width,
1585            height: self.height,
1586            scale: self.scale,
1587        }
1588    }
1589}
1590
1591/// Generic font families collection.
1592
1593#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1594#[serde(rename_all = "camelCase")]
1595pub struct FontFamilies<'a> {
1596    /// The standard font-family.
1597    #[serde(skip_serializing_if = "Option::is_none")]
1598    standard: Option<Cow<'a, str>>,
1599    /// The fixed font-family.
1600    #[serde(skip_serializing_if = "Option::is_none")]
1601    fixed: Option<Cow<'a, str>>,
1602    /// The serif font-family.
1603    #[serde(skip_serializing_if = "Option::is_none")]
1604    serif: Option<Cow<'a, str>>,
1605    /// The sansSerif font-family.
1606    #[serde(skip_serializing_if = "Option::is_none", rename = "sansSerif")]
1607    sans_serif: Option<Cow<'a, str>>,
1608    /// The cursive font-family.
1609    #[serde(skip_serializing_if = "Option::is_none")]
1610    cursive: Option<Cow<'a, str>>,
1611    /// The fantasy font-family.
1612    #[serde(skip_serializing_if = "Option::is_none")]
1613    fantasy: Option<Cow<'a, str>>,
1614    /// The math font-family.
1615    #[serde(skip_serializing_if = "Option::is_none")]
1616    math: Option<Cow<'a, str>>,
1617}
1618
1619impl<'a> FontFamilies<'a> {
1620    /// Creates a builder for this type.
1621    pub fn builder() -> FontFamiliesBuilder<'a> {
1622        FontFamiliesBuilder {
1623            standard: None,
1624            fixed: None,
1625            serif: None,
1626            sans_serif: None,
1627            cursive: None,
1628            fantasy: None,
1629            math: None,
1630        }
1631    }
1632    /// The standard font-family.
1633    pub fn standard(&self) -> Option<&str> { self.standard.as_deref() }
1634    /// The fixed font-family.
1635    pub fn fixed(&self) -> Option<&str> { self.fixed.as_deref() }
1636    /// The serif font-family.
1637    pub fn serif(&self) -> Option<&str> { self.serif.as_deref() }
1638    /// The sansSerif font-family.
1639    pub fn sans_serif(&self) -> Option<&str> { self.sans_serif.as_deref() }
1640    /// The cursive font-family.
1641    pub fn cursive(&self) -> Option<&str> { self.cursive.as_deref() }
1642    /// The fantasy font-family.
1643    pub fn fantasy(&self) -> Option<&str> { self.fantasy.as_deref() }
1644    /// The math font-family.
1645    pub fn math(&self) -> Option<&str> { self.math.as_deref() }
1646}
1647
1648#[derive(Default)]
1649pub struct FontFamiliesBuilder<'a> {
1650    standard: Option<Cow<'a, str>>,
1651    fixed: Option<Cow<'a, str>>,
1652    serif: Option<Cow<'a, str>>,
1653    sans_serif: Option<Cow<'a, str>>,
1654    cursive: Option<Cow<'a, str>>,
1655    fantasy: Option<Cow<'a, str>>,
1656    math: Option<Cow<'a, str>>,
1657}
1658
1659impl<'a> FontFamiliesBuilder<'a> {
1660    /// The standard font-family.
1661    pub fn standard(mut self, standard: impl Into<Cow<'a, str>>) -> Self { self.standard = Some(standard.into()); self }
1662    /// The fixed font-family.
1663    pub fn fixed(mut self, fixed: impl Into<Cow<'a, str>>) -> Self { self.fixed = Some(fixed.into()); self }
1664    /// The serif font-family.
1665    pub fn serif(mut self, serif: impl Into<Cow<'a, str>>) -> Self { self.serif = Some(serif.into()); self }
1666    /// The sansSerif font-family.
1667    pub fn sans_serif(mut self, sans_serif: impl Into<Cow<'a, str>>) -> Self { self.sans_serif = Some(sans_serif.into()); self }
1668    /// The cursive font-family.
1669    pub fn cursive(mut self, cursive: impl Into<Cow<'a, str>>) -> Self { self.cursive = Some(cursive.into()); self }
1670    /// The fantasy font-family.
1671    pub fn fantasy(mut self, fantasy: impl Into<Cow<'a, str>>) -> Self { self.fantasy = Some(fantasy.into()); self }
1672    /// The math font-family.
1673    pub fn math(mut self, math: impl Into<Cow<'a, str>>) -> Self { self.math = Some(math.into()); self }
1674    pub fn build(self) -> FontFamilies<'a> {
1675        FontFamilies {
1676            standard: self.standard,
1677            fixed: self.fixed,
1678            serif: self.serif,
1679            sans_serif: self.sans_serif,
1680            cursive: self.cursive,
1681            fantasy: self.fantasy,
1682            math: self.math,
1683        }
1684    }
1685}
1686
1687/// Font families collection for a script.
1688
1689#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1690#[serde(rename_all = "camelCase")]
1691pub struct ScriptFontFamilies<'a> {
1692    /// Name of the script which these font families are defined for.
1693    script: Cow<'a, str>,
1694    /// Generic font families collection for the script.
1695    #[serde(rename = "fontFamilies")]
1696    font_families: FontFamilies<'a>,
1697}
1698
1699impl<'a> ScriptFontFamilies<'a> {
1700    /// Creates a builder for this type with the required parameters:
1701    /// * `script`: Name of the script which these font families are defined for.
1702    /// * `font_families`: Generic font families collection for the script.
1703    pub fn builder(script: impl Into<Cow<'a, str>>, font_families: FontFamilies<'a>) -> ScriptFontFamiliesBuilder<'a> {
1704        ScriptFontFamiliesBuilder {
1705            script: script.into(),
1706            font_families: font_families,
1707        }
1708    }
1709    /// Name of the script which these font families are defined for.
1710    pub fn script(&self) -> &str { self.script.as_ref() }
1711    /// Generic font families collection for the script.
1712    pub fn font_families(&self) -> &FontFamilies<'a> { &self.font_families }
1713}
1714
1715
1716pub struct ScriptFontFamiliesBuilder<'a> {
1717    script: Cow<'a, str>,
1718    font_families: FontFamilies<'a>,
1719}
1720
1721impl<'a> ScriptFontFamiliesBuilder<'a> {
1722    pub fn build(self) -> ScriptFontFamilies<'a> {
1723        ScriptFontFamilies {
1724            script: self.script,
1725            font_families: self.font_families,
1726        }
1727    }
1728}
1729
1730/// Default font sizes.
1731
1732#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1733#[serde(rename_all = "camelCase")]
1734pub struct FontSizes {
1735    /// Default standard font size.
1736    #[serde(skip_serializing_if = "Option::is_none")]
1737    standard: Option<i64>,
1738    /// Default fixed font size.
1739    #[serde(skip_serializing_if = "Option::is_none")]
1740    fixed: Option<i64>,
1741}
1742
1743impl FontSizes {
1744    /// Creates a builder for this type.
1745    pub fn builder() -> FontSizesBuilder {
1746        FontSizesBuilder {
1747            standard: None,
1748            fixed: None,
1749        }
1750    }
1751    /// Default standard font size.
1752    pub fn standard(&self) -> Option<i64> { self.standard }
1753    /// Default fixed font size.
1754    pub fn fixed(&self) -> Option<i64> { self.fixed }
1755}
1756
1757#[derive(Default)]
1758pub struct FontSizesBuilder {
1759    standard: Option<i64>,
1760    fixed: Option<i64>,
1761}
1762
1763impl FontSizesBuilder {
1764    /// Default standard font size.
1765    pub fn standard(mut self, standard: i64) -> Self { self.standard = Some(standard); self }
1766    /// Default fixed font size.
1767    pub fn fixed(mut self, fixed: i64) -> Self { self.fixed = Some(fixed); self }
1768    pub fn build(self) -> FontSizes {
1769        FontSizes {
1770            standard: self.standard,
1771            fixed: self.fixed,
1772        }
1773    }
1774}
1775
1776
1777#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1778pub enum ClientNavigationReason {
1779    #[default]
1780    #[serde(rename = "anchorClick")]
1781    AnchorClick,
1782    #[serde(rename = "formSubmissionGet")]
1783    FormSubmissionGet,
1784    #[serde(rename = "formSubmissionPost")]
1785    FormSubmissionPost,
1786    #[serde(rename = "httpHeaderRefresh")]
1787    HttpHeaderRefresh,
1788    #[serde(rename = "initialFrameNavigation")]
1789    InitialFrameNavigation,
1790    #[serde(rename = "metaTagRefresh")]
1791    MetaTagRefresh,
1792    #[serde(rename = "other")]
1793    Other,
1794    #[serde(rename = "pageBlockInterstitial")]
1795    PageBlockInterstitial,
1796    #[serde(rename = "reload")]
1797    Reload,
1798    #[serde(rename = "scriptInitiated")]
1799    ScriptInitiated,
1800}
1801
1802
1803#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1804pub enum ClientNavigationDisposition {
1805    #[default]
1806    #[serde(rename = "currentTab")]
1807    CurrentTab,
1808    #[serde(rename = "newTab")]
1809    NewTab,
1810    #[serde(rename = "newWindow")]
1811    NewWindow,
1812    #[serde(rename = "download")]
1813    Download,
1814}
1815
1816
1817#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1818#[serde(rename_all = "camelCase")]
1819pub struct InstallabilityErrorArgument<'a> {
1820    /// Argument name (e.g. name:'minimum-icon-size-in-pixels').
1821    name: Cow<'a, str>,
1822    /// Argument value (e.g. value:'64').
1823    value: Cow<'a, str>,
1824}
1825
1826impl<'a> InstallabilityErrorArgument<'a> {
1827    /// Creates a builder for this type with the required parameters:
1828    /// * `name`: Argument name (e.g. name:'minimum-icon-size-in-pixels').
1829    /// * `value`: Argument value (e.g. value:'64').
1830    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> InstallabilityErrorArgumentBuilder<'a> {
1831        InstallabilityErrorArgumentBuilder {
1832            name: name.into(),
1833            value: value.into(),
1834        }
1835    }
1836    /// Argument name (e.g. name:'minimum-icon-size-in-pixels').
1837    pub fn name(&self) -> &str { self.name.as_ref() }
1838    /// Argument value (e.g. value:'64').
1839    pub fn value(&self) -> &str { self.value.as_ref() }
1840}
1841
1842
1843pub struct InstallabilityErrorArgumentBuilder<'a> {
1844    name: Cow<'a, str>,
1845    value: Cow<'a, str>,
1846}
1847
1848impl<'a> InstallabilityErrorArgumentBuilder<'a> {
1849    pub fn build(self) -> InstallabilityErrorArgument<'a> {
1850        InstallabilityErrorArgument {
1851            name: self.name,
1852            value: self.value,
1853        }
1854    }
1855}
1856
1857/// The installability error
1858
1859#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1860#[serde(rename_all = "camelCase")]
1861pub struct InstallabilityError<'a> {
1862    /// The error id (e.g. 'manifest-missing-suitable-icon').
1863    #[serde(rename = "errorId")]
1864    error_id: Cow<'a, str>,
1865    /// The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}).
1866    #[serde(rename = "errorArguments")]
1867    error_arguments: Vec<InstallabilityErrorArgument<'a>>,
1868}
1869
1870impl<'a> InstallabilityError<'a> {
1871    /// Creates a builder for this type with the required parameters:
1872    /// * `error_id`: The error id (e.g. 'manifest-missing-suitable-icon').
1873    /// * `error_arguments`: The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}).
1874    pub fn builder(error_id: impl Into<Cow<'a, str>>, error_arguments: Vec<InstallabilityErrorArgument<'a>>) -> InstallabilityErrorBuilder<'a> {
1875        InstallabilityErrorBuilder {
1876            error_id: error_id.into(),
1877            error_arguments: error_arguments,
1878        }
1879    }
1880    /// The error id (e.g. 'manifest-missing-suitable-icon').
1881    pub fn error_id(&self) -> &str { self.error_id.as_ref() }
1882    /// The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}).
1883    pub fn error_arguments(&self) -> &[InstallabilityErrorArgument<'a>] { &self.error_arguments }
1884}
1885
1886
1887pub struct InstallabilityErrorBuilder<'a> {
1888    error_id: Cow<'a, str>,
1889    error_arguments: Vec<InstallabilityErrorArgument<'a>>,
1890}
1891
1892impl<'a> InstallabilityErrorBuilder<'a> {
1893    pub fn build(self) -> InstallabilityError<'a> {
1894        InstallabilityError {
1895            error_id: self.error_id,
1896            error_arguments: self.error_arguments,
1897        }
1898    }
1899}
1900
1901/// The referring-policy used for the navigation.
1902
1903#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1904pub enum ReferrerPolicy {
1905    #[default]
1906    #[serde(rename = "noReferrer")]
1907    NoReferrer,
1908    #[serde(rename = "noReferrerWhenDowngrade")]
1909    NoReferrerWhenDowngrade,
1910    #[serde(rename = "origin")]
1911    Origin,
1912    #[serde(rename = "originWhenCrossOrigin")]
1913    OriginWhenCrossOrigin,
1914    #[serde(rename = "sameOrigin")]
1915    SameOrigin,
1916    #[serde(rename = "strictOrigin")]
1917    StrictOrigin,
1918    #[serde(rename = "strictOriginWhenCrossOrigin")]
1919    StrictOriginWhenCrossOrigin,
1920    #[serde(rename = "unsafeUrl")]
1921    UnsafeUrl,
1922}
1923
1924/// Per-script compilation cache parameters for 'Page.produceCompilationCache'
1925
1926#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1927#[serde(rename_all = "camelCase")]
1928pub struct CompilationCacheParams<'a> {
1929    /// The URL of the script to produce a compilation cache entry for.
1930    url: Cow<'a, str>,
1931    /// A hint to the backend whether eager compilation is recommended.
1932    /// (the actual compilation mode used is upon backend discretion).
1933    #[serde(skip_serializing_if = "Option::is_none")]
1934    eager: Option<bool>,
1935}
1936
1937impl<'a> CompilationCacheParams<'a> {
1938    /// Creates a builder for this type with the required parameters:
1939    /// * `url`: The URL of the script to produce a compilation cache entry for.
1940    pub fn builder(url: impl Into<Cow<'a, str>>) -> CompilationCacheParamsBuilder<'a> {
1941        CompilationCacheParamsBuilder {
1942            url: url.into(),
1943            eager: None,
1944        }
1945    }
1946    /// The URL of the script to produce a compilation cache entry for.
1947    pub fn url(&self) -> &str { self.url.as_ref() }
1948    /// A hint to the backend whether eager compilation is recommended.
1949    /// (the actual compilation mode used is upon backend discretion).
1950    pub fn eager(&self) -> Option<bool> { self.eager }
1951}
1952
1953
1954pub struct CompilationCacheParamsBuilder<'a> {
1955    url: Cow<'a, str>,
1956    eager: Option<bool>,
1957}
1958
1959impl<'a> CompilationCacheParamsBuilder<'a> {
1960    /// A hint to the backend whether eager compilation is recommended.
1961    /// (the actual compilation mode used is upon backend discretion).
1962    pub fn eager(mut self, eager: bool) -> Self { self.eager = Some(eager); self }
1963    pub fn build(self) -> CompilationCacheParams<'a> {
1964        CompilationCacheParams {
1965            url: self.url,
1966            eager: self.eager,
1967        }
1968    }
1969}
1970
1971
1972#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1973#[serde(rename_all = "camelCase")]
1974pub struct FileFilter<'a> {
1975    #[serde(skip_serializing_if = "Option::is_none")]
1976    name: Option<Cow<'a, str>>,
1977    #[serde(skip_serializing_if = "Option::is_none")]
1978    accepts: Option<Vec<Cow<'a, str>>>,
1979}
1980
1981impl<'a> FileFilter<'a> {
1982    /// Creates a builder for this type.
1983    pub fn builder() -> FileFilterBuilder<'a> {
1984        FileFilterBuilder {
1985            name: None,
1986            accepts: None,
1987        }
1988    }
1989    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
1990    pub fn accepts(&self) -> Option<&[Cow<'a, str>]> { self.accepts.as_deref() }
1991}
1992
1993#[derive(Default)]
1994pub struct FileFilterBuilder<'a> {
1995    name: Option<Cow<'a, str>>,
1996    accepts: Option<Vec<Cow<'a, str>>>,
1997}
1998
1999impl<'a> FileFilterBuilder<'a> {
2000    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
2001    pub fn accepts(mut self, accepts: Vec<Cow<'a, str>>) -> Self { self.accepts = Some(accepts); self }
2002    pub fn build(self) -> FileFilter<'a> {
2003        FileFilter {
2004            name: self.name,
2005            accepts: self.accepts,
2006        }
2007    }
2008}
2009
2010
2011#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2012#[serde(rename_all = "camelCase")]
2013pub struct FileHandler<'a> {
2014    action: Cow<'a, str>,
2015    name: Cow<'a, str>,
2016    #[serde(skip_serializing_if = "Option::is_none")]
2017    icons: Option<Vec<ImageResource<'a>>>,
2018    /// Mimic a map, name is the key, accepts is the value.
2019    #[serde(skip_serializing_if = "Option::is_none")]
2020    accepts: Option<Vec<FileFilter<'a>>>,
2021    /// Won't repeat the enums, using string for easy comparison. Same as the
2022    /// other enums below.
2023    #[serde(rename = "launchType")]
2024    launch_type: Cow<'a, str>,
2025}
2026
2027impl<'a> FileHandler<'a> {
2028    /// Creates a builder for this type with the required parameters:
2029    /// * `action`: 
2030    /// * `name`: 
2031    /// * `launch_type`: Won't repeat the enums, using string for easy comparison. Same as the other enums below.
2032    pub fn builder(action: impl Into<Cow<'a, str>>, name: impl Into<Cow<'a, str>>, launch_type: impl Into<Cow<'a, str>>) -> FileHandlerBuilder<'a> {
2033        FileHandlerBuilder {
2034            action: action.into(),
2035            name: name.into(),
2036            icons: None,
2037            accepts: None,
2038            launch_type: launch_type.into(),
2039        }
2040    }
2041    pub fn action(&self) -> &str { self.action.as_ref() }
2042    pub fn name(&self) -> &str { self.name.as_ref() }
2043    pub fn icons(&self) -> Option<&[ImageResource<'a>]> { self.icons.as_deref() }
2044    /// Mimic a map, name is the key, accepts is the value.
2045    pub fn accepts(&self) -> Option<&[FileFilter<'a>]> { self.accepts.as_deref() }
2046    /// Won't repeat the enums, using string for easy comparison. Same as the
2047    /// other enums below.
2048    pub fn launch_type(&self) -> &str { self.launch_type.as_ref() }
2049}
2050
2051
2052pub struct FileHandlerBuilder<'a> {
2053    action: Cow<'a, str>,
2054    name: Cow<'a, str>,
2055    icons: Option<Vec<ImageResource<'a>>>,
2056    accepts: Option<Vec<FileFilter<'a>>>,
2057    launch_type: Cow<'a, str>,
2058}
2059
2060impl<'a> FileHandlerBuilder<'a> {
2061    pub fn icons(mut self, icons: Vec<ImageResource<'a>>) -> Self { self.icons = Some(icons); self }
2062    /// Mimic a map, name is the key, accepts is the value.
2063    pub fn accepts(mut self, accepts: Vec<FileFilter<'a>>) -> Self { self.accepts = Some(accepts); self }
2064    pub fn build(self) -> FileHandler<'a> {
2065        FileHandler {
2066            action: self.action,
2067            name: self.name,
2068            icons: self.icons,
2069            accepts: self.accepts,
2070            launch_type: self.launch_type,
2071        }
2072    }
2073}
2074
2075/// The image definition used in both icon and screenshot.
2076
2077#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2078#[serde(rename_all = "camelCase")]
2079pub struct ImageResource<'a> {
2080    /// The src field in the definition, but changing to url in favor of
2081    /// consistency.
2082    url: Cow<'a, str>,
2083    #[serde(skip_serializing_if = "Option::is_none")]
2084    sizes: Option<Cow<'a, str>>,
2085    #[serde(skip_serializing_if = "Option::is_none", rename = "type")]
2086    type_: Option<Cow<'a, str>>,
2087}
2088
2089impl<'a> ImageResource<'a> {
2090    /// Creates a builder for this type with the required parameters:
2091    /// * `url`: The src field in the definition, but changing to url in favor of consistency.
2092    pub fn builder(url: impl Into<Cow<'a, str>>) -> ImageResourceBuilder<'a> {
2093        ImageResourceBuilder {
2094            url: url.into(),
2095            sizes: None,
2096            type_: None,
2097        }
2098    }
2099    /// The src field in the definition, but changing to url in favor of
2100    /// consistency.
2101    pub fn url(&self) -> &str { self.url.as_ref() }
2102    pub fn sizes(&self) -> Option<&str> { self.sizes.as_deref() }
2103    pub fn type_(&self) -> Option<&str> { self.type_.as_deref() }
2104}
2105
2106
2107pub struct ImageResourceBuilder<'a> {
2108    url: Cow<'a, str>,
2109    sizes: Option<Cow<'a, str>>,
2110    type_: Option<Cow<'a, str>>,
2111}
2112
2113impl<'a> ImageResourceBuilder<'a> {
2114    pub fn sizes(mut self, sizes: impl Into<Cow<'a, str>>) -> Self { self.sizes = Some(sizes.into()); self }
2115    pub fn type_(mut self, type_: impl Into<Cow<'a, str>>) -> Self { self.type_ = Some(type_.into()); self }
2116    pub fn build(self) -> ImageResource<'a> {
2117        ImageResource {
2118            url: self.url,
2119            sizes: self.sizes,
2120            type_: self.type_,
2121        }
2122    }
2123}
2124
2125
2126#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2127#[serde(rename_all = "camelCase")]
2128pub struct LaunchHandler<'a> {
2129    #[serde(rename = "clientMode")]
2130    client_mode: Cow<'a, str>,
2131}
2132
2133impl<'a> LaunchHandler<'a> {
2134    /// Creates a builder for this type with the required parameters:
2135    /// * `client_mode`: 
2136    pub fn builder(client_mode: impl Into<Cow<'a, str>>) -> LaunchHandlerBuilder<'a> {
2137        LaunchHandlerBuilder {
2138            client_mode: client_mode.into(),
2139        }
2140    }
2141    pub fn client_mode(&self) -> &str { self.client_mode.as_ref() }
2142}
2143
2144
2145pub struct LaunchHandlerBuilder<'a> {
2146    client_mode: Cow<'a, str>,
2147}
2148
2149impl<'a> LaunchHandlerBuilder<'a> {
2150    pub fn build(self) -> LaunchHandler<'a> {
2151        LaunchHandler {
2152            client_mode: self.client_mode,
2153        }
2154    }
2155}
2156
2157
2158#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2159#[serde(rename_all = "camelCase")]
2160pub struct ProtocolHandler<'a> {
2161    protocol: Cow<'a, str>,
2162    url: Cow<'a, str>,
2163}
2164
2165impl<'a> ProtocolHandler<'a> {
2166    /// Creates a builder for this type with the required parameters:
2167    /// * `protocol`: 
2168    /// * `url`: 
2169    pub fn builder(protocol: impl Into<Cow<'a, str>>, url: impl Into<Cow<'a, str>>) -> ProtocolHandlerBuilder<'a> {
2170        ProtocolHandlerBuilder {
2171            protocol: protocol.into(),
2172            url: url.into(),
2173        }
2174    }
2175    pub fn protocol(&self) -> &str { self.protocol.as_ref() }
2176    pub fn url(&self) -> &str { self.url.as_ref() }
2177}
2178
2179
2180pub struct ProtocolHandlerBuilder<'a> {
2181    protocol: Cow<'a, str>,
2182    url: Cow<'a, str>,
2183}
2184
2185impl<'a> ProtocolHandlerBuilder<'a> {
2186    pub fn build(self) -> ProtocolHandler<'a> {
2187        ProtocolHandler {
2188            protocol: self.protocol,
2189            url: self.url,
2190        }
2191    }
2192}
2193
2194
2195#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2196#[serde(rename_all = "camelCase")]
2197pub struct RelatedApplication<'a> {
2198    #[serde(skip_serializing_if = "Option::is_none")]
2199    id: Option<Cow<'a, str>>,
2200    url: Cow<'a, str>,
2201}
2202
2203impl<'a> RelatedApplication<'a> {
2204    /// Creates a builder for this type with the required parameters:
2205    /// * `url`: 
2206    pub fn builder(url: impl Into<Cow<'a, str>>) -> RelatedApplicationBuilder<'a> {
2207        RelatedApplicationBuilder {
2208            id: None,
2209            url: url.into(),
2210        }
2211    }
2212    pub fn id(&self) -> Option<&str> { self.id.as_deref() }
2213    pub fn url(&self) -> &str { self.url.as_ref() }
2214}
2215
2216
2217pub struct RelatedApplicationBuilder<'a> {
2218    id: Option<Cow<'a, str>>,
2219    url: Cow<'a, str>,
2220}
2221
2222impl<'a> RelatedApplicationBuilder<'a> {
2223    pub fn id(mut self, id: impl Into<Cow<'a, str>>) -> Self { self.id = Some(id.into()); self }
2224    pub fn build(self) -> RelatedApplication<'a> {
2225        RelatedApplication {
2226            id: self.id,
2227            url: self.url,
2228        }
2229    }
2230}
2231
2232
2233#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2234#[serde(rename_all = "camelCase")]
2235pub struct ScopeExtension<'a> {
2236    /// Instead of using tuple, this field always returns the serialized string
2237    /// for easy understanding and comparison.
2238    origin: Cow<'a, str>,
2239    #[serde(rename = "hasOriginWildcard")]
2240    has_origin_wildcard: bool,
2241}
2242
2243impl<'a> ScopeExtension<'a> {
2244    /// Creates a builder for this type with the required parameters:
2245    /// * `origin`: Instead of using tuple, this field always returns the serialized string for easy understanding and comparison.
2246    /// * `has_origin_wildcard`: 
2247    pub fn builder(origin: impl Into<Cow<'a, str>>, has_origin_wildcard: bool) -> ScopeExtensionBuilder<'a> {
2248        ScopeExtensionBuilder {
2249            origin: origin.into(),
2250            has_origin_wildcard: has_origin_wildcard,
2251        }
2252    }
2253    /// Instead of using tuple, this field always returns the serialized string
2254    /// for easy understanding and comparison.
2255    pub fn origin(&self) -> &str { self.origin.as_ref() }
2256    pub fn has_origin_wildcard(&self) -> bool { self.has_origin_wildcard }
2257}
2258
2259
2260pub struct ScopeExtensionBuilder<'a> {
2261    origin: Cow<'a, str>,
2262    has_origin_wildcard: bool,
2263}
2264
2265impl<'a> ScopeExtensionBuilder<'a> {
2266    pub fn build(self) -> ScopeExtension<'a> {
2267        ScopeExtension {
2268            origin: self.origin,
2269            has_origin_wildcard: self.has_origin_wildcard,
2270        }
2271    }
2272}
2273
2274
2275#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2276#[serde(rename_all = "camelCase")]
2277pub struct Screenshot<'a> {
2278    image: ImageResource<'a>,
2279    #[serde(rename = "formFactor")]
2280    form_factor: Cow<'a, str>,
2281    #[serde(skip_serializing_if = "Option::is_none")]
2282    label: Option<Cow<'a, str>>,
2283}
2284
2285impl<'a> Screenshot<'a> {
2286    /// Creates a builder for this type with the required parameters:
2287    /// * `image`: 
2288    /// * `form_factor`: 
2289    pub fn builder(image: ImageResource<'a>, form_factor: impl Into<Cow<'a, str>>) -> ScreenshotBuilder<'a> {
2290        ScreenshotBuilder {
2291            image: image,
2292            form_factor: form_factor.into(),
2293            label: None,
2294        }
2295    }
2296    pub fn image(&self) -> &ImageResource<'a> { &self.image }
2297    pub fn form_factor(&self) -> &str { self.form_factor.as_ref() }
2298    pub fn label(&self) -> Option<&str> { self.label.as_deref() }
2299}
2300
2301
2302pub struct ScreenshotBuilder<'a> {
2303    image: ImageResource<'a>,
2304    form_factor: Cow<'a, str>,
2305    label: Option<Cow<'a, str>>,
2306}
2307
2308impl<'a> ScreenshotBuilder<'a> {
2309    pub fn label(mut self, label: impl Into<Cow<'a, str>>) -> Self { self.label = Some(label.into()); self }
2310    pub fn build(self) -> Screenshot<'a> {
2311        Screenshot {
2312            image: self.image,
2313            form_factor: self.form_factor,
2314            label: self.label,
2315        }
2316    }
2317}
2318
2319
2320#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2321#[serde(rename_all = "camelCase")]
2322pub struct ShareTarget<'a> {
2323    action: Cow<'a, str>,
2324    method: Cow<'a, str>,
2325    enctype: Cow<'a, str>,
2326    /// Embed the ShareTargetParams
2327    #[serde(skip_serializing_if = "Option::is_none")]
2328    title: Option<Cow<'a, str>>,
2329    #[serde(skip_serializing_if = "Option::is_none")]
2330    text: Option<Cow<'a, str>>,
2331    #[serde(skip_serializing_if = "Option::is_none")]
2332    url: Option<Cow<'a, str>>,
2333    #[serde(skip_serializing_if = "Option::is_none")]
2334    files: Option<Vec<FileFilter<'a>>>,
2335}
2336
2337impl<'a> ShareTarget<'a> {
2338    /// Creates a builder for this type with the required parameters:
2339    /// * `action`: 
2340    /// * `method`: 
2341    /// * `enctype`: 
2342    pub fn builder(action: impl Into<Cow<'a, str>>, method: impl Into<Cow<'a, str>>, enctype: impl Into<Cow<'a, str>>) -> ShareTargetBuilder<'a> {
2343        ShareTargetBuilder {
2344            action: action.into(),
2345            method: method.into(),
2346            enctype: enctype.into(),
2347            title: None,
2348            text: None,
2349            url: None,
2350            files: None,
2351        }
2352    }
2353    pub fn action(&self) -> &str { self.action.as_ref() }
2354    pub fn method(&self) -> &str { self.method.as_ref() }
2355    pub fn enctype(&self) -> &str { self.enctype.as_ref() }
2356    /// Embed the ShareTargetParams
2357    pub fn title(&self) -> Option<&str> { self.title.as_deref() }
2358    pub fn text(&self) -> Option<&str> { self.text.as_deref() }
2359    pub fn url(&self) -> Option<&str> { self.url.as_deref() }
2360    pub fn files(&self) -> Option<&[FileFilter<'a>]> { self.files.as_deref() }
2361}
2362
2363
2364pub struct ShareTargetBuilder<'a> {
2365    action: Cow<'a, str>,
2366    method: Cow<'a, str>,
2367    enctype: Cow<'a, str>,
2368    title: Option<Cow<'a, str>>,
2369    text: Option<Cow<'a, str>>,
2370    url: Option<Cow<'a, str>>,
2371    files: Option<Vec<FileFilter<'a>>>,
2372}
2373
2374impl<'a> ShareTargetBuilder<'a> {
2375    /// Embed the ShareTargetParams
2376    pub fn title(mut self, title: impl Into<Cow<'a, str>>) -> Self { self.title = Some(title.into()); self }
2377    pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
2378    pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
2379    pub fn files(mut self, files: Vec<FileFilter<'a>>) -> Self { self.files = Some(files); self }
2380    pub fn build(self) -> ShareTarget<'a> {
2381        ShareTarget {
2382            action: self.action,
2383            method: self.method,
2384            enctype: self.enctype,
2385            title: self.title,
2386            text: self.text,
2387            url: self.url,
2388            files: self.files,
2389        }
2390    }
2391}
2392
2393
2394#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2395#[serde(rename_all = "camelCase")]
2396pub struct Shortcut<'a> {
2397    name: Cow<'a, str>,
2398    url: Cow<'a, str>,
2399}
2400
2401impl<'a> Shortcut<'a> {
2402    /// Creates a builder for this type with the required parameters:
2403    /// * `name`: 
2404    /// * `url`: 
2405    pub fn builder(name: impl Into<Cow<'a, str>>, url: impl Into<Cow<'a, str>>) -> ShortcutBuilder<'a> {
2406        ShortcutBuilder {
2407            name: name.into(),
2408            url: url.into(),
2409        }
2410    }
2411    pub fn name(&self) -> &str { self.name.as_ref() }
2412    pub fn url(&self) -> &str { self.url.as_ref() }
2413}
2414
2415
2416pub struct ShortcutBuilder<'a> {
2417    name: Cow<'a, str>,
2418    url: Cow<'a, str>,
2419}
2420
2421impl<'a> ShortcutBuilder<'a> {
2422    pub fn build(self) -> Shortcut<'a> {
2423        Shortcut {
2424            name: self.name,
2425            url: self.url,
2426        }
2427    }
2428}
2429
2430
2431#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2432#[serde(rename_all = "camelCase")]
2433pub struct WebAppManifest<'a> {
2434    #[serde(skip_serializing_if = "Option::is_none", rename = "backgroundColor")]
2435    background_color: Option<Cow<'a, str>>,
2436    /// The extra description provided by the manifest.
2437    #[serde(skip_serializing_if = "Option::is_none")]
2438    description: Option<Cow<'a, str>>,
2439    #[serde(skip_serializing_if = "Option::is_none")]
2440    dir: Option<Cow<'a, str>>,
2441    #[serde(skip_serializing_if = "Option::is_none")]
2442    display: Option<Cow<'a, str>>,
2443    /// The overrided display mode controlled by the user.
2444    #[serde(skip_serializing_if = "Option::is_none", rename = "displayOverrides")]
2445    display_overrides: Option<Vec<Cow<'a, str>>>,
2446    /// The handlers to open files.
2447    #[serde(skip_serializing_if = "Option::is_none", rename = "fileHandlers")]
2448    file_handlers: Option<Vec<FileHandler<'a>>>,
2449    #[serde(skip_serializing_if = "Option::is_none")]
2450    icons: Option<Vec<ImageResource<'a>>>,
2451    #[serde(skip_serializing_if = "Option::is_none")]
2452    id: Option<Cow<'a, str>>,
2453    #[serde(skip_serializing_if = "Option::is_none")]
2454    lang: Option<Cow<'a, str>>,
2455    /// TODO(crbug.com/1231886): This field is non-standard and part of a Chrome
2456    /// experiment. See:
2457    /// <https://github.com/WICG/web-app-launch/blob/main/launch_handler.md>
2458    #[serde(skip_serializing_if = "Option::is_none", rename = "launchHandler")]
2459    launch_handler: Option<LaunchHandler<'a>>,
2460    #[serde(skip_serializing_if = "Option::is_none")]
2461    name: Option<Cow<'a, str>>,
2462    #[serde(skip_serializing_if = "Option::is_none")]
2463    orientation: Option<Cow<'a, str>>,
2464    #[serde(skip_serializing_if = "Option::is_none", rename = "preferRelatedApplications")]
2465    prefer_related_applications: Option<bool>,
2466    /// The handlers to open protocols.
2467    #[serde(skip_serializing_if = "Option::is_none", rename = "protocolHandlers")]
2468    protocol_handlers: Option<Vec<ProtocolHandler<'a>>>,
2469    #[serde(skip_serializing_if = "Option::is_none", rename = "relatedApplications")]
2470    related_applications: Option<Vec<RelatedApplication<'a>>>,
2471    #[serde(skip_serializing_if = "Option::is_none")]
2472    scope: Option<Cow<'a, str>>,
2473    /// Non-standard, see
2474    /// <https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md>
2475    #[serde(skip_serializing_if = "Option::is_none", rename = "scopeExtensions")]
2476    scope_extensions: Option<Vec<ScopeExtension<'a>>>,
2477    /// The screenshots used by chromium.
2478    #[serde(skip_serializing_if = "Option::is_none")]
2479    screenshots: Option<Vec<Screenshot<'a>>>,
2480    #[serde(skip_serializing_if = "Option::is_none", rename = "shareTarget")]
2481    share_target: Option<ShareTarget<'a>>,
2482    #[serde(skip_serializing_if = "Option::is_none", rename = "shortName")]
2483    short_name: Option<Cow<'a, str>>,
2484    #[serde(skip_serializing_if = "Option::is_none")]
2485    shortcuts: Option<Vec<Shortcut<'a>>>,
2486    #[serde(skip_serializing_if = "Option::is_none", rename = "startUrl")]
2487    start_url: Option<Cow<'a, str>>,
2488    #[serde(skip_serializing_if = "Option::is_none", rename = "themeColor")]
2489    theme_color: Option<Cow<'a, str>>,
2490}
2491
2492impl<'a> WebAppManifest<'a> {
2493    /// Creates a builder for this type.
2494    pub fn builder() -> WebAppManifestBuilder<'a> {
2495        WebAppManifestBuilder {
2496            background_color: None,
2497            description: None,
2498            dir: None,
2499            display: None,
2500            display_overrides: None,
2501            file_handlers: None,
2502            icons: None,
2503            id: None,
2504            lang: None,
2505            launch_handler: None,
2506            name: None,
2507            orientation: None,
2508            prefer_related_applications: None,
2509            protocol_handlers: None,
2510            related_applications: None,
2511            scope: None,
2512            scope_extensions: None,
2513            screenshots: None,
2514            share_target: None,
2515            short_name: None,
2516            shortcuts: None,
2517            start_url: None,
2518            theme_color: None,
2519        }
2520    }
2521    pub fn background_color(&self) -> Option<&str> { self.background_color.as_deref() }
2522    /// The extra description provided by the manifest.
2523    pub fn description(&self) -> Option<&str> { self.description.as_deref() }
2524    pub fn dir(&self) -> Option<&str> { self.dir.as_deref() }
2525    pub fn display(&self) -> Option<&str> { self.display.as_deref() }
2526    /// The overrided display mode controlled by the user.
2527    pub fn display_overrides(&self) -> Option<&[Cow<'a, str>]> { self.display_overrides.as_deref() }
2528    /// The handlers to open files.
2529    pub fn file_handlers(&self) -> Option<&[FileHandler<'a>]> { self.file_handlers.as_deref() }
2530    pub fn icons(&self) -> Option<&[ImageResource<'a>]> { self.icons.as_deref() }
2531    pub fn id(&self) -> Option<&str> { self.id.as_deref() }
2532    pub fn lang(&self) -> Option<&str> { self.lang.as_deref() }
2533    /// TODO(crbug.com/1231886): This field is non-standard and part of a Chrome
2534    /// experiment. See:
2535    /// <https://github.com/WICG/web-app-launch/blob/main/launch_handler.md>
2536    pub fn launch_handler(&self) -> Option<&LaunchHandler<'a>> { self.launch_handler.as_ref() }
2537    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
2538    pub fn orientation(&self) -> Option<&str> { self.orientation.as_deref() }
2539    pub fn prefer_related_applications(&self) -> Option<bool> { self.prefer_related_applications }
2540    /// The handlers to open protocols.
2541    pub fn protocol_handlers(&self) -> Option<&[ProtocolHandler<'a>]> { self.protocol_handlers.as_deref() }
2542    pub fn related_applications(&self) -> Option<&[RelatedApplication<'a>]> { self.related_applications.as_deref() }
2543    pub fn scope(&self) -> Option<&str> { self.scope.as_deref() }
2544    /// Non-standard, see
2545    /// <https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md>
2546    pub fn scope_extensions(&self) -> Option<&[ScopeExtension<'a>]> { self.scope_extensions.as_deref() }
2547    /// The screenshots used by chromium.
2548    pub fn screenshots(&self) -> Option<&[Screenshot<'a>]> { self.screenshots.as_deref() }
2549    pub fn share_target(&self) -> Option<&ShareTarget<'a>> { self.share_target.as_ref() }
2550    pub fn short_name(&self) -> Option<&str> { self.short_name.as_deref() }
2551    pub fn shortcuts(&self) -> Option<&[Shortcut<'a>]> { self.shortcuts.as_deref() }
2552    pub fn start_url(&self) -> Option<&str> { self.start_url.as_deref() }
2553    pub fn theme_color(&self) -> Option<&str> { self.theme_color.as_deref() }
2554}
2555
2556#[derive(Default)]
2557pub struct WebAppManifestBuilder<'a> {
2558    background_color: Option<Cow<'a, str>>,
2559    description: Option<Cow<'a, str>>,
2560    dir: Option<Cow<'a, str>>,
2561    display: Option<Cow<'a, str>>,
2562    display_overrides: Option<Vec<Cow<'a, str>>>,
2563    file_handlers: Option<Vec<FileHandler<'a>>>,
2564    icons: Option<Vec<ImageResource<'a>>>,
2565    id: Option<Cow<'a, str>>,
2566    lang: Option<Cow<'a, str>>,
2567    launch_handler: Option<LaunchHandler<'a>>,
2568    name: Option<Cow<'a, str>>,
2569    orientation: Option<Cow<'a, str>>,
2570    prefer_related_applications: Option<bool>,
2571    protocol_handlers: Option<Vec<ProtocolHandler<'a>>>,
2572    related_applications: Option<Vec<RelatedApplication<'a>>>,
2573    scope: Option<Cow<'a, str>>,
2574    scope_extensions: Option<Vec<ScopeExtension<'a>>>,
2575    screenshots: Option<Vec<Screenshot<'a>>>,
2576    share_target: Option<ShareTarget<'a>>,
2577    short_name: Option<Cow<'a, str>>,
2578    shortcuts: Option<Vec<Shortcut<'a>>>,
2579    start_url: Option<Cow<'a, str>>,
2580    theme_color: Option<Cow<'a, str>>,
2581}
2582
2583impl<'a> WebAppManifestBuilder<'a> {
2584    pub fn background_color(mut self, background_color: impl Into<Cow<'a, str>>) -> Self { self.background_color = Some(background_color.into()); self }
2585    /// The extra description provided by the manifest.
2586    pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self { self.description = Some(description.into()); self }
2587    pub fn dir(mut self, dir: impl Into<Cow<'a, str>>) -> Self { self.dir = Some(dir.into()); self }
2588    pub fn display(mut self, display: impl Into<Cow<'a, str>>) -> Self { self.display = Some(display.into()); self }
2589    /// The overrided display mode controlled by the user.
2590    pub fn display_overrides(mut self, display_overrides: Vec<Cow<'a, str>>) -> Self { self.display_overrides = Some(display_overrides); self }
2591    /// The handlers to open files.
2592    pub fn file_handlers(mut self, file_handlers: Vec<FileHandler<'a>>) -> Self { self.file_handlers = Some(file_handlers); self }
2593    pub fn icons(mut self, icons: Vec<ImageResource<'a>>) -> Self { self.icons = Some(icons); self }
2594    pub fn id(mut self, id: impl Into<Cow<'a, str>>) -> Self { self.id = Some(id.into()); self }
2595    pub fn lang(mut self, lang: impl Into<Cow<'a, str>>) -> Self { self.lang = Some(lang.into()); self }
2596    /// TODO(crbug.com/1231886): This field is non-standard and part of a Chrome
2597    /// experiment. See:
2598    /// <https://github.com/WICG/web-app-launch/blob/main/launch_handler.md>
2599    pub fn launch_handler(mut self, launch_handler: LaunchHandler<'a>) -> Self { self.launch_handler = Some(launch_handler); self }
2600    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
2601    pub fn orientation(mut self, orientation: impl Into<Cow<'a, str>>) -> Self { self.orientation = Some(orientation.into()); self }
2602    pub fn prefer_related_applications(mut self, prefer_related_applications: bool) -> Self { self.prefer_related_applications = Some(prefer_related_applications); self }
2603    /// The handlers to open protocols.
2604    pub fn protocol_handlers(mut self, protocol_handlers: Vec<ProtocolHandler<'a>>) -> Self { self.protocol_handlers = Some(protocol_handlers); self }
2605    pub fn related_applications(mut self, related_applications: Vec<RelatedApplication<'a>>) -> Self { self.related_applications = Some(related_applications); self }
2606    pub fn scope(mut self, scope: impl Into<Cow<'a, str>>) -> Self { self.scope = Some(scope.into()); self }
2607    /// Non-standard, see
2608    /// <https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md>
2609    pub fn scope_extensions(mut self, scope_extensions: Vec<ScopeExtension<'a>>) -> Self { self.scope_extensions = Some(scope_extensions); self }
2610    /// The screenshots used by chromium.
2611    pub fn screenshots(mut self, screenshots: Vec<Screenshot<'a>>) -> Self { self.screenshots = Some(screenshots); self }
2612    pub fn share_target(mut self, share_target: ShareTarget<'a>) -> Self { self.share_target = Some(share_target); self }
2613    pub fn short_name(mut self, short_name: impl Into<Cow<'a, str>>) -> Self { self.short_name = Some(short_name.into()); self }
2614    pub fn shortcuts(mut self, shortcuts: Vec<Shortcut<'a>>) -> Self { self.shortcuts = Some(shortcuts); self }
2615    pub fn start_url(mut self, start_url: impl Into<Cow<'a, str>>) -> Self { self.start_url = Some(start_url.into()); self }
2616    pub fn theme_color(mut self, theme_color: impl Into<Cow<'a, str>>) -> Self { self.theme_color = Some(theme_color.into()); self }
2617    pub fn build(self) -> WebAppManifest<'a> {
2618        WebAppManifest {
2619            background_color: self.background_color,
2620            description: self.description,
2621            dir: self.dir,
2622            display: self.display,
2623            display_overrides: self.display_overrides,
2624            file_handlers: self.file_handlers,
2625            icons: self.icons,
2626            id: self.id,
2627            lang: self.lang,
2628            launch_handler: self.launch_handler,
2629            name: self.name,
2630            orientation: self.orientation,
2631            prefer_related_applications: self.prefer_related_applications,
2632            protocol_handlers: self.protocol_handlers,
2633            related_applications: self.related_applications,
2634            scope: self.scope,
2635            scope_extensions: self.scope_extensions,
2636            screenshots: self.screenshots,
2637            share_target: self.share_target,
2638            short_name: self.short_name,
2639            shortcuts: self.shortcuts,
2640            start_url: self.start_url,
2641            theme_color: self.theme_color,
2642        }
2643    }
2644}
2645
2646/// The type of a frameNavigated event.
2647
2648#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2649pub enum NavigationType {
2650    #[default]
2651    #[serde(rename = "Navigation")]
2652    Navigation,
2653    #[serde(rename = "BackForwardCacheRestore")]
2654    BackForwardCacheRestore,
2655}
2656
2657/// List of not restored reasons for back-forward cache.
2658
2659#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2660pub enum BackForwardCacheNotRestoredReason {
2661    #[default]
2662    #[serde(rename = "NotPrimaryMainFrame")]
2663    NotPrimaryMainFrame,
2664    #[serde(rename = "BackForwardCacheDisabled")]
2665    BackForwardCacheDisabled,
2666    #[serde(rename = "RelatedActiveContentsExist")]
2667    RelatedActiveContentsExist,
2668    #[serde(rename = "HTTPStatusNotOK")]
2669    HTTPStatusNotOK,
2670    #[serde(rename = "SchemeNotHTTPOrHTTPS")]
2671    SchemeNotHTTPOrHTTPS,
2672    #[serde(rename = "Loading")]
2673    Loading,
2674    #[serde(rename = "WasGrantedMediaAccess")]
2675    WasGrantedMediaAccess,
2676    #[serde(rename = "DisableForRenderFrameHostCalled")]
2677    DisableForRenderFrameHostCalled,
2678    #[serde(rename = "DomainNotAllowed")]
2679    DomainNotAllowed,
2680    #[serde(rename = "HTTPMethodNotGET")]
2681    HTTPMethodNotGET,
2682    #[serde(rename = "SubframeIsNavigating")]
2683    SubframeIsNavigating,
2684    #[serde(rename = "Timeout")]
2685    Timeout,
2686    #[serde(rename = "CacheLimit")]
2687    CacheLimit,
2688    #[serde(rename = "JavaScriptExecution")]
2689    JavaScriptExecution,
2690    #[serde(rename = "RendererProcessKilled")]
2691    RendererProcessKilled,
2692    #[serde(rename = "RendererProcessCrashed")]
2693    RendererProcessCrashed,
2694    #[serde(rename = "SchedulerTrackedFeatureUsed")]
2695    SchedulerTrackedFeatureUsed,
2696    #[serde(rename = "ConflictingBrowsingInstance")]
2697    ConflictingBrowsingInstance,
2698    #[serde(rename = "CacheFlushed")]
2699    CacheFlushed,
2700    #[serde(rename = "ServiceWorkerVersionActivation")]
2701    ServiceWorkerVersionActivation,
2702    #[serde(rename = "SessionRestored")]
2703    SessionRestored,
2704    #[serde(rename = "ServiceWorkerPostMessage")]
2705    ServiceWorkerPostMessage,
2706    #[serde(rename = "EnteredBackForwardCacheBeforeServiceWorkerHostAdded")]
2707    EnteredBackForwardCacheBeforeServiceWorkerHostAdded,
2708    #[serde(rename = "RenderFrameHostReused_SameSite")]
2709    RenderFrameHostReusedSameSite,
2710    #[serde(rename = "RenderFrameHostReused_CrossSite")]
2711    RenderFrameHostReusedCrossSite,
2712    #[serde(rename = "ServiceWorkerClaim")]
2713    ServiceWorkerClaim,
2714    #[serde(rename = "IgnoreEventAndEvict")]
2715    IgnoreEventAndEvict,
2716    #[serde(rename = "HaveInnerContents")]
2717    HaveInnerContents,
2718    #[serde(rename = "TimeoutPuttingInCache")]
2719    TimeoutPuttingInCache,
2720    #[serde(rename = "BackForwardCacheDisabledByLowMemory")]
2721    BackForwardCacheDisabledByLowMemory,
2722    #[serde(rename = "BackForwardCacheDisabledByCommandLine")]
2723    BackForwardCacheDisabledByCommandLine,
2724    #[serde(rename = "NetworkRequestDatapipeDrainedAsBytesConsumer")]
2725    NetworkRequestDatapipeDrainedAsBytesConsumer,
2726    #[serde(rename = "NetworkRequestRedirected")]
2727    NetworkRequestRedirected,
2728    #[serde(rename = "NetworkRequestTimeout")]
2729    NetworkRequestTimeout,
2730    #[serde(rename = "NetworkExceedsBufferLimit")]
2731    NetworkExceedsBufferLimit,
2732    #[serde(rename = "NavigationCancelledWhileRestoring")]
2733    NavigationCancelledWhileRestoring,
2734    #[serde(rename = "NotMostRecentNavigationEntry")]
2735    NotMostRecentNavigationEntry,
2736    #[serde(rename = "BackForwardCacheDisabledForPrerender")]
2737    BackForwardCacheDisabledForPrerender,
2738    #[serde(rename = "UserAgentOverrideDiffers")]
2739    UserAgentOverrideDiffers,
2740    #[serde(rename = "ForegroundCacheLimit")]
2741    ForegroundCacheLimit,
2742    #[serde(rename = "ForwardCacheDisabled")]
2743    ForwardCacheDisabled,
2744    #[serde(rename = "BrowsingInstanceNotSwapped")]
2745    BrowsingInstanceNotSwapped,
2746    #[serde(rename = "BackForwardCacheDisabledForDelegate")]
2747    BackForwardCacheDisabledForDelegate,
2748    #[serde(rename = "UnloadHandlerExistsInMainFrame")]
2749    UnloadHandlerExistsInMainFrame,
2750    #[serde(rename = "UnloadHandlerExistsInSubFrame")]
2751    UnloadHandlerExistsInSubFrame,
2752    #[serde(rename = "ServiceWorkerUnregistration")]
2753    ServiceWorkerUnregistration,
2754    #[serde(rename = "CacheControlNoStore")]
2755    CacheControlNoStore,
2756    #[serde(rename = "CacheControlNoStoreCookieModified")]
2757    CacheControlNoStoreCookieModified,
2758    #[serde(rename = "CacheControlNoStoreHTTPOnlyCookieModified")]
2759    CacheControlNoStoreHTTPOnlyCookieModified,
2760    #[serde(rename = "NoResponseHead")]
2761    NoResponseHead,
2762    #[serde(rename = "Unknown")]
2763    Unknown,
2764    #[serde(rename = "ActivationNavigationsDisallowedForBug1234857")]
2765    ActivationNavigationsDisallowedForBug1234857,
2766    #[serde(rename = "ErrorDocument")]
2767    ErrorDocument,
2768    #[serde(rename = "FencedFramesEmbedder")]
2769    FencedFramesEmbedder,
2770    #[serde(rename = "CookieDisabled")]
2771    CookieDisabled,
2772    #[serde(rename = "HTTPAuthRequired")]
2773    HTTPAuthRequired,
2774    #[serde(rename = "CookieFlushed")]
2775    CookieFlushed,
2776    #[serde(rename = "BroadcastChannelOnMessage")]
2777    BroadcastChannelOnMessage,
2778    #[serde(rename = "WebViewSettingsChanged")]
2779    WebViewSettingsChanged,
2780    #[serde(rename = "WebViewJavaScriptObjectChanged")]
2781    WebViewJavaScriptObjectChanged,
2782    #[serde(rename = "WebViewMessageListenerInjected")]
2783    WebViewMessageListenerInjected,
2784    #[serde(rename = "WebViewSafeBrowsingAllowlistChanged")]
2785    WebViewSafeBrowsingAllowlistChanged,
2786    #[serde(rename = "WebViewDocumentStartJavascriptChanged")]
2787    WebViewDocumentStartJavascriptChanged,
2788    #[serde(rename = "WebSocket")]
2789    WebSocket,
2790    #[serde(rename = "WebTransport")]
2791    WebTransport,
2792    #[serde(rename = "WebRTC")]
2793    WebRTC,
2794    #[serde(rename = "MainResourceHasCacheControlNoStore")]
2795    MainResourceHasCacheControlNoStore,
2796    #[serde(rename = "MainResourceHasCacheControlNoCache")]
2797    MainResourceHasCacheControlNoCache,
2798    #[serde(rename = "SubresourceHasCacheControlNoStore")]
2799    SubresourceHasCacheControlNoStore,
2800    #[serde(rename = "SubresourceHasCacheControlNoCache")]
2801    SubresourceHasCacheControlNoCache,
2802    #[serde(rename = "ContainsPlugins")]
2803    ContainsPlugins,
2804    #[serde(rename = "DocumentLoaded")]
2805    DocumentLoaded,
2806    #[serde(rename = "OutstandingNetworkRequestOthers")]
2807    OutstandingNetworkRequestOthers,
2808    #[serde(rename = "RequestedMIDIPermission")]
2809    RequestedMIDIPermission,
2810    #[serde(rename = "RequestedAudioCapturePermission")]
2811    RequestedAudioCapturePermission,
2812    #[serde(rename = "RequestedVideoCapturePermission")]
2813    RequestedVideoCapturePermission,
2814    #[serde(rename = "RequestedBackForwardCacheBlockedSensors")]
2815    RequestedBackForwardCacheBlockedSensors,
2816    #[serde(rename = "RequestedBackgroundWorkPermission")]
2817    RequestedBackgroundWorkPermission,
2818    #[serde(rename = "BroadcastChannel")]
2819    BroadcastChannel,
2820    #[serde(rename = "WebXR")]
2821    WebXR,
2822    #[serde(rename = "SharedWorker")]
2823    SharedWorker,
2824    #[serde(rename = "SharedWorkerMessage")]
2825    SharedWorkerMessage,
2826    #[serde(rename = "SharedWorkerWithNoActiveClient")]
2827    SharedWorkerWithNoActiveClient,
2828    #[serde(rename = "WebLocks")]
2829    WebLocks,
2830    #[serde(rename = "WebLocksContention")]
2831    WebLocksContention,
2832    #[serde(rename = "WebHID")]
2833    WebHID,
2834    #[serde(rename = "WebBluetooth")]
2835    WebBluetooth,
2836    #[serde(rename = "WebShare")]
2837    WebShare,
2838    #[serde(rename = "RequestedStorageAccessGrant")]
2839    RequestedStorageAccessGrant,
2840    #[serde(rename = "WebNfc")]
2841    WebNfc,
2842    #[serde(rename = "OutstandingNetworkRequestFetch")]
2843    OutstandingNetworkRequestFetch,
2844    #[serde(rename = "OutstandingNetworkRequestXHR")]
2845    OutstandingNetworkRequestXHR,
2846    #[serde(rename = "AppBanner")]
2847    AppBanner,
2848    #[serde(rename = "Printing")]
2849    Printing,
2850    #[serde(rename = "WebDatabase")]
2851    WebDatabase,
2852    #[serde(rename = "PictureInPicture")]
2853    PictureInPicture,
2854    #[serde(rename = "SpeechRecognizer")]
2855    SpeechRecognizer,
2856    #[serde(rename = "IdleManager")]
2857    IdleManager,
2858    #[serde(rename = "PaymentManager")]
2859    PaymentManager,
2860    #[serde(rename = "SpeechSynthesis")]
2861    SpeechSynthesis,
2862    #[serde(rename = "KeyboardLock")]
2863    KeyboardLock,
2864    #[serde(rename = "WebOTPService")]
2865    WebOTPService,
2866    #[serde(rename = "OutstandingNetworkRequestDirectSocket")]
2867    OutstandingNetworkRequestDirectSocket,
2868    #[serde(rename = "InjectedJavascript")]
2869    InjectedJavascript,
2870    #[serde(rename = "InjectedStyleSheet")]
2871    InjectedStyleSheet,
2872    #[serde(rename = "KeepaliveRequest")]
2873    KeepaliveRequest,
2874    #[serde(rename = "IndexedDBEvent")]
2875    IndexedDBEvent,
2876    #[serde(rename = "Dummy")]
2877    Dummy,
2878    #[serde(rename = "JsNetworkRequestReceivedCacheControlNoStoreResource")]
2879    JsNetworkRequestReceivedCacheControlNoStoreResource,
2880    #[serde(rename = "WebRTCUsedWithCCNS")]
2881    WebRTCUsedWithCCNS,
2882    #[serde(rename = "WebTransportUsedWithCCNS")]
2883    WebTransportUsedWithCCNS,
2884    #[serde(rename = "WebSocketUsedWithCCNS")]
2885    WebSocketUsedWithCCNS,
2886    #[serde(rename = "SmartCard")]
2887    SmartCard,
2888    #[serde(rename = "LiveMediaStreamTrack")]
2889    LiveMediaStreamTrack,
2890    #[serde(rename = "UnloadHandler")]
2891    UnloadHandler,
2892    #[serde(rename = "ParserAborted")]
2893    ParserAborted,
2894    #[serde(rename = "ContentSecurityHandler")]
2895    ContentSecurityHandler,
2896    #[serde(rename = "ContentWebAuthenticationAPI")]
2897    ContentWebAuthenticationAPI,
2898    #[serde(rename = "ContentFileChooser")]
2899    ContentFileChooser,
2900    #[serde(rename = "ContentSerial")]
2901    ContentSerial,
2902    #[serde(rename = "ContentFileSystemAccess")]
2903    ContentFileSystemAccess,
2904    #[serde(rename = "ContentMediaDevicesDispatcherHost")]
2905    ContentMediaDevicesDispatcherHost,
2906    #[serde(rename = "ContentWebBluetooth")]
2907    ContentWebBluetooth,
2908    #[serde(rename = "ContentWebUSB")]
2909    ContentWebUSB,
2910    #[serde(rename = "ContentMediaSessionService")]
2911    ContentMediaSessionService,
2912    #[serde(rename = "ContentScreenReader")]
2913    ContentScreenReader,
2914    #[serde(rename = "ContentDiscarded")]
2915    ContentDiscarded,
2916    #[serde(rename = "EmbedderPopupBlockerTabHelper")]
2917    EmbedderPopupBlockerTabHelper,
2918    #[serde(rename = "EmbedderSafeBrowsingTriggeredPopupBlocker")]
2919    EmbedderSafeBrowsingTriggeredPopupBlocker,
2920    #[serde(rename = "EmbedderSafeBrowsingThreatDetails")]
2921    EmbedderSafeBrowsingThreatDetails,
2922    #[serde(rename = "EmbedderAppBannerManager")]
2923    EmbedderAppBannerManager,
2924    #[serde(rename = "EmbedderDomDistillerViewerSource")]
2925    EmbedderDomDistillerViewerSource,
2926    #[serde(rename = "EmbedderDomDistillerSelfDeletingRequestDelegate")]
2927    EmbedderDomDistillerSelfDeletingRequestDelegate,
2928    #[serde(rename = "EmbedderOomInterventionTabHelper")]
2929    EmbedderOomInterventionTabHelper,
2930    #[serde(rename = "EmbedderOfflinePage")]
2931    EmbedderOfflinePage,
2932    #[serde(rename = "EmbedderChromePasswordManagerClientBindCredentialManager")]
2933    EmbedderChromePasswordManagerClientBindCredentialManager,
2934    #[serde(rename = "EmbedderPermissionRequestManager")]
2935    EmbedderPermissionRequestManager,
2936    #[serde(rename = "EmbedderModalDialog")]
2937    EmbedderModalDialog,
2938    #[serde(rename = "EmbedderExtensions")]
2939    EmbedderExtensions,
2940    #[serde(rename = "EmbedderExtensionMessaging")]
2941    EmbedderExtensionMessaging,
2942    #[serde(rename = "EmbedderExtensionMessagingForOpenPort")]
2943    EmbedderExtensionMessagingForOpenPort,
2944    #[serde(rename = "EmbedderExtensionSentMessageToCachedFrame")]
2945    EmbedderExtensionSentMessageToCachedFrame,
2946    #[serde(rename = "EmbedderExtensionFrame")]
2947    EmbedderExtensionFrame,
2948    #[serde(rename = "RequestedByWebViewClient")]
2949    RequestedByWebViewClient,
2950    #[serde(rename = "PostMessageByWebViewClient")]
2951    PostMessageByWebViewClient,
2952    #[serde(rename = "CacheControlNoStoreDeviceBoundSessionTerminated")]
2953    CacheControlNoStoreDeviceBoundSessionTerminated,
2954    #[serde(rename = "CacheLimitPrunedOnModerateMemoryPressure")]
2955    CacheLimitPrunedOnModerateMemoryPressure,
2956    #[serde(rename = "CacheLimitPrunedOnCriticalMemoryPressure")]
2957    CacheLimitPrunedOnCriticalMemoryPressure,
2958}
2959
2960/// Types of not restored reasons for back-forward cache.
2961
2962#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2963pub enum BackForwardCacheNotRestoredReasonType {
2964    #[default]
2965    #[serde(rename = "SupportPending")]
2966    SupportPending,
2967    #[serde(rename = "PageSupportNeeded")]
2968    PageSupportNeeded,
2969    #[serde(rename = "Circumstantial")]
2970    Circumstantial,
2971}
2972
2973
2974#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2975#[serde(rename_all = "camelCase")]
2976pub struct BackForwardCacheBlockingDetails<'a> {
2977    /// Url of the file where blockage happened. Optional because of tests.
2978    #[serde(skip_serializing_if = "Option::is_none")]
2979    url: Option<Cow<'a, str>>,
2980    /// Function name where blockage happened. Optional because of anonymous functions and tests.
2981    #[serde(skip_serializing_if = "Option::is_none")]
2982    function: Option<Cow<'a, str>>,
2983    /// Line number in the script (0-based).
2984    #[serde(rename = "lineNumber")]
2985    line_number: i64,
2986    /// Column number in the script (0-based).
2987    #[serde(rename = "columnNumber")]
2988    column_number: i64,
2989}
2990
2991impl<'a> BackForwardCacheBlockingDetails<'a> {
2992    /// Creates a builder for this type with the required parameters:
2993    /// * `line_number`: Line number in the script (0-based).
2994    /// * `column_number`: Column number in the script (0-based).
2995    pub fn builder(line_number: i64, column_number: i64) -> BackForwardCacheBlockingDetailsBuilder<'a> {
2996        BackForwardCacheBlockingDetailsBuilder {
2997            url: None,
2998            function: None,
2999            line_number: line_number,
3000            column_number: column_number,
3001        }
3002    }
3003    /// Url of the file where blockage happened. Optional because of tests.
3004    pub fn url(&self) -> Option<&str> { self.url.as_deref() }
3005    /// Function name where blockage happened. Optional because of anonymous functions and tests.
3006    pub fn function(&self) -> Option<&str> { self.function.as_deref() }
3007    /// Line number in the script (0-based).
3008    pub fn line_number(&self) -> i64 { self.line_number }
3009    /// Column number in the script (0-based).
3010    pub fn column_number(&self) -> i64 { self.column_number }
3011}
3012
3013
3014pub struct BackForwardCacheBlockingDetailsBuilder<'a> {
3015    url: Option<Cow<'a, str>>,
3016    function: Option<Cow<'a, str>>,
3017    line_number: i64,
3018    column_number: i64,
3019}
3020
3021impl<'a> BackForwardCacheBlockingDetailsBuilder<'a> {
3022    /// Url of the file where blockage happened. Optional because of tests.
3023    pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
3024    /// Function name where blockage happened. Optional because of anonymous functions and tests.
3025    pub fn function(mut self, function: impl Into<Cow<'a, str>>) -> Self { self.function = Some(function.into()); self }
3026    pub fn build(self) -> BackForwardCacheBlockingDetails<'a> {
3027        BackForwardCacheBlockingDetails {
3028            url: self.url,
3029            function: self.function,
3030            line_number: self.line_number,
3031            column_number: self.column_number,
3032        }
3033    }
3034}
3035
3036
3037#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3038#[serde(rename_all = "camelCase")]
3039pub struct BackForwardCacheNotRestoredExplanation<'a> {
3040    /// Type of the reason
3041    #[serde(rename = "type")]
3042    type_: BackForwardCacheNotRestoredReasonType,
3043    /// Not restored reason
3044    reason: BackForwardCacheNotRestoredReason,
3045    /// Context associated with the reason. The meaning of this context is
3046    /// dependent on the reason:
3047    /// - EmbedderExtensionSentMessageToCachedFrame: the extension ID.
3048    #[serde(skip_serializing_if = "Option::is_none")]
3049    context: Option<Cow<'a, str>>,
3050    #[serde(skip_serializing_if = "Option::is_none")]
3051    details: Option<Vec<BackForwardCacheBlockingDetails<'a>>>,
3052}
3053
3054impl<'a> BackForwardCacheNotRestoredExplanation<'a> {
3055    /// Creates a builder for this type with the required parameters:
3056    /// * `type_`: Type of the reason
3057    /// * `reason`: Not restored reason
3058    pub fn builder(type_: impl Into<BackForwardCacheNotRestoredReasonType>, reason: impl Into<BackForwardCacheNotRestoredReason>) -> BackForwardCacheNotRestoredExplanationBuilder<'a> {
3059        BackForwardCacheNotRestoredExplanationBuilder {
3060            type_: type_.into(),
3061            reason: reason.into(),
3062            context: None,
3063            details: None,
3064        }
3065    }
3066    /// Type of the reason
3067    pub fn type_(&self) -> &BackForwardCacheNotRestoredReasonType { &self.type_ }
3068    /// Not restored reason
3069    pub fn reason(&self) -> &BackForwardCacheNotRestoredReason { &self.reason }
3070    /// Context associated with the reason. The meaning of this context is
3071    /// dependent on the reason:
3072    /// - EmbedderExtensionSentMessageToCachedFrame: the extension ID.
3073    pub fn context(&self) -> Option<&str> { self.context.as_deref() }
3074    pub fn details(&self) -> Option<&[BackForwardCacheBlockingDetails<'a>]> { self.details.as_deref() }
3075}
3076
3077
3078pub struct BackForwardCacheNotRestoredExplanationBuilder<'a> {
3079    type_: BackForwardCacheNotRestoredReasonType,
3080    reason: BackForwardCacheNotRestoredReason,
3081    context: Option<Cow<'a, str>>,
3082    details: Option<Vec<BackForwardCacheBlockingDetails<'a>>>,
3083}
3084
3085impl<'a> BackForwardCacheNotRestoredExplanationBuilder<'a> {
3086    /// Context associated with the reason. The meaning of this context is
3087    /// dependent on the reason:
3088    /// - EmbedderExtensionSentMessageToCachedFrame: the extension ID.
3089    pub fn context(mut self, context: impl Into<Cow<'a, str>>) -> Self { self.context = Some(context.into()); self }
3090    pub fn details(mut self, details: Vec<BackForwardCacheBlockingDetails<'a>>) -> Self { self.details = Some(details); self }
3091    pub fn build(self) -> BackForwardCacheNotRestoredExplanation<'a> {
3092        BackForwardCacheNotRestoredExplanation {
3093            type_: self.type_,
3094            reason: self.reason,
3095            context: self.context,
3096            details: self.details,
3097        }
3098    }
3099}
3100
3101
3102#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3103#[serde(rename_all = "camelCase")]
3104pub struct BackForwardCacheNotRestoredExplanationTree<'a> {
3105    /// URL of each frame
3106    url: Cow<'a, str>,
3107    /// Not restored reasons of each frame
3108    explanations: Vec<BackForwardCacheNotRestoredExplanation<'a>>,
3109    /// Array of children frame
3110    children: Vec<Box<BackForwardCacheNotRestoredExplanationTree<'a>>>,
3111}
3112
3113impl<'a> BackForwardCacheNotRestoredExplanationTree<'a> {
3114    /// Creates a builder for this type with the required parameters:
3115    /// * `url`: URL of each frame
3116    /// * `explanations`: Not restored reasons of each frame
3117    /// * `children`: Array of children frame
3118    pub fn builder(url: impl Into<Cow<'a, str>>, explanations: Vec<BackForwardCacheNotRestoredExplanation<'a>>, children: Vec<Box<BackForwardCacheNotRestoredExplanationTree<'a>>>) -> BackForwardCacheNotRestoredExplanationTreeBuilder<'a> {
3119        BackForwardCacheNotRestoredExplanationTreeBuilder {
3120            url: url.into(),
3121            explanations: explanations,
3122            children: children,
3123        }
3124    }
3125    /// URL of each frame
3126    pub fn url(&self) -> &str { self.url.as_ref() }
3127    /// Not restored reasons of each frame
3128    pub fn explanations(&self) -> &[BackForwardCacheNotRestoredExplanation<'a>] { &self.explanations }
3129    /// Array of children frame
3130    pub fn children(&self) -> &[Box<BackForwardCacheNotRestoredExplanationTree<'a>>] { &self.children }
3131}
3132
3133
3134pub struct BackForwardCacheNotRestoredExplanationTreeBuilder<'a> {
3135    url: Cow<'a, str>,
3136    explanations: Vec<BackForwardCacheNotRestoredExplanation<'a>>,
3137    children: Vec<Box<BackForwardCacheNotRestoredExplanationTree<'a>>>,
3138}
3139
3140impl<'a> BackForwardCacheNotRestoredExplanationTreeBuilder<'a> {
3141    pub fn build(self) -> BackForwardCacheNotRestoredExplanationTree<'a> {
3142        BackForwardCacheNotRestoredExplanationTree {
3143            url: self.url,
3144            explanations: self.explanations,
3145            children: self.children,
3146        }
3147    }
3148}
3149
3150/// Deprecated, please use addScriptToEvaluateOnNewDocument instead.
3151
3152#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3153#[serde(rename_all = "camelCase")]
3154pub struct AddScriptToEvaluateOnLoadParams<'a> {
3155    #[serde(rename = "scriptSource")]
3156    script_source: Cow<'a, str>,
3157}
3158
3159impl<'a> AddScriptToEvaluateOnLoadParams<'a> {
3160    /// Creates a builder for this type with the required parameters:
3161    /// * `script_source`: 
3162    pub fn builder(script_source: impl Into<Cow<'a, str>>) -> AddScriptToEvaluateOnLoadParamsBuilder<'a> {
3163        AddScriptToEvaluateOnLoadParamsBuilder {
3164            script_source: script_source.into(),
3165        }
3166    }
3167    pub fn script_source(&self) -> &str { self.script_source.as_ref() }
3168}
3169
3170
3171pub struct AddScriptToEvaluateOnLoadParamsBuilder<'a> {
3172    script_source: Cow<'a, str>,
3173}
3174
3175impl<'a> AddScriptToEvaluateOnLoadParamsBuilder<'a> {
3176    pub fn build(self) -> AddScriptToEvaluateOnLoadParams<'a> {
3177        AddScriptToEvaluateOnLoadParams {
3178            script_source: self.script_source,
3179        }
3180    }
3181}
3182
3183/// Deprecated, please use addScriptToEvaluateOnNewDocument instead.
3184
3185#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3186#[serde(rename_all = "camelCase")]
3187pub struct AddScriptToEvaluateOnLoadReturns<'a> {
3188    /// Identifier of the added script.
3189    identifier: ScriptIdentifier<'a>,
3190}
3191
3192impl<'a> AddScriptToEvaluateOnLoadReturns<'a> {
3193    /// Creates a builder for this type with the required parameters:
3194    /// * `identifier`: Identifier of the added script.
3195    pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> AddScriptToEvaluateOnLoadReturnsBuilder<'a> {
3196        AddScriptToEvaluateOnLoadReturnsBuilder {
3197            identifier: identifier.into(),
3198        }
3199    }
3200    /// Identifier of the added script.
3201    pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
3202}
3203
3204
3205pub struct AddScriptToEvaluateOnLoadReturnsBuilder<'a> {
3206    identifier: ScriptIdentifier<'a>,
3207}
3208
3209impl<'a> AddScriptToEvaluateOnLoadReturnsBuilder<'a> {
3210    pub fn build(self) -> AddScriptToEvaluateOnLoadReturns<'a> {
3211        AddScriptToEvaluateOnLoadReturns {
3212            identifier: self.identifier,
3213        }
3214    }
3215}
3216
3217impl<'a> AddScriptToEvaluateOnLoadParams<'a> { pub const METHOD: &'static str = "Page.addScriptToEvaluateOnLoad"; }
3218
3219impl<'a> crate::CdpCommand<'a> for AddScriptToEvaluateOnLoadParams<'a> {
3220    const METHOD: &'static str = "Page.addScriptToEvaluateOnLoad";
3221    type Response = AddScriptToEvaluateOnLoadReturns<'a>;
3222}
3223
3224/// Evaluates given script in every frame upon creation (before loading frame's scripts).
3225
3226#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3227#[serde(rename_all = "camelCase")]
3228pub struct AddScriptToEvaluateOnNewDocumentParams<'a> {
3229    source: Cow<'a, str>,
3230    /// If specified, creates an isolated world with the given name and evaluates given script in it.
3231    /// This world name will be used as the ExecutionContextDescription::name when the corresponding
3232    /// event is emitted.
3233    #[serde(skip_serializing_if = "Option::is_none", rename = "worldName")]
3234    world_name: Option<Cow<'a, str>>,
3235    /// Specifies whether command line API should be available to the script, defaults
3236    /// to false.
3237    #[serde(skip_serializing_if = "Option::is_none", rename = "includeCommandLineAPI")]
3238    include_command_line_api: Option<bool>,
3239    /// If true, runs the script immediately on existing execution contexts or worlds.
3240    /// Default: false.
3241    #[serde(skip_serializing_if = "Option::is_none", rename = "runImmediately")]
3242    run_immediately: Option<bool>,
3243}
3244
3245impl<'a> AddScriptToEvaluateOnNewDocumentParams<'a> {
3246    /// Creates a builder for this type with the required parameters:
3247    /// * `source`: 
3248    pub fn builder(source: impl Into<Cow<'a, str>>) -> AddScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
3249        AddScriptToEvaluateOnNewDocumentParamsBuilder {
3250            source: source.into(),
3251            world_name: None,
3252            include_command_line_api: None,
3253            run_immediately: None,
3254        }
3255    }
3256    pub fn source(&self) -> &str { self.source.as_ref() }
3257    /// If specified, creates an isolated world with the given name and evaluates given script in it.
3258    /// This world name will be used as the ExecutionContextDescription::name when the corresponding
3259    /// event is emitted.
3260    pub fn world_name(&self) -> Option<&str> { self.world_name.as_deref() }
3261    /// Specifies whether command line API should be available to the script, defaults
3262    /// to false.
3263    pub fn include_command_line_api(&self) -> Option<bool> { self.include_command_line_api }
3264    /// If true, runs the script immediately on existing execution contexts or worlds.
3265    /// Default: false.
3266    pub fn run_immediately(&self) -> Option<bool> { self.run_immediately }
3267}
3268
3269
3270pub struct AddScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
3271    source: Cow<'a, str>,
3272    world_name: Option<Cow<'a, str>>,
3273    include_command_line_api: Option<bool>,
3274    run_immediately: Option<bool>,
3275}
3276
3277impl<'a> AddScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
3278    /// If specified, creates an isolated world with the given name and evaluates given script in it.
3279    /// This world name will be used as the ExecutionContextDescription::name when the corresponding
3280    /// event is emitted.
3281    pub fn world_name(mut self, world_name: impl Into<Cow<'a, str>>) -> Self { self.world_name = Some(world_name.into()); self }
3282    /// Specifies whether command line API should be available to the script, defaults
3283    /// to false.
3284    pub fn include_command_line_api(mut self, include_command_line_api: bool) -> Self { self.include_command_line_api = Some(include_command_line_api); self }
3285    /// If true, runs the script immediately on existing execution contexts or worlds.
3286    /// Default: false.
3287    pub fn run_immediately(mut self, run_immediately: bool) -> Self { self.run_immediately = Some(run_immediately); self }
3288    pub fn build(self) -> AddScriptToEvaluateOnNewDocumentParams<'a> {
3289        AddScriptToEvaluateOnNewDocumentParams {
3290            source: self.source,
3291            world_name: self.world_name,
3292            include_command_line_api: self.include_command_line_api,
3293            run_immediately: self.run_immediately,
3294        }
3295    }
3296}
3297
3298/// Evaluates given script in every frame upon creation (before loading frame's scripts).
3299
3300#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3301#[serde(rename_all = "camelCase")]
3302pub struct AddScriptToEvaluateOnNewDocumentReturns<'a> {
3303    /// Identifier of the added script.
3304    identifier: ScriptIdentifier<'a>,
3305}
3306
3307impl<'a> AddScriptToEvaluateOnNewDocumentReturns<'a> {
3308    /// Creates a builder for this type with the required parameters:
3309    /// * `identifier`: Identifier of the added script.
3310    pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> AddScriptToEvaluateOnNewDocumentReturnsBuilder<'a> {
3311        AddScriptToEvaluateOnNewDocumentReturnsBuilder {
3312            identifier: identifier.into(),
3313        }
3314    }
3315    /// Identifier of the added script.
3316    pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
3317}
3318
3319
3320pub struct AddScriptToEvaluateOnNewDocumentReturnsBuilder<'a> {
3321    identifier: ScriptIdentifier<'a>,
3322}
3323
3324impl<'a> AddScriptToEvaluateOnNewDocumentReturnsBuilder<'a> {
3325    pub fn build(self) -> AddScriptToEvaluateOnNewDocumentReturns<'a> {
3326        AddScriptToEvaluateOnNewDocumentReturns {
3327            identifier: self.identifier,
3328        }
3329    }
3330}
3331
3332impl<'a> AddScriptToEvaluateOnNewDocumentParams<'a> { pub const METHOD: &'static str = "Page.addScriptToEvaluateOnNewDocument"; }
3333
3334impl<'a> crate::CdpCommand<'a> for AddScriptToEvaluateOnNewDocumentParams<'a> {
3335    const METHOD: &'static str = "Page.addScriptToEvaluateOnNewDocument";
3336    type Response = AddScriptToEvaluateOnNewDocumentReturns<'a>;
3337}
3338
3339#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3340pub struct BringToFrontParams {}
3341
3342impl BringToFrontParams { pub const METHOD: &'static str = "Page.bringToFront"; }
3343
3344impl<'a> crate::CdpCommand<'a> for BringToFrontParams {
3345    const METHOD: &'static str = "Page.bringToFront";
3346    type Response = crate::EmptyReturns;
3347}
3348
3349/// Capture page screenshot.
3350
3351#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3352#[serde(rename_all = "camelCase")]
3353pub struct CaptureScreenshotParams<'a> {
3354    /// Image compression format (defaults to png).
3355    #[serde(skip_serializing_if = "Option::is_none")]
3356    format: Option<Cow<'a, str>>,
3357    /// Compression quality from range \[0..100\] (jpeg only).
3358    #[serde(skip_serializing_if = "Option::is_none")]
3359    quality: Option<i64>,
3360    /// Capture the screenshot of a given region only.
3361    #[serde(skip_serializing_if = "Option::is_none")]
3362    clip: Option<Viewport>,
3363    /// Capture the screenshot from the surface, rather than the view. Defaults to true.
3364    #[serde(skip_serializing_if = "Option::is_none", rename = "fromSurface")]
3365    from_surface: Option<bool>,
3366    /// Capture the screenshot beyond the viewport. Defaults to false.
3367    #[serde(skip_serializing_if = "Option::is_none", rename = "captureBeyondViewport")]
3368    capture_beyond_viewport: Option<bool>,
3369    /// Optimize image encoding for speed, not for resulting size (defaults to false)
3370    #[serde(skip_serializing_if = "Option::is_none", rename = "optimizeForSpeed")]
3371    optimize_for_speed: Option<bool>,
3372}
3373
3374impl<'a> CaptureScreenshotParams<'a> {
3375    /// Creates a builder for this type.
3376    pub fn builder() -> CaptureScreenshotParamsBuilder<'a> {
3377        CaptureScreenshotParamsBuilder {
3378            format: None,
3379            quality: None,
3380            clip: None,
3381            from_surface: None,
3382            capture_beyond_viewport: None,
3383            optimize_for_speed: None,
3384        }
3385    }
3386    /// Image compression format (defaults to png).
3387    pub fn format(&self) -> Option<&str> { self.format.as_deref() }
3388    /// Compression quality from range \[0..100\] (jpeg only).
3389    pub fn quality(&self) -> Option<i64> { self.quality }
3390    /// Capture the screenshot of a given region only.
3391    pub fn clip(&self) -> Option<&Viewport> { self.clip.as_ref() }
3392    /// Capture the screenshot from the surface, rather than the view. Defaults to true.
3393    pub fn from_surface(&self) -> Option<bool> { self.from_surface }
3394    /// Capture the screenshot beyond the viewport. Defaults to false.
3395    pub fn capture_beyond_viewport(&self) -> Option<bool> { self.capture_beyond_viewport }
3396    /// Optimize image encoding for speed, not for resulting size (defaults to false)
3397    pub fn optimize_for_speed(&self) -> Option<bool> { self.optimize_for_speed }
3398}
3399
3400#[derive(Default)]
3401pub struct CaptureScreenshotParamsBuilder<'a> {
3402    format: Option<Cow<'a, str>>,
3403    quality: Option<i64>,
3404    clip: Option<Viewport>,
3405    from_surface: Option<bool>,
3406    capture_beyond_viewport: Option<bool>,
3407    optimize_for_speed: Option<bool>,
3408}
3409
3410impl<'a> CaptureScreenshotParamsBuilder<'a> {
3411    /// Image compression format (defaults to png).
3412    pub fn format(mut self, format: impl Into<Cow<'a, str>>) -> Self { self.format = Some(format.into()); self }
3413    /// Compression quality from range \[0..100\] (jpeg only).
3414    pub fn quality(mut self, quality: i64) -> Self { self.quality = Some(quality); self }
3415    /// Capture the screenshot of a given region only.
3416    pub fn clip(mut self, clip: Viewport) -> Self { self.clip = Some(clip); self }
3417    /// Capture the screenshot from the surface, rather than the view. Defaults to true.
3418    pub fn from_surface(mut self, from_surface: bool) -> Self { self.from_surface = Some(from_surface); self }
3419    /// Capture the screenshot beyond the viewport. Defaults to false.
3420    pub fn capture_beyond_viewport(mut self, capture_beyond_viewport: bool) -> Self { self.capture_beyond_viewport = Some(capture_beyond_viewport); self }
3421    /// Optimize image encoding for speed, not for resulting size (defaults to false)
3422    pub fn optimize_for_speed(mut self, optimize_for_speed: bool) -> Self { self.optimize_for_speed = Some(optimize_for_speed); self }
3423    pub fn build(self) -> CaptureScreenshotParams<'a> {
3424        CaptureScreenshotParams {
3425            format: self.format,
3426            quality: self.quality,
3427            clip: self.clip,
3428            from_surface: self.from_surface,
3429            capture_beyond_viewport: self.capture_beyond_viewport,
3430            optimize_for_speed: self.optimize_for_speed,
3431        }
3432    }
3433}
3434
3435/// Capture page screenshot.
3436
3437#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3438#[serde(rename_all = "camelCase")]
3439pub struct CaptureScreenshotReturns<'a> {
3440    /// Base64-encoded image data. (Encoded as a base64 string when passed over JSON)
3441    data: Cow<'a, str>,
3442}
3443
3444impl<'a> CaptureScreenshotReturns<'a> {
3445    /// Creates a builder for this type with the required parameters:
3446    /// * `data`: Base64-encoded image data. (Encoded as a base64 string when passed over JSON)
3447    pub fn builder(data: impl Into<Cow<'a, str>>) -> CaptureScreenshotReturnsBuilder<'a> {
3448        CaptureScreenshotReturnsBuilder {
3449            data: data.into(),
3450        }
3451    }
3452    /// Base64-encoded image data. (Encoded as a base64 string when passed over JSON)
3453    pub fn data(&self) -> &str { self.data.as_ref() }
3454}
3455
3456
3457pub struct CaptureScreenshotReturnsBuilder<'a> {
3458    data: Cow<'a, str>,
3459}
3460
3461impl<'a> CaptureScreenshotReturnsBuilder<'a> {
3462    pub fn build(self) -> CaptureScreenshotReturns<'a> {
3463        CaptureScreenshotReturns {
3464            data: self.data,
3465        }
3466    }
3467}
3468
3469impl<'a> CaptureScreenshotParams<'a> { pub const METHOD: &'static str = "Page.captureScreenshot"; }
3470
3471impl<'a> crate::CdpCommand<'a> for CaptureScreenshotParams<'a> {
3472    const METHOD: &'static str = "Page.captureScreenshot";
3473    type Response = CaptureScreenshotReturns<'a>;
3474}
3475
3476/// Returns a snapshot of the page as a string. For MHTML format, the serialization includes
3477/// iframes, shadow DOM, external resources, and element-inline styles.
3478
3479#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3480#[serde(rename_all = "camelCase")]
3481pub struct CaptureSnapshotParams<'a> {
3482    /// Format (defaults to mhtml).
3483    #[serde(skip_serializing_if = "Option::is_none")]
3484    format: Option<Cow<'a, str>>,
3485}
3486
3487impl<'a> CaptureSnapshotParams<'a> {
3488    /// Creates a builder for this type.
3489    pub fn builder() -> CaptureSnapshotParamsBuilder<'a> {
3490        CaptureSnapshotParamsBuilder {
3491            format: None,
3492        }
3493    }
3494    /// Format (defaults to mhtml).
3495    pub fn format(&self) -> Option<&str> { self.format.as_deref() }
3496}
3497
3498#[derive(Default)]
3499pub struct CaptureSnapshotParamsBuilder<'a> {
3500    format: Option<Cow<'a, str>>,
3501}
3502
3503impl<'a> CaptureSnapshotParamsBuilder<'a> {
3504    /// Format (defaults to mhtml).
3505    pub fn format(mut self, format: impl Into<Cow<'a, str>>) -> Self { self.format = Some(format.into()); self }
3506    pub fn build(self) -> CaptureSnapshotParams<'a> {
3507        CaptureSnapshotParams {
3508            format: self.format,
3509        }
3510    }
3511}
3512
3513/// Returns a snapshot of the page as a string. For MHTML format, the serialization includes
3514/// iframes, shadow DOM, external resources, and element-inline styles.
3515
3516#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3517#[serde(rename_all = "camelCase")]
3518pub struct CaptureSnapshotReturns<'a> {
3519    /// Serialized page data.
3520    data: Cow<'a, str>,
3521}
3522
3523impl<'a> CaptureSnapshotReturns<'a> {
3524    /// Creates a builder for this type with the required parameters:
3525    /// * `data`: Serialized page data.
3526    pub fn builder(data: impl Into<Cow<'a, str>>) -> CaptureSnapshotReturnsBuilder<'a> {
3527        CaptureSnapshotReturnsBuilder {
3528            data: data.into(),
3529        }
3530    }
3531    /// Serialized page data.
3532    pub fn data(&self) -> &str { self.data.as_ref() }
3533}
3534
3535
3536pub struct CaptureSnapshotReturnsBuilder<'a> {
3537    data: Cow<'a, str>,
3538}
3539
3540impl<'a> CaptureSnapshotReturnsBuilder<'a> {
3541    pub fn build(self) -> CaptureSnapshotReturns<'a> {
3542        CaptureSnapshotReturns {
3543            data: self.data,
3544        }
3545    }
3546}
3547
3548impl<'a> CaptureSnapshotParams<'a> { pub const METHOD: &'static str = "Page.captureSnapshot"; }
3549
3550impl<'a> crate::CdpCommand<'a> for CaptureSnapshotParams<'a> {
3551    const METHOD: &'static str = "Page.captureSnapshot";
3552    type Response = CaptureSnapshotReturns<'a>;
3553}
3554
3555#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3556pub struct ClearDeviceMetricsOverrideParams {}
3557
3558impl ClearDeviceMetricsOverrideParams { pub const METHOD: &'static str = "Page.clearDeviceMetricsOverride"; }
3559
3560impl<'a> crate::CdpCommand<'a> for ClearDeviceMetricsOverrideParams {
3561    const METHOD: &'static str = "Page.clearDeviceMetricsOverride";
3562    type Response = crate::EmptyReturns;
3563}
3564
3565#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3566pub struct ClearDeviceOrientationOverrideParams {}
3567
3568impl ClearDeviceOrientationOverrideParams { pub const METHOD: &'static str = "Page.clearDeviceOrientationOverride"; }
3569
3570impl<'a> crate::CdpCommand<'a> for ClearDeviceOrientationOverrideParams {
3571    const METHOD: &'static str = "Page.clearDeviceOrientationOverride";
3572    type Response = crate::EmptyReturns;
3573}
3574
3575#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3576pub struct ClearGeolocationOverrideParams {}
3577
3578impl ClearGeolocationOverrideParams { pub const METHOD: &'static str = "Page.clearGeolocationOverride"; }
3579
3580impl<'a> crate::CdpCommand<'a> for ClearGeolocationOverrideParams {
3581    const METHOD: &'static str = "Page.clearGeolocationOverride";
3582    type Response = crate::EmptyReturns;
3583}
3584
3585/// Creates an isolated world for the given frame.
3586
3587#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3588#[serde(rename_all = "camelCase")]
3589pub struct CreateIsolatedWorldParams<'a> {
3590    /// Id of the frame in which the isolated world should be created.
3591    #[serde(rename = "frameId")]
3592    frame_id: FrameId<'a>,
3593    /// An optional name which is reported in the Execution Context.
3594    #[serde(skip_serializing_if = "Option::is_none", rename = "worldName")]
3595    world_name: Option<Cow<'a, str>>,
3596    /// Whether or not universal access should be granted to the isolated world. This is a powerful
3597    /// option, use with caution.
3598    #[serde(skip_serializing_if = "Option::is_none", rename = "grantUniveralAccess")]
3599    grant_univeral_access: Option<bool>,
3600}
3601
3602impl<'a> CreateIsolatedWorldParams<'a> {
3603    /// Creates a builder for this type with the required parameters:
3604    /// * `frame_id`: Id of the frame in which the isolated world should be created.
3605    pub fn builder(frame_id: impl Into<FrameId<'a>>) -> CreateIsolatedWorldParamsBuilder<'a> {
3606        CreateIsolatedWorldParamsBuilder {
3607            frame_id: frame_id.into(),
3608            world_name: None,
3609            grant_univeral_access: None,
3610        }
3611    }
3612    /// Id of the frame in which the isolated world should be created.
3613    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
3614    /// An optional name which is reported in the Execution Context.
3615    pub fn world_name(&self) -> Option<&str> { self.world_name.as_deref() }
3616    /// Whether or not universal access should be granted to the isolated world. This is a powerful
3617    /// option, use with caution.
3618    pub fn grant_univeral_access(&self) -> Option<bool> { self.grant_univeral_access }
3619}
3620
3621
3622pub struct CreateIsolatedWorldParamsBuilder<'a> {
3623    frame_id: FrameId<'a>,
3624    world_name: Option<Cow<'a, str>>,
3625    grant_univeral_access: Option<bool>,
3626}
3627
3628impl<'a> CreateIsolatedWorldParamsBuilder<'a> {
3629    /// An optional name which is reported in the Execution Context.
3630    pub fn world_name(mut self, world_name: impl Into<Cow<'a, str>>) -> Self { self.world_name = Some(world_name.into()); self }
3631    /// Whether or not universal access should be granted to the isolated world. This is a powerful
3632    /// option, use with caution.
3633    pub fn grant_univeral_access(mut self, grant_univeral_access: bool) -> Self { self.grant_univeral_access = Some(grant_univeral_access); self }
3634    pub fn build(self) -> CreateIsolatedWorldParams<'a> {
3635        CreateIsolatedWorldParams {
3636            frame_id: self.frame_id,
3637            world_name: self.world_name,
3638            grant_univeral_access: self.grant_univeral_access,
3639        }
3640    }
3641}
3642
3643/// Creates an isolated world for the given frame.
3644
3645#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3646#[serde(rename_all = "camelCase")]
3647pub struct CreateIsolatedWorldReturns {
3648    /// Execution context of the isolated world.
3649    #[serde(rename = "executionContextId")]
3650    execution_context_id: crate::runtime::ExecutionContextId,
3651}
3652
3653impl CreateIsolatedWorldReturns {
3654    /// Creates a builder for this type with the required parameters:
3655    /// * `execution_context_id`: Execution context of the isolated world.
3656    pub fn builder(execution_context_id: crate::runtime::ExecutionContextId) -> CreateIsolatedWorldReturnsBuilder {
3657        CreateIsolatedWorldReturnsBuilder {
3658            execution_context_id: execution_context_id,
3659        }
3660    }
3661    /// Execution context of the isolated world.
3662    pub fn execution_context_id(&self) -> &crate::runtime::ExecutionContextId { &self.execution_context_id }
3663}
3664
3665
3666pub struct CreateIsolatedWorldReturnsBuilder {
3667    execution_context_id: crate::runtime::ExecutionContextId,
3668}
3669
3670impl CreateIsolatedWorldReturnsBuilder {
3671    pub fn build(self) -> CreateIsolatedWorldReturns {
3672        CreateIsolatedWorldReturns {
3673            execution_context_id: self.execution_context_id,
3674        }
3675    }
3676}
3677
3678impl<'a> CreateIsolatedWorldParams<'a> { pub const METHOD: &'static str = "Page.createIsolatedWorld"; }
3679
3680impl<'a> crate::CdpCommand<'a> for CreateIsolatedWorldParams<'a> {
3681    const METHOD: &'static str = "Page.createIsolatedWorld";
3682    type Response = CreateIsolatedWorldReturns;
3683}
3684
3685/// Deletes browser cookie with given name, domain and path.
3686
3687#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3688#[serde(rename_all = "camelCase")]
3689pub struct DeleteCookieParams<'a> {
3690    /// Name of the cookie to remove.
3691    #[serde(rename = "cookieName")]
3692    cookie_name: Cow<'a, str>,
3693    /// URL to match cooke domain and path.
3694    url: Cow<'a, str>,
3695}
3696
3697impl<'a> DeleteCookieParams<'a> {
3698    /// Creates a builder for this type with the required parameters:
3699    /// * `cookie_name`: Name of the cookie to remove.
3700    /// * `url`: URL to match cooke domain and path.
3701    pub fn builder(cookie_name: impl Into<Cow<'a, str>>, url: impl Into<Cow<'a, str>>) -> DeleteCookieParamsBuilder<'a> {
3702        DeleteCookieParamsBuilder {
3703            cookie_name: cookie_name.into(),
3704            url: url.into(),
3705        }
3706    }
3707    /// Name of the cookie to remove.
3708    pub fn cookie_name(&self) -> &str { self.cookie_name.as_ref() }
3709    /// URL to match cooke domain and path.
3710    pub fn url(&self) -> &str { self.url.as_ref() }
3711}
3712
3713
3714pub struct DeleteCookieParamsBuilder<'a> {
3715    cookie_name: Cow<'a, str>,
3716    url: Cow<'a, str>,
3717}
3718
3719impl<'a> DeleteCookieParamsBuilder<'a> {
3720    pub fn build(self) -> DeleteCookieParams<'a> {
3721        DeleteCookieParams {
3722            cookie_name: self.cookie_name,
3723            url: self.url,
3724        }
3725    }
3726}
3727
3728impl<'a> DeleteCookieParams<'a> { pub const METHOD: &'static str = "Page.deleteCookie"; }
3729
3730impl<'a> crate::CdpCommand<'a> for DeleteCookieParams<'a> {
3731    const METHOD: &'static str = "Page.deleteCookie";
3732    type Response = crate::EmptyReturns;
3733}
3734
3735#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3736pub struct DisableParams {}
3737
3738impl DisableParams { pub const METHOD: &'static str = "Page.disable"; }
3739
3740impl<'a> crate::CdpCommand<'a> for DisableParams {
3741    const METHOD: &'static str = "Page.disable";
3742    type Response = crate::EmptyReturns;
3743}
3744
3745/// Enables page domain notifications.
3746
3747#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3748#[serde(rename_all = "camelCase")]
3749pub struct EnableParams {
3750    /// If true, the 'Page.fileChooserOpened' event will be emitted regardless of the state set by
3751    /// 'Page.setInterceptFileChooserDialog' command (default: false).
3752    #[serde(skip_serializing_if = "Option::is_none", rename = "enableFileChooserOpenedEvent")]
3753    enable_file_chooser_opened_event: Option<bool>,
3754}
3755
3756impl EnableParams {
3757    /// Creates a builder for this type.
3758    pub fn builder() -> EnableParamsBuilder {
3759        EnableParamsBuilder {
3760            enable_file_chooser_opened_event: None,
3761        }
3762    }
3763    /// If true, the 'Page.fileChooserOpened' event will be emitted regardless of the state set by
3764    /// 'Page.setInterceptFileChooserDialog' command (default: false).
3765    pub fn enable_file_chooser_opened_event(&self) -> Option<bool> { self.enable_file_chooser_opened_event }
3766}
3767
3768#[derive(Default)]
3769pub struct EnableParamsBuilder {
3770    enable_file_chooser_opened_event: Option<bool>,
3771}
3772
3773impl EnableParamsBuilder {
3774    /// If true, the 'Page.fileChooserOpened' event will be emitted regardless of the state set by
3775    /// 'Page.setInterceptFileChooserDialog' command (default: false).
3776    pub fn enable_file_chooser_opened_event(mut self, enable_file_chooser_opened_event: bool) -> Self { self.enable_file_chooser_opened_event = Some(enable_file_chooser_opened_event); self }
3777    pub fn build(self) -> EnableParams {
3778        EnableParams {
3779            enable_file_chooser_opened_event: self.enable_file_chooser_opened_event,
3780        }
3781    }
3782}
3783
3784impl EnableParams { pub const METHOD: &'static str = "Page.enable"; }
3785
3786impl<'a> crate::CdpCommand<'a> for EnableParams {
3787    const METHOD: &'static str = "Page.enable";
3788    type Response = crate::EmptyReturns;
3789}
3790
3791/// Gets the processed manifest for this current document.
3792/// This API always waits for the manifest to be loaded.
3793/// If manifestId is provided, and it does not match the manifest of the
3794/// current document, this API errors out.
3795/// If there is not a loaded page, this API errors out immediately.
3796
3797#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3798#[serde(rename_all = "camelCase")]
3799pub struct GetAppManifestParams<'a> {
3800    #[serde(skip_serializing_if = "Option::is_none", rename = "manifestId")]
3801    manifest_id: Option<Cow<'a, str>>,
3802}
3803
3804impl<'a> GetAppManifestParams<'a> {
3805    /// Creates a builder for this type.
3806    pub fn builder() -> GetAppManifestParamsBuilder<'a> {
3807        GetAppManifestParamsBuilder {
3808            manifest_id: None,
3809        }
3810    }
3811    pub fn manifest_id(&self) -> Option<&str> { self.manifest_id.as_deref() }
3812}
3813
3814#[derive(Default)]
3815pub struct GetAppManifestParamsBuilder<'a> {
3816    manifest_id: Option<Cow<'a, str>>,
3817}
3818
3819impl<'a> GetAppManifestParamsBuilder<'a> {
3820    pub fn manifest_id(mut self, manifest_id: impl Into<Cow<'a, str>>) -> Self { self.manifest_id = Some(manifest_id.into()); self }
3821    pub fn build(self) -> GetAppManifestParams<'a> {
3822        GetAppManifestParams {
3823            manifest_id: self.manifest_id,
3824        }
3825    }
3826}
3827
3828/// Gets the processed manifest for this current document.
3829/// This API always waits for the manifest to be loaded.
3830/// If manifestId is provided, and it does not match the manifest of the
3831/// current document, this API errors out.
3832/// If there is not a loaded page, this API errors out immediately.
3833
3834#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3835#[serde(rename_all = "camelCase")]
3836pub struct GetAppManifestReturns<'a> {
3837    /// Manifest location.
3838    url: Cow<'a, str>,
3839    errors: Vec<AppManifestError<'a>>,
3840    /// Manifest content.
3841    #[serde(skip_serializing_if = "Option::is_none")]
3842    data: Option<Cow<'a, str>>,
3843    /// Parsed manifest properties. Deprecated, use manifest instead.
3844    #[serde(skip_serializing_if = "Option::is_none")]
3845    parsed: Option<AppManifestParsedProperties<'a>>,
3846    manifest: WebAppManifest<'a>,
3847}
3848
3849impl<'a> GetAppManifestReturns<'a> {
3850    /// Creates a builder for this type with the required parameters:
3851    /// * `url`: Manifest location.
3852    /// * `errors`: 
3853    /// * `manifest`: 
3854    pub fn builder(url: impl Into<Cow<'a, str>>, errors: Vec<AppManifestError<'a>>, manifest: WebAppManifest<'a>) -> GetAppManifestReturnsBuilder<'a> {
3855        GetAppManifestReturnsBuilder {
3856            url: url.into(),
3857            errors: errors,
3858            data: None,
3859            parsed: None,
3860            manifest: manifest,
3861        }
3862    }
3863    /// Manifest location.
3864    pub fn url(&self) -> &str { self.url.as_ref() }
3865    pub fn errors(&self) -> &[AppManifestError<'a>] { &self.errors }
3866    /// Manifest content.
3867    pub fn data(&self) -> Option<&str> { self.data.as_deref() }
3868    /// Parsed manifest properties. Deprecated, use manifest instead.
3869    pub fn parsed(&self) -> Option<&AppManifestParsedProperties<'a>> { self.parsed.as_ref() }
3870    pub fn manifest(&self) -> &WebAppManifest<'a> { &self.manifest }
3871}
3872
3873
3874pub struct GetAppManifestReturnsBuilder<'a> {
3875    url: Cow<'a, str>,
3876    errors: Vec<AppManifestError<'a>>,
3877    data: Option<Cow<'a, str>>,
3878    parsed: Option<AppManifestParsedProperties<'a>>,
3879    manifest: WebAppManifest<'a>,
3880}
3881
3882impl<'a> GetAppManifestReturnsBuilder<'a> {
3883    /// Manifest content.
3884    pub fn data(mut self, data: impl Into<Cow<'a, str>>) -> Self { self.data = Some(data.into()); self }
3885    /// Parsed manifest properties. Deprecated, use manifest instead.
3886    pub fn parsed(mut self, parsed: AppManifestParsedProperties<'a>) -> Self { self.parsed = Some(parsed); self }
3887    pub fn build(self) -> GetAppManifestReturns<'a> {
3888        GetAppManifestReturns {
3889            url: self.url,
3890            errors: self.errors,
3891            data: self.data,
3892            parsed: self.parsed,
3893            manifest: self.manifest,
3894        }
3895    }
3896}
3897
3898impl<'a> GetAppManifestParams<'a> { pub const METHOD: &'static str = "Page.getAppManifest"; }
3899
3900impl<'a> crate::CdpCommand<'a> for GetAppManifestParams<'a> {
3901    const METHOD: &'static str = "Page.getAppManifest";
3902    type Response = GetAppManifestReturns<'a>;
3903}
3904
3905
3906#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3907#[serde(rename_all = "camelCase")]
3908pub struct GetInstallabilityErrorsReturns<'a> {
3909    #[serde(rename = "installabilityErrors")]
3910    installability_errors: Vec<InstallabilityError<'a>>,
3911}
3912
3913impl<'a> GetInstallabilityErrorsReturns<'a> {
3914    /// Creates a builder for this type with the required parameters:
3915    /// * `installability_errors`: 
3916    pub fn builder(installability_errors: Vec<InstallabilityError<'a>>) -> GetInstallabilityErrorsReturnsBuilder<'a> {
3917        GetInstallabilityErrorsReturnsBuilder {
3918            installability_errors: installability_errors,
3919        }
3920    }
3921    pub fn installability_errors(&self) -> &[InstallabilityError<'a>] { &self.installability_errors }
3922}
3923
3924
3925pub struct GetInstallabilityErrorsReturnsBuilder<'a> {
3926    installability_errors: Vec<InstallabilityError<'a>>,
3927}
3928
3929impl<'a> GetInstallabilityErrorsReturnsBuilder<'a> {
3930    pub fn build(self) -> GetInstallabilityErrorsReturns<'a> {
3931        GetInstallabilityErrorsReturns {
3932            installability_errors: self.installability_errors,
3933        }
3934    }
3935}
3936
3937#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3938pub struct GetInstallabilityErrorsParams {}
3939
3940impl GetInstallabilityErrorsParams { pub const METHOD: &'static str = "Page.getInstallabilityErrors"; }
3941
3942impl<'a> crate::CdpCommand<'a> for GetInstallabilityErrorsParams {
3943    const METHOD: &'static str = "Page.getInstallabilityErrors";
3944    type Response = GetInstallabilityErrorsReturns<'a>;
3945}
3946
3947/// Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation.
3948
3949#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3950#[serde(rename_all = "camelCase")]
3951pub struct GetManifestIconsReturns<'a> {
3952    #[serde(skip_serializing_if = "Option::is_none", rename = "primaryIcon")]
3953    primary_icon: Option<Cow<'a, str>>,
3954}
3955
3956impl<'a> GetManifestIconsReturns<'a> {
3957    /// Creates a builder for this type.
3958    pub fn builder() -> GetManifestIconsReturnsBuilder<'a> {
3959        GetManifestIconsReturnsBuilder {
3960            primary_icon: None,
3961        }
3962    }
3963    pub fn primary_icon(&self) -> Option<&str> { self.primary_icon.as_deref() }
3964}
3965
3966#[derive(Default)]
3967pub struct GetManifestIconsReturnsBuilder<'a> {
3968    primary_icon: Option<Cow<'a, str>>,
3969}
3970
3971impl<'a> GetManifestIconsReturnsBuilder<'a> {
3972    pub fn primary_icon(mut self, primary_icon: impl Into<Cow<'a, str>>) -> Self { self.primary_icon = Some(primary_icon.into()); self }
3973    pub fn build(self) -> GetManifestIconsReturns<'a> {
3974        GetManifestIconsReturns {
3975            primary_icon: self.primary_icon,
3976        }
3977    }
3978}
3979
3980#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3981pub struct GetManifestIconsParams {}
3982
3983impl GetManifestIconsParams { pub const METHOD: &'static str = "Page.getManifestIcons"; }
3984
3985impl<'a> crate::CdpCommand<'a> for GetManifestIconsParams {
3986    const METHOD: &'static str = "Page.getManifestIcons";
3987    type Response = GetManifestIconsReturns<'a>;
3988}
3989
3990/// Returns the unique (PWA) app id.
3991/// Only returns values if the feature flag 'WebAppEnableManifestId' is enabled
3992
3993#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3994#[serde(rename_all = "camelCase")]
3995pub struct GetAppIdReturns<'a> {
3996    /// App id, either from manifest's id attribute or computed from start_url
3997    #[serde(skip_serializing_if = "Option::is_none", rename = "appId")]
3998    app_id: Option<Cow<'a, str>>,
3999    /// Recommendation for manifest's id attribute to match current id computed from start_url
4000    #[serde(skip_serializing_if = "Option::is_none", rename = "recommendedId")]
4001    recommended_id: Option<Cow<'a, str>>,
4002}
4003
4004impl<'a> GetAppIdReturns<'a> {
4005    /// Creates a builder for this type.
4006    pub fn builder() -> GetAppIdReturnsBuilder<'a> {
4007        GetAppIdReturnsBuilder {
4008            app_id: None,
4009            recommended_id: None,
4010        }
4011    }
4012    /// App id, either from manifest's id attribute or computed from start_url
4013    pub fn app_id(&self) -> Option<&str> { self.app_id.as_deref() }
4014    /// Recommendation for manifest's id attribute to match current id computed from start_url
4015    pub fn recommended_id(&self) -> Option<&str> { self.recommended_id.as_deref() }
4016}
4017
4018#[derive(Default)]
4019pub struct GetAppIdReturnsBuilder<'a> {
4020    app_id: Option<Cow<'a, str>>,
4021    recommended_id: Option<Cow<'a, str>>,
4022}
4023
4024impl<'a> GetAppIdReturnsBuilder<'a> {
4025    /// App id, either from manifest's id attribute or computed from start_url
4026    pub fn app_id(mut self, app_id: impl Into<Cow<'a, str>>) -> Self { self.app_id = Some(app_id.into()); self }
4027    /// Recommendation for manifest's id attribute to match current id computed from start_url
4028    pub fn recommended_id(mut self, recommended_id: impl Into<Cow<'a, str>>) -> Self { self.recommended_id = Some(recommended_id.into()); self }
4029    pub fn build(self) -> GetAppIdReturns<'a> {
4030        GetAppIdReturns {
4031            app_id: self.app_id,
4032            recommended_id: self.recommended_id,
4033        }
4034    }
4035}
4036
4037#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4038pub struct GetAppIdParams {}
4039
4040impl GetAppIdParams { pub const METHOD: &'static str = "Page.getAppId"; }
4041
4042impl<'a> crate::CdpCommand<'a> for GetAppIdParams {
4043    const METHOD: &'static str = "Page.getAppId";
4044    type Response = GetAppIdReturns<'a>;
4045}
4046
4047
4048#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4049#[serde(rename_all = "camelCase")]
4050pub struct GetAdScriptAncestryParams<'a> {
4051    #[serde(rename = "frameId")]
4052    frame_id: FrameId<'a>,
4053}
4054
4055impl<'a> GetAdScriptAncestryParams<'a> {
4056    /// Creates a builder for this type with the required parameters:
4057    /// * `frame_id`: 
4058    pub fn builder(frame_id: impl Into<FrameId<'a>>) -> GetAdScriptAncestryParamsBuilder<'a> {
4059        GetAdScriptAncestryParamsBuilder {
4060            frame_id: frame_id.into(),
4061        }
4062    }
4063    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
4064}
4065
4066
4067pub struct GetAdScriptAncestryParamsBuilder<'a> {
4068    frame_id: FrameId<'a>,
4069}
4070
4071impl<'a> GetAdScriptAncestryParamsBuilder<'a> {
4072    pub fn build(self) -> GetAdScriptAncestryParams<'a> {
4073        GetAdScriptAncestryParams {
4074            frame_id: self.frame_id,
4075        }
4076    }
4077}
4078
4079
4080#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4081#[serde(rename_all = "camelCase")]
4082pub struct GetAdScriptAncestryReturns<'a> {
4083    /// The ancestry chain of ad script identifiers leading to this frame's
4084    /// creation, along with the root script's filterlist rule. The ancestry
4085    /// chain is ordered from the most immediate script (in the frame creation
4086    /// stack) to more distant ancestors (that created the immediately preceding
4087    /// script). Only sent if frame is labelled as an ad and ids are available.
4088    #[serde(skip_serializing_if = "Option::is_none", rename = "adScriptAncestry")]
4089    ad_script_ancestry: Option<crate::network::AdAncestry<'a>>,
4090}
4091
4092impl<'a> GetAdScriptAncestryReturns<'a> {
4093    /// Creates a builder for this type.
4094    pub fn builder() -> GetAdScriptAncestryReturnsBuilder<'a> {
4095        GetAdScriptAncestryReturnsBuilder {
4096            ad_script_ancestry: None,
4097        }
4098    }
4099    /// The ancestry chain of ad script identifiers leading to this frame's
4100    /// creation, along with the root script's filterlist rule. The ancestry
4101    /// chain is ordered from the most immediate script (in the frame creation
4102    /// stack) to more distant ancestors (that created the immediately preceding
4103    /// script). Only sent if frame is labelled as an ad and ids are available.
4104    pub fn ad_script_ancestry(&self) -> Option<&crate::network::AdAncestry<'a>> { self.ad_script_ancestry.as_ref() }
4105}
4106
4107#[derive(Default)]
4108pub struct GetAdScriptAncestryReturnsBuilder<'a> {
4109    ad_script_ancestry: Option<crate::network::AdAncestry<'a>>,
4110}
4111
4112impl<'a> GetAdScriptAncestryReturnsBuilder<'a> {
4113    /// The ancestry chain of ad script identifiers leading to this frame's
4114    /// creation, along with the root script's filterlist rule. The ancestry
4115    /// chain is ordered from the most immediate script (in the frame creation
4116    /// stack) to more distant ancestors (that created the immediately preceding
4117    /// script). Only sent if frame is labelled as an ad and ids are available.
4118    pub fn ad_script_ancestry(mut self, ad_script_ancestry: crate::network::AdAncestry<'a>) -> Self { self.ad_script_ancestry = Some(ad_script_ancestry); self }
4119    pub fn build(self) -> GetAdScriptAncestryReturns<'a> {
4120        GetAdScriptAncestryReturns {
4121            ad_script_ancestry: self.ad_script_ancestry,
4122        }
4123    }
4124}
4125
4126impl<'a> GetAdScriptAncestryParams<'a> { pub const METHOD: &'static str = "Page.getAdScriptAncestry"; }
4127
4128impl<'a> crate::CdpCommand<'a> for GetAdScriptAncestryParams<'a> {
4129    const METHOD: &'static str = "Page.getAdScriptAncestry";
4130    type Response = GetAdScriptAncestryReturns<'a>;
4131}
4132
4133/// Returns present frame tree structure.
4134
4135#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4136#[serde(rename_all = "camelCase")]
4137pub struct GetFrameTreeReturns<'a> {
4138    /// Present frame tree structure.
4139    #[serde(rename = "frameTree")]
4140    frame_tree: FrameTree<'a>,
4141}
4142
4143impl<'a> GetFrameTreeReturns<'a> {
4144    /// Creates a builder for this type with the required parameters:
4145    /// * `frame_tree`: Present frame tree structure.
4146    pub fn builder(frame_tree: FrameTree<'a>) -> GetFrameTreeReturnsBuilder<'a> {
4147        GetFrameTreeReturnsBuilder {
4148            frame_tree: frame_tree,
4149        }
4150    }
4151    /// Present frame tree structure.
4152    pub fn frame_tree(&self) -> &FrameTree<'a> { &self.frame_tree }
4153}
4154
4155
4156pub struct GetFrameTreeReturnsBuilder<'a> {
4157    frame_tree: FrameTree<'a>,
4158}
4159
4160impl<'a> GetFrameTreeReturnsBuilder<'a> {
4161    pub fn build(self) -> GetFrameTreeReturns<'a> {
4162        GetFrameTreeReturns {
4163            frame_tree: self.frame_tree,
4164        }
4165    }
4166}
4167
4168#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4169pub struct GetFrameTreeParams {}
4170
4171impl GetFrameTreeParams { pub const METHOD: &'static str = "Page.getFrameTree"; }
4172
4173impl<'a> crate::CdpCommand<'a> for GetFrameTreeParams {
4174    const METHOD: &'static str = "Page.getFrameTree";
4175    type Response = GetFrameTreeReturns<'a>;
4176}
4177
4178/// Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
4179
4180#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4181#[serde(rename_all = "camelCase")]
4182pub struct GetLayoutMetricsReturns {
4183    /// Deprecated metrics relating to the layout viewport. Is in device pixels. Use 'cssLayoutViewport' instead.
4184    #[serde(rename = "layoutViewport")]
4185    layout_viewport: LayoutViewport,
4186    /// Deprecated metrics relating to the visual viewport. Is in device pixels. Use 'cssVisualViewport' instead.
4187    #[serde(rename = "visualViewport")]
4188    visual_viewport: VisualViewport,
4189    /// Deprecated size of scrollable area. Is in DP. Use 'cssContentSize' instead.
4190    #[serde(rename = "contentSize")]
4191    content_size: crate::dom::Rect,
4192    /// Metrics relating to the layout viewport in CSS pixels.
4193    #[serde(rename = "cssLayoutViewport")]
4194    css_layout_viewport: LayoutViewport,
4195    /// Metrics relating to the visual viewport in CSS pixels.
4196    #[serde(rename = "cssVisualViewport")]
4197    css_visual_viewport: VisualViewport,
4198    /// Size of scrollable area in CSS pixels.
4199    #[serde(rename = "cssContentSize")]
4200    css_content_size: crate::dom::Rect,
4201}
4202
4203impl GetLayoutMetricsReturns {
4204    /// Creates a builder for this type with the required parameters:
4205    /// * `layout_viewport`: Deprecated metrics relating to the layout viewport. Is in device pixels. Use `cssLayoutViewport` instead.
4206    /// * `visual_viewport`: Deprecated metrics relating to the visual viewport. Is in device pixels. Use `cssVisualViewport` instead.
4207    /// * `content_size`: Deprecated size of scrollable area. Is in DP. Use `cssContentSize` instead.
4208    /// * `css_layout_viewport`: Metrics relating to the layout viewport in CSS pixels.
4209    /// * `css_visual_viewport`: Metrics relating to the visual viewport in CSS pixels.
4210    /// * `css_content_size`: Size of scrollable area in CSS pixels.
4211    pub fn builder(layout_viewport: LayoutViewport, visual_viewport: VisualViewport, content_size: crate::dom::Rect, css_layout_viewport: LayoutViewport, css_visual_viewport: VisualViewport, css_content_size: crate::dom::Rect) -> GetLayoutMetricsReturnsBuilder {
4212        GetLayoutMetricsReturnsBuilder {
4213            layout_viewport: layout_viewport,
4214            visual_viewport: visual_viewport,
4215            content_size: content_size,
4216            css_layout_viewport: css_layout_viewport,
4217            css_visual_viewport: css_visual_viewport,
4218            css_content_size: css_content_size,
4219        }
4220    }
4221    /// Deprecated metrics relating to the layout viewport. Is in device pixels. Use 'cssLayoutViewport' instead.
4222    pub fn layout_viewport(&self) -> &LayoutViewport { &self.layout_viewport }
4223    /// Deprecated metrics relating to the visual viewport. Is in device pixels. Use 'cssVisualViewport' instead.
4224    pub fn visual_viewport(&self) -> &VisualViewport { &self.visual_viewport }
4225    /// Deprecated size of scrollable area. Is in DP. Use 'cssContentSize' instead.
4226    pub fn content_size(&self) -> &crate::dom::Rect { &self.content_size }
4227    /// Metrics relating to the layout viewport in CSS pixels.
4228    pub fn css_layout_viewport(&self) -> &LayoutViewport { &self.css_layout_viewport }
4229    /// Metrics relating to the visual viewport in CSS pixels.
4230    pub fn css_visual_viewport(&self) -> &VisualViewport { &self.css_visual_viewport }
4231    /// Size of scrollable area in CSS pixels.
4232    pub fn css_content_size(&self) -> &crate::dom::Rect { &self.css_content_size }
4233}
4234
4235
4236pub struct GetLayoutMetricsReturnsBuilder {
4237    layout_viewport: LayoutViewport,
4238    visual_viewport: VisualViewport,
4239    content_size: crate::dom::Rect,
4240    css_layout_viewport: LayoutViewport,
4241    css_visual_viewport: VisualViewport,
4242    css_content_size: crate::dom::Rect,
4243}
4244
4245impl GetLayoutMetricsReturnsBuilder {
4246    pub fn build(self) -> GetLayoutMetricsReturns {
4247        GetLayoutMetricsReturns {
4248            layout_viewport: self.layout_viewport,
4249            visual_viewport: self.visual_viewport,
4250            content_size: self.content_size,
4251            css_layout_viewport: self.css_layout_viewport,
4252            css_visual_viewport: self.css_visual_viewport,
4253            css_content_size: self.css_content_size,
4254        }
4255    }
4256}
4257
4258#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4259pub struct GetLayoutMetricsParams {}
4260
4261impl GetLayoutMetricsParams { pub const METHOD: &'static str = "Page.getLayoutMetrics"; }
4262
4263impl<'a> crate::CdpCommand<'a> for GetLayoutMetricsParams {
4264    const METHOD: &'static str = "Page.getLayoutMetrics";
4265    type Response = GetLayoutMetricsReturns;
4266}
4267
4268/// Returns navigation history for the current page.
4269
4270#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4271#[serde(rename_all = "camelCase")]
4272pub struct GetNavigationHistoryReturns<'a> {
4273    /// Index of the current navigation history entry.
4274    #[serde(rename = "currentIndex")]
4275    current_index: u64,
4276    /// Array of navigation history entries.
4277    entries: Vec<NavigationEntry<'a>>,
4278}
4279
4280impl<'a> GetNavigationHistoryReturns<'a> {
4281    /// Creates a builder for this type with the required parameters:
4282    /// * `current_index`: Index of the current navigation history entry.
4283    /// * `entries`: Array of navigation history entries.
4284    pub fn builder(current_index: u64, entries: Vec<NavigationEntry<'a>>) -> GetNavigationHistoryReturnsBuilder<'a> {
4285        GetNavigationHistoryReturnsBuilder {
4286            current_index: current_index,
4287            entries: entries,
4288        }
4289    }
4290    /// Index of the current navigation history entry.
4291    pub fn current_index(&self) -> u64 { self.current_index }
4292    /// Array of navigation history entries.
4293    pub fn entries(&self) -> &[NavigationEntry<'a>] { &self.entries }
4294}
4295
4296
4297pub struct GetNavigationHistoryReturnsBuilder<'a> {
4298    current_index: u64,
4299    entries: Vec<NavigationEntry<'a>>,
4300}
4301
4302impl<'a> GetNavigationHistoryReturnsBuilder<'a> {
4303    pub fn build(self) -> GetNavigationHistoryReturns<'a> {
4304        GetNavigationHistoryReturns {
4305            current_index: self.current_index,
4306            entries: self.entries,
4307        }
4308    }
4309}
4310
4311#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4312pub struct GetNavigationHistoryParams {}
4313
4314impl GetNavigationHistoryParams { pub const METHOD: &'static str = "Page.getNavigationHistory"; }
4315
4316impl<'a> crate::CdpCommand<'a> for GetNavigationHistoryParams {
4317    const METHOD: &'static str = "Page.getNavigationHistory";
4318    type Response = GetNavigationHistoryReturns<'a>;
4319}
4320
4321#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4322pub struct ResetNavigationHistoryParams {}
4323
4324impl ResetNavigationHistoryParams { pub const METHOD: &'static str = "Page.resetNavigationHistory"; }
4325
4326impl<'a> crate::CdpCommand<'a> for ResetNavigationHistoryParams {
4327    const METHOD: &'static str = "Page.resetNavigationHistory";
4328    type Response = crate::EmptyReturns;
4329}
4330
4331/// Returns content of the given resource.
4332
4333#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4334#[serde(rename_all = "camelCase")]
4335pub struct GetResourceContentParams<'a> {
4336    /// Frame id to get resource for.
4337    #[serde(rename = "frameId")]
4338    frame_id: FrameId<'a>,
4339    /// URL of the resource to get content for.
4340    url: Cow<'a, str>,
4341}
4342
4343impl<'a> GetResourceContentParams<'a> {
4344    /// Creates a builder for this type with the required parameters:
4345    /// * `frame_id`: Frame id to get resource for.
4346    /// * `url`: URL of the resource to get content for.
4347    pub fn builder(frame_id: impl Into<FrameId<'a>>, url: impl Into<Cow<'a, str>>) -> GetResourceContentParamsBuilder<'a> {
4348        GetResourceContentParamsBuilder {
4349            frame_id: frame_id.into(),
4350            url: url.into(),
4351        }
4352    }
4353    /// Frame id to get resource for.
4354    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
4355    /// URL of the resource to get content for.
4356    pub fn url(&self) -> &str { self.url.as_ref() }
4357}
4358
4359
4360pub struct GetResourceContentParamsBuilder<'a> {
4361    frame_id: FrameId<'a>,
4362    url: Cow<'a, str>,
4363}
4364
4365impl<'a> GetResourceContentParamsBuilder<'a> {
4366    pub fn build(self) -> GetResourceContentParams<'a> {
4367        GetResourceContentParams {
4368            frame_id: self.frame_id,
4369            url: self.url,
4370        }
4371    }
4372}
4373
4374/// Returns content of the given resource.
4375
4376#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4377#[serde(rename_all = "camelCase")]
4378pub struct GetResourceContentReturns<'a> {
4379    /// Resource content.
4380    content: Cow<'a, str>,
4381    /// True, if content was served as base64.
4382    #[serde(rename = "base64Encoded")]
4383    base64_encoded: bool,
4384}
4385
4386impl<'a> GetResourceContentReturns<'a> {
4387    /// Creates a builder for this type with the required parameters:
4388    /// * `content`: Resource content.
4389    /// * `base64_encoded`: True, if content was served as base64.
4390    pub fn builder(content: impl Into<Cow<'a, str>>, base64_encoded: bool) -> GetResourceContentReturnsBuilder<'a> {
4391        GetResourceContentReturnsBuilder {
4392            content: content.into(),
4393            base64_encoded: base64_encoded,
4394        }
4395    }
4396    /// Resource content.
4397    pub fn content(&self) -> &str { self.content.as_ref() }
4398    /// True, if content was served as base64.
4399    pub fn base64_encoded(&self) -> bool { self.base64_encoded }
4400}
4401
4402
4403pub struct GetResourceContentReturnsBuilder<'a> {
4404    content: Cow<'a, str>,
4405    base64_encoded: bool,
4406}
4407
4408impl<'a> GetResourceContentReturnsBuilder<'a> {
4409    pub fn build(self) -> GetResourceContentReturns<'a> {
4410        GetResourceContentReturns {
4411            content: self.content,
4412            base64_encoded: self.base64_encoded,
4413        }
4414    }
4415}
4416
4417impl<'a> GetResourceContentParams<'a> { pub const METHOD: &'static str = "Page.getResourceContent"; }
4418
4419impl<'a> crate::CdpCommand<'a> for GetResourceContentParams<'a> {
4420    const METHOD: &'static str = "Page.getResourceContent";
4421    type Response = GetResourceContentReturns<'a>;
4422}
4423
4424/// Returns present frame / resource tree structure.
4425
4426#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4427#[serde(rename_all = "camelCase")]
4428pub struct GetResourceTreeReturns<'a> {
4429    /// Present frame / resource tree structure.
4430    #[serde(rename = "frameTree")]
4431    frame_tree: FrameResourceTree<'a>,
4432}
4433
4434impl<'a> GetResourceTreeReturns<'a> {
4435    /// Creates a builder for this type with the required parameters:
4436    /// * `frame_tree`: Present frame / resource tree structure.
4437    pub fn builder(frame_tree: FrameResourceTree<'a>) -> GetResourceTreeReturnsBuilder<'a> {
4438        GetResourceTreeReturnsBuilder {
4439            frame_tree: frame_tree,
4440        }
4441    }
4442    /// Present frame / resource tree structure.
4443    pub fn frame_tree(&self) -> &FrameResourceTree<'a> { &self.frame_tree }
4444}
4445
4446
4447pub struct GetResourceTreeReturnsBuilder<'a> {
4448    frame_tree: FrameResourceTree<'a>,
4449}
4450
4451impl<'a> GetResourceTreeReturnsBuilder<'a> {
4452    pub fn build(self) -> GetResourceTreeReturns<'a> {
4453        GetResourceTreeReturns {
4454            frame_tree: self.frame_tree,
4455        }
4456    }
4457}
4458
4459#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4460pub struct GetResourceTreeParams {}
4461
4462impl GetResourceTreeParams { pub const METHOD: &'static str = "Page.getResourceTree"; }
4463
4464impl<'a> crate::CdpCommand<'a> for GetResourceTreeParams {
4465    const METHOD: &'static str = "Page.getResourceTree";
4466    type Response = GetResourceTreeReturns<'a>;
4467}
4468
4469/// Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
4470
4471#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4472#[serde(rename_all = "camelCase")]
4473pub struct HandleJavaScriptDialogParams<'a> {
4474    /// Whether to accept or dismiss the dialog.
4475    accept: bool,
4476    /// The text to enter into the dialog prompt before accepting. Used only if this is a prompt
4477    /// dialog.
4478    #[serde(skip_serializing_if = "Option::is_none", rename = "promptText")]
4479    prompt_text: Option<Cow<'a, str>>,
4480}
4481
4482impl<'a> HandleJavaScriptDialogParams<'a> {
4483    /// Creates a builder for this type with the required parameters:
4484    /// * `accept`: Whether to accept or dismiss the dialog.
4485    pub fn builder(accept: bool) -> HandleJavaScriptDialogParamsBuilder<'a> {
4486        HandleJavaScriptDialogParamsBuilder {
4487            accept: accept,
4488            prompt_text: None,
4489        }
4490    }
4491    /// Whether to accept or dismiss the dialog.
4492    pub fn accept(&self) -> bool { self.accept }
4493    /// The text to enter into the dialog prompt before accepting. Used only if this is a prompt
4494    /// dialog.
4495    pub fn prompt_text(&self) -> Option<&str> { self.prompt_text.as_deref() }
4496}
4497
4498
4499pub struct HandleJavaScriptDialogParamsBuilder<'a> {
4500    accept: bool,
4501    prompt_text: Option<Cow<'a, str>>,
4502}
4503
4504impl<'a> HandleJavaScriptDialogParamsBuilder<'a> {
4505    /// The text to enter into the dialog prompt before accepting. Used only if this is a prompt
4506    /// dialog.
4507    pub fn prompt_text(mut self, prompt_text: impl Into<Cow<'a, str>>) -> Self { self.prompt_text = Some(prompt_text.into()); self }
4508    pub fn build(self) -> HandleJavaScriptDialogParams<'a> {
4509        HandleJavaScriptDialogParams {
4510            accept: self.accept,
4511            prompt_text: self.prompt_text,
4512        }
4513    }
4514}
4515
4516impl<'a> HandleJavaScriptDialogParams<'a> { pub const METHOD: &'static str = "Page.handleJavaScriptDialog"; }
4517
4518impl<'a> crate::CdpCommand<'a> for HandleJavaScriptDialogParams<'a> {
4519    const METHOD: &'static str = "Page.handleJavaScriptDialog";
4520    type Response = crate::EmptyReturns;
4521}
4522
4523/// Navigates current page to the given URL.
4524
4525#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4526#[serde(rename_all = "camelCase")]
4527pub struct NavigateParams<'a> {
4528    /// URL to navigate the page to.
4529    url: Cow<'a, str>,
4530    /// Referrer URL.
4531    #[serde(skip_serializing_if = "Option::is_none")]
4532    referrer: Option<Cow<'a, str>>,
4533    /// Intended transition type.
4534    #[serde(skip_serializing_if = "Option::is_none", rename = "transitionType")]
4535    transition_type: Option<TransitionType>,
4536    /// Frame id to navigate, if not specified navigates the top frame.
4537    #[serde(skip_serializing_if = "Option::is_none", rename = "frameId")]
4538    frame_id: Option<FrameId<'a>>,
4539    /// Referrer-policy used for the navigation.
4540    #[serde(skip_serializing_if = "Option::is_none", rename = "referrerPolicy")]
4541    referrer_policy: Option<ReferrerPolicy>,
4542}
4543
4544impl<'a> NavigateParams<'a> {
4545    /// Creates a builder for this type with the required parameters:
4546    /// * `url`: URL to navigate the page to.
4547    pub fn builder(url: impl Into<Cow<'a, str>>) -> NavigateParamsBuilder<'a> {
4548        NavigateParamsBuilder {
4549            url: url.into(),
4550            referrer: None,
4551            transition_type: None,
4552            frame_id: None,
4553            referrer_policy: None,
4554        }
4555    }
4556    /// URL to navigate the page to.
4557    pub fn url(&self) -> &str { self.url.as_ref() }
4558    /// Referrer URL.
4559    pub fn referrer(&self) -> Option<&str> { self.referrer.as_deref() }
4560    /// Intended transition type.
4561    pub fn transition_type(&self) -> Option<&TransitionType> { self.transition_type.as_ref() }
4562    /// Frame id to navigate, if not specified navigates the top frame.
4563    pub fn frame_id(&self) -> Option<&FrameId<'a>> { self.frame_id.as_ref() }
4564    /// Referrer-policy used for the navigation.
4565    pub fn referrer_policy(&self) -> Option<&ReferrerPolicy> { self.referrer_policy.as_ref() }
4566}
4567
4568
4569pub struct NavigateParamsBuilder<'a> {
4570    url: Cow<'a, str>,
4571    referrer: Option<Cow<'a, str>>,
4572    transition_type: Option<TransitionType>,
4573    frame_id: Option<FrameId<'a>>,
4574    referrer_policy: Option<ReferrerPolicy>,
4575}
4576
4577impl<'a> NavigateParamsBuilder<'a> {
4578    /// Referrer URL.
4579    pub fn referrer(mut self, referrer: impl Into<Cow<'a, str>>) -> Self { self.referrer = Some(referrer.into()); self }
4580    /// Intended transition type.
4581    pub fn transition_type(mut self, transition_type: impl Into<TransitionType>) -> Self { self.transition_type = Some(transition_type.into()); self }
4582    /// Frame id to navigate, if not specified navigates the top frame.
4583    pub fn frame_id(mut self, frame_id: impl Into<FrameId<'a>>) -> Self { self.frame_id = Some(frame_id.into()); self }
4584    /// Referrer-policy used for the navigation.
4585    pub fn referrer_policy(mut self, referrer_policy: impl Into<ReferrerPolicy>) -> Self { self.referrer_policy = Some(referrer_policy.into()); self }
4586    pub fn build(self) -> NavigateParams<'a> {
4587        NavigateParams {
4588            url: self.url,
4589            referrer: self.referrer,
4590            transition_type: self.transition_type,
4591            frame_id: self.frame_id,
4592            referrer_policy: self.referrer_policy,
4593        }
4594    }
4595}
4596
4597/// Navigates current page to the given URL.
4598
4599#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4600#[serde(rename_all = "camelCase")]
4601pub struct NavigateReturns<'a> {
4602    /// Frame id that has navigated (or failed to navigate)
4603    #[serde(rename = "frameId")]
4604    frame_id: FrameId<'a>,
4605    /// Loader identifier. This is omitted in case of same-document navigation,
4606    /// as the previously committed loaderId would not change.
4607    #[serde(skip_serializing_if = "Option::is_none", rename = "loaderId")]
4608    loader_id: Option<crate::network::LoaderId<'a>>,
4609    /// User friendly error message, present if and only if navigation has failed.
4610    #[serde(skip_serializing_if = "Option::is_none", rename = "errorText")]
4611    error_text: Option<Cow<'a, str>>,
4612    /// Whether the navigation resulted in a download.
4613    #[serde(skip_serializing_if = "Option::is_none", rename = "isDownload")]
4614    is_download: Option<bool>,
4615}
4616
4617impl<'a> NavigateReturns<'a> {
4618    /// Creates a builder for this type with the required parameters:
4619    /// * `frame_id`: Frame id that has navigated (or failed to navigate)
4620    pub fn builder(frame_id: impl Into<FrameId<'a>>) -> NavigateReturnsBuilder<'a> {
4621        NavigateReturnsBuilder {
4622            frame_id: frame_id.into(),
4623            loader_id: None,
4624            error_text: None,
4625            is_download: None,
4626        }
4627    }
4628    /// Frame id that has navigated (or failed to navigate)
4629    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
4630    /// Loader identifier. This is omitted in case of same-document navigation,
4631    /// as the previously committed loaderId would not change.
4632    pub fn loader_id(&self) -> Option<&crate::network::LoaderId<'a>> { self.loader_id.as_ref() }
4633    /// User friendly error message, present if and only if navigation has failed.
4634    pub fn error_text(&self) -> Option<&str> { self.error_text.as_deref() }
4635    /// Whether the navigation resulted in a download.
4636    pub fn is_download(&self) -> Option<bool> { self.is_download }
4637}
4638
4639
4640pub struct NavigateReturnsBuilder<'a> {
4641    frame_id: FrameId<'a>,
4642    loader_id: Option<crate::network::LoaderId<'a>>,
4643    error_text: Option<Cow<'a, str>>,
4644    is_download: Option<bool>,
4645}
4646
4647impl<'a> NavigateReturnsBuilder<'a> {
4648    /// Loader identifier. This is omitted in case of same-document navigation,
4649    /// as the previously committed loaderId would not change.
4650    pub fn loader_id(mut self, loader_id: crate::network::LoaderId<'a>) -> Self { self.loader_id = Some(loader_id); self }
4651    /// User friendly error message, present if and only if navigation has failed.
4652    pub fn error_text(mut self, error_text: impl Into<Cow<'a, str>>) -> Self { self.error_text = Some(error_text.into()); self }
4653    /// Whether the navigation resulted in a download.
4654    pub fn is_download(mut self, is_download: bool) -> Self { self.is_download = Some(is_download); self }
4655    pub fn build(self) -> NavigateReturns<'a> {
4656        NavigateReturns {
4657            frame_id: self.frame_id,
4658            loader_id: self.loader_id,
4659            error_text: self.error_text,
4660            is_download: self.is_download,
4661        }
4662    }
4663}
4664
4665impl<'a> NavigateParams<'a> { pub const METHOD: &'static str = "Page.navigate"; }
4666
4667impl<'a> crate::CdpCommand<'a> for NavigateParams<'a> {
4668    const METHOD: &'static str = "Page.navigate";
4669    type Response = NavigateReturns<'a>;
4670}
4671
4672/// Navigates current page to the given history entry.
4673
4674#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4675#[serde(rename_all = "camelCase")]
4676pub struct NavigateToHistoryEntryParams {
4677    /// Unique id of the entry to navigate to.
4678    #[serde(rename = "entryId")]
4679    entry_id: u64,
4680}
4681
4682impl NavigateToHistoryEntryParams {
4683    /// Creates a builder for this type with the required parameters:
4684    /// * `entry_id`: Unique id of the entry to navigate to.
4685    pub fn builder(entry_id: u64) -> NavigateToHistoryEntryParamsBuilder {
4686        NavigateToHistoryEntryParamsBuilder {
4687            entry_id: entry_id,
4688        }
4689    }
4690    /// Unique id of the entry to navigate to.
4691    pub fn entry_id(&self) -> u64 { self.entry_id }
4692}
4693
4694
4695pub struct NavigateToHistoryEntryParamsBuilder {
4696    entry_id: u64,
4697}
4698
4699impl NavigateToHistoryEntryParamsBuilder {
4700    pub fn build(self) -> NavigateToHistoryEntryParams {
4701        NavigateToHistoryEntryParams {
4702            entry_id: self.entry_id,
4703        }
4704    }
4705}
4706
4707impl NavigateToHistoryEntryParams { pub const METHOD: &'static str = "Page.navigateToHistoryEntry"; }
4708
4709impl<'a> crate::CdpCommand<'a> for NavigateToHistoryEntryParams {
4710    const METHOD: &'static str = "Page.navigateToHistoryEntry";
4711    type Response = crate::EmptyReturns;
4712}
4713
4714/// Print page as PDF.
4715
4716#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4717#[serde(rename_all = "camelCase")]
4718pub struct PrintToPDFParams<'a> {
4719    /// Paper orientation. Defaults to false.
4720    #[serde(skip_serializing_if = "Option::is_none")]
4721    landscape: Option<bool>,
4722    /// Display header and footer. Defaults to false.
4723    #[serde(skip_serializing_if = "Option::is_none", rename = "displayHeaderFooter")]
4724    display_header_footer: Option<bool>,
4725    /// Print background graphics. Defaults to false.
4726    #[serde(skip_serializing_if = "Option::is_none", rename = "printBackground")]
4727    print_background: Option<bool>,
4728    /// Scale of the webpage rendering. Defaults to 1.
4729    #[serde(skip_serializing_if = "Option::is_none")]
4730    scale: Option<f64>,
4731    /// Paper width in inches. Defaults to 8.5 inches.
4732    #[serde(skip_serializing_if = "Option::is_none", rename = "paperWidth")]
4733    paper_width: Option<f64>,
4734    /// Paper height in inches. Defaults to 11 inches.
4735    #[serde(skip_serializing_if = "Option::is_none", rename = "paperHeight")]
4736    paper_height: Option<f64>,
4737    /// Top margin in inches. Defaults to 1cm (~0.4 inches).
4738    #[serde(skip_serializing_if = "Option::is_none", rename = "marginTop")]
4739    margin_top: Option<f64>,
4740    /// Bottom margin in inches. Defaults to 1cm (~0.4 inches).
4741    #[serde(skip_serializing_if = "Option::is_none", rename = "marginBottom")]
4742    margin_bottom: Option<f64>,
4743    /// Left margin in inches. Defaults to 1cm (~0.4 inches).
4744    #[serde(skip_serializing_if = "Option::is_none", rename = "marginLeft")]
4745    margin_left: Option<f64>,
4746    /// Right margin in inches. Defaults to 1cm (~0.4 inches).
4747    #[serde(skip_serializing_if = "Option::is_none", rename = "marginRight")]
4748    margin_right: Option<f64>,
4749    /// Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are
4750    /// printed in the document order, not in the order specified, and no
4751    /// more than once.
4752    /// Defaults to empty string, which implies the entire document is printed.
4753    /// The page numbers are quietly capped to actual page count of the
4754    /// document, and ranges beyond the end of the document are ignored.
4755    /// If this results in no pages to print, an error is reported.
4756    /// It is an error to specify a range with start greater than end.
4757    #[serde(skip_serializing_if = "Option::is_none", rename = "pageRanges")]
4758    page_ranges: Option<Cow<'a, str>>,
4759    /// HTML template for the print header. Should be valid HTML markup with following
4760    /// classes used to inject printing values into them:
4761    /// - 'date': formatted print date
4762    /// - 'title': document title
4763    /// - 'url': document location
4764    /// - 'pageNumber': current page number
4765    /// - 'totalPages': total pages in the document
4766    /// 
4767    /// For example, '\<span class=title\>\</span\>' would generate span containing the title.
4768    #[serde(skip_serializing_if = "Option::is_none", rename = "headerTemplate")]
4769    header_template: Option<Cow<'a, str>>,
4770    /// HTML template for the print footer. Should use the same format as the 'headerTemplate'.
4771    #[serde(skip_serializing_if = "Option::is_none", rename = "footerTemplate")]
4772    footer_template: Option<Cow<'a, str>>,
4773    /// Whether or not to prefer page size as defined by css. Defaults to false,
4774    /// in which case the content will be scaled to fit the paper size.
4775    #[serde(skip_serializing_if = "Option::is_none", rename = "preferCSSPageSize")]
4776    prefer_css_page_size: Option<bool>,
4777    /// return as stream
4778    #[serde(skip_serializing_if = "Option::is_none", rename = "transferMode")]
4779    transfer_mode: Option<Cow<'a, str>>,
4780    /// Whether or not to generate tagged (accessible) PDF. Defaults to embedder choice.
4781    #[serde(skip_serializing_if = "Option::is_none", rename = "generateTaggedPDF")]
4782    generate_tagged_pdf: Option<bool>,
4783    /// Whether or not to embed the document outline into the PDF.
4784    #[serde(skip_serializing_if = "Option::is_none", rename = "generateDocumentOutline")]
4785    generate_document_outline: Option<bool>,
4786}
4787
4788impl<'a> PrintToPDFParams<'a> {
4789    /// Creates a builder for this type.
4790    pub fn builder() -> PrintToPDFParamsBuilder<'a> {
4791        PrintToPDFParamsBuilder {
4792            landscape: None,
4793            display_header_footer: None,
4794            print_background: None,
4795            scale: None,
4796            paper_width: None,
4797            paper_height: None,
4798            margin_top: None,
4799            margin_bottom: None,
4800            margin_left: None,
4801            margin_right: None,
4802            page_ranges: None,
4803            header_template: None,
4804            footer_template: None,
4805            prefer_css_page_size: None,
4806            transfer_mode: None,
4807            generate_tagged_pdf: None,
4808            generate_document_outline: None,
4809        }
4810    }
4811    /// Paper orientation. Defaults to false.
4812    pub fn landscape(&self) -> Option<bool> { self.landscape }
4813    /// Display header and footer. Defaults to false.
4814    pub fn display_header_footer(&self) -> Option<bool> { self.display_header_footer }
4815    /// Print background graphics. Defaults to false.
4816    pub fn print_background(&self) -> Option<bool> { self.print_background }
4817    /// Scale of the webpage rendering. Defaults to 1.
4818    pub fn scale(&self) -> Option<f64> { self.scale }
4819    /// Paper width in inches. Defaults to 8.5 inches.
4820    pub fn paper_width(&self) -> Option<f64> { self.paper_width }
4821    /// Paper height in inches. Defaults to 11 inches.
4822    pub fn paper_height(&self) -> Option<f64> { self.paper_height }
4823    /// Top margin in inches. Defaults to 1cm (~0.4 inches).
4824    pub fn margin_top(&self) -> Option<f64> { self.margin_top }
4825    /// Bottom margin in inches. Defaults to 1cm (~0.4 inches).
4826    pub fn margin_bottom(&self) -> Option<f64> { self.margin_bottom }
4827    /// Left margin in inches. Defaults to 1cm (~0.4 inches).
4828    pub fn margin_left(&self) -> Option<f64> { self.margin_left }
4829    /// Right margin in inches. Defaults to 1cm (~0.4 inches).
4830    pub fn margin_right(&self) -> Option<f64> { self.margin_right }
4831    /// Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are
4832    /// printed in the document order, not in the order specified, and no
4833    /// more than once.
4834    /// Defaults to empty string, which implies the entire document is printed.
4835    /// The page numbers are quietly capped to actual page count of the
4836    /// document, and ranges beyond the end of the document are ignored.
4837    /// If this results in no pages to print, an error is reported.
4838    /// It is an error to specify a range with start greater than end.
4839    pub fn page_ranges(&self) -> Option<&str> { self.page_ranges.as_deref() }
4840    /// HTML template for the print header. Should be valid HTML markup with following
4841    /// classes used to inject printing values into them:
4842    /// - 'date': formatted print date
4843    /// - 'title': document title
4844    /// - 'url': document location
4845    /// - 'pageNumber': current page number
4846    /// - 'totalPages': total pages in the document
4847    /// 
4848    /// For example, '\<span class=title\>\</span\>' would generate span containing the title.
4849    pub fn header_template(&self) -> Option<&str> { self.header_template.as_deref() }
4850    /// HTML template for the print footer. Should use the same format as the 'headerTemplate'.
4851    pub fn footer_template(&self) -> Option<&str> { self.footer_template.as_deref() }
4852    /// Whether or not to prefer page size as defined by css. Defaults to false,
4853    /// in which case the content will be scaled to fit the paper size.
4854    pub fn prefer_css_page_size(&self) -> Option<bool> { self.prefer_css_page_size }
4855    /// return as stream
4856    pub fn transfer_mode(&self) -> Option<&str> { self.transfer_mode.as_deref() }
4857    /// Whether or not to generate tagged (accessible) PDF. Defaults to embedder choice.
4858    pub fn generate_tagged_pdf(&self) -> Option<bool> { self.generate_tagged_pdf }
4859    /// Whether or not to embed the document outline into the PDF.
4860    pub fn generate_document_outline(&self) -> Option<bool> { self.generate_document_outline }
4861}
4862
4863#[derive(Default)]
4864pub struct PrintToPDFParamsBuilder<'a> {
4865    landscape: Option<bool>,
4866    display_header_footer: Option<bool>,
4867    print_background: Option<bool>,
4868    scale: Option<f64>,
4869    paper_width: Option<f64>,
4870    paper_height: Option<f64>,
4871    margin_top: Option<f64>,
4872    margin_bottom: Option<f64>,
4873    margin_left: Option<f64>,
4874    margin_right: Option<f64>,
4875    page_ranges: Option<Cow<'a, str>>,
4876    header_template: Option<Cow<'a, str>>,
4877    footer_template: Option<Cow<'a, str>>,
4878    prefer_css_page_size: Option<bool>,
4879    transfer_mode: Option<Cow<'a, str>>,
4880    generate_tagged_pdf: Option<bool>,
4881    generate_document_outline: Option<bool>,
4882}
4883
4884impl<'a> PrintToPDFParamsBuilder<'a> {
4885    /// Paper orientation. Defaults to false.
4886    pub fn landscape(mut self, landscape: bool) -> Self { self.landscape = Some(landscape); self }
4887    /// Display header and footer. Defaults to false.
4888    pub fn display_header_footer(mut self, display_header_footer: bool) -> Self { self.display_header_footer = Some(display_header_footer); self }
4889    /// Print background graphics. Defaults to false.
4890    pub fn print_background(mut self, print_background: bool) -> Self { self.print_background = Some(print_background); self }
4891    /// Scale of the webpage rendering. Defaults to 1.
4892    pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
4893    /// Paper width in inches. Defaults to 8.5 inches.
4894    pub fn paper_width(mut self, paper_width: f64) -> Self { self.paper_width = Some(paper_width); self }
4895    /// Paper height in inches. Defaults to 11 inches.
4896    pub fn paper_height(mut self, paper_height: f64) -> Self { self.paper_height = Some(paper_height); self }
4897    /// Top margin in inches. Defaults to 1cm (~0.4 inches).
4898    pub fn margin_top(mut self, margin_top: f64) -> Self { self.margin_top = Some(margin_top); self }
4899    /// Bottom margin in inches. Defaults to 1cm (~0.4 inches).
4900    pub fn margin_bottom(mut self, margin_bottom: f64) -> Self { self.margin_bottom = Some(margin_bottom); self }
4901    /// Left margin in inches. Defaults to 1cm (~0.4 inches).
4902    pub fn margin_left(mut self, margin_left: f64) -> Self { self.margin_left = Some(margin_left); self }
4903    /// Right margin in inches. Defaults to 1cm (~0.4 inches).
4904    pub fn margin_right(mut self, margin_right: f64) -> Self { self.margin_right = Some(margin_right); self }
4905    /// Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are
4906    /// printed in the document order, not in the order specified, and no
4907    /// more than once.
4908    /// Defaults to empty string, which implies the entire document is printed.
4909    /// The page numbers are quietly capped to actual page count of the
4910    /// document, and ranges beyond the end of the document are ignored.
4911    /// If this results in no pages to print, an error is reported.
4912    /// It is an error to specify a range with start greater than end.
4913    pub fn page_ranges(mut self, page_ranges: impl Into<Cow<'a, str>>) -> Self { self.page_ranges = Some(page_ranges.into()); self }
4914    /// HTML template for the print header. Should be valid HTML markup with following
4915    /// classes used to inject printing values into them:
4916    /// - 'date': formatted print date
4917    /// - 'title': document title
4918    /// - 'url': document location
4919    /// - 'pageNumber': current page number
4920    /// - 'totalPages': total pages in the document
4921    /// 
4922    /// For example, '\<span class=title\>\</span\>' would generate span containing the title.
4923    pub fn header_template(mut self, header_template: impl Into<Cow<'a, str>>) -> Self { self.header_template = Some(header_template.into()); self }
4924    /// HTML template for the print footer. Should use the same format as the 'headerTemplate'.
4925    pub fn footer_template(mut self, footer_template: impl Into<Cow<'a, str>>) -> Self { self.footer_template = Some(footer_template.into()); self }
4926    /// Whether or not to prefer page size as defined by css. Defaults to false,
4927    /// in which case the content will be scaled to fit the paper size.
4928    pub fn prefer_css_page_size(mut self, prefer_css_page_size: bool) -> Self { self.prefer_css_page_size = Some(prefer_css_page_size); self }
4929    /// return as stream
4930    pub fn transfer_mode(mut self, transfer_mode: impl Into<Cow<'a, str>>) -> Self { self.transfer_mode = Some(transfer_mode.into()); self }
4931    /// Whether or not to generate tagged (accessible) PDF. Defaults to embedder choice.
4932    pub fn generate_tagged_pdf(mut self, generate_tagged_pdf: bool) -> Self { self.generate_tagged_pdf = Some(generate_tagged_pdf); self }
4933    /// Whether or not to embed the document outline into the PDF.
4934    pub fn generate_document_outline(mut self, generate_document_outline: bool) -> Self { self.generate_document_outline = Some(generate_document_outline); self }
4935    pub fn build(self) -> PrintToPDFParams<'a> {
4936        PrintToPDFParams {
4937            landscape: self.landscape,
4938            display_header_footer: self.display_header_footer,
4939            print_background: self.print_background,
4940            scale: self.scale,
4941            paper_width: self.paper_width,
4942            paper_height: self.paper_height,
4943            margin_top: self.margin_top,
4944            margin_bottom: self.margin_bottom,
4945            margin_left: self.margin_left,
4946            margin_right: self.margin_right,
4947            page_ranges: self.page_ranges,
4948            header_template: self.header_template,
4949            footer_template: self.footer_template,
4950            prefer_css_page_size: self.prefer_css_page_size,
4951            transfer_mode: self.transfer_mode,
4952            generate_tagged_pdf: self.generate_tagged_pdf,
4953            generate_document_outline: self.generate_document_outline,
4954        }
4955    }
4956}
4957
4958/// Print page as PDF.
4959
4960#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4961#[serde(rename_all = "camelCase")]
4962pub struct PrintToPDFReturns<'a> {
4963    /// Base64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON)
4964    data: Cow<'a, str>,
4965    /// A handle of the stream that holds resulting PDF data.
4966    #[serde(skip_serializing_if = "Option::is_none")]
4967    stream: Option<crate::io::StreamHandle<'a>>,
4968}
4969
4970impl<'a> PrintToPDFReturns<'a> {
4971    /// Creates a builder for this type with the required parameters:
4972    /// * `data`: Base64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON)
4973    pub fn builder(data: impl Into<Cow<'a, str>>) -> PrintToPDFReturnsBuilder<'a> {
4974        PrintToPDFReturnsBuilder {
4975            data: data.into(),
4976            stream: None,
4977        }
4978    }
4979    /// Base64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON)
4980    pub fn data(&self) -> &str { self.data.as_ref() }
4981    /// A handle of the stream that holds resulting PDF data.
4982    pub fn stream(&self) -> Option<&crate::io::StreamHandle<'a>> { self.stream.as_ref() }
4983}
4984
4985
4986pub struct PrintToPDFReturnsBuilder<'a> {
4987    data: Cow<'a, str>,
4988    stream: Option<crate::io::StreamHandle<'a>>,
4989}
4990
4991impl<'a> PrintToPDFReturnsBuilder<'a> {
4992    /// A handle of the stream that holds resulting PDF data.
4993    pub fn stream(mut self, stream: crate::io::StreamHandle<'a>) -> Self { self.stream = Some(stream); self }
4994    pub fn build(self) -> PrintToPDFReturns<'a> {
4995        PrintToPDFReturns {
4996            data: self.data,
4997            stream: self.stream,
4998        }
4999    }
5000}
5001
5002impl<'a> PrintToPDFParams<'a> { pub const METHOD: &'static str = "Page.printToPDF"; }
5003
5004impl<'a> crate::CdpCommand<'a> for PrintToPDFParams<'a> {
5005    const METHOD: &'static str = "Page.printToPDF";
5006    type Response = PrintToPDFReturns<'a>;
5007}
5008
5009/// Reloads given page optionally ignoring the cache.
5010
5011#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5012#[serde(rename_all = "camelCase")]
5013pub struct ReloadParams<'a> {
5014    /// If true, browser cache is ignored (as if the user pressed Shift+refresh).
5015    #[serde(skip_serializing_if = "Option::is_none", rename = "ignoreCache")]
5016    ignore_cache: Option<bool>,
5017    /// If set, the script will be injected into all frames of the inspected page after reload.
5018    /// Argument will be ignored if reloading dataURL origin.
5019    #[serde(skip_serializing_if = "Option::is_none", rename = "scriptToEvaluateOnLoad")]
5020    script_to_evaluate_on_load: Option<Cow<'a, str>>,
5021    /// If set, an error will be thrown if the target page's main frame's
5022    /// loader id does not match the provided id. This prevents accidentally
5023    /// reloading an unintended target in case there's a racing navigation.
5024    #[serde(skip_serializing_if = "Option::is_none", rename = "loaderId")]
5025    loader_id: Option<crate::network::LoaderId<'a>>,
5026}
5027
5028impl<'a> ReloadParams<'a> {
5029    /// Creates a builder for this type.
5030    pub fn builder() -> ReloadParamsBuilder<'a> {
5031        ReloadParamsBuilder {
5032            ignore_cache: None,
5033            script_to_evaluate_on_load: None,
5034            loader_id: None,
5035        }
5036    }
5037    /// If true, browser cache is ignored (as if the user pressed Shift+refresh).
5038    pub fn ignore_cache(&self) -> Option<bool> { self.ignore_cache }
5039    /// If set, the script will be injected into all frames of the inspected page after reload.
5040    /// Argument will be ignored if reloading dataURL origin.
5041    pub fn script_to_evaluate_on_load(&self) -> Option<&str> { self.script_to_evaluate_on_load.as_deref() }
5042    /// If set, an error will be thrown if the target page's main frame's
5043    /// loader id does not match the provided id. This prevents accidentally
5044    /// reloading an unintended target in case there's a racing navigation.
5045    pub fn loader_id(&self) -> Option<&crate::network::LoaderId<'a>> { self.loader_id.as_ref() }
5046}
5047
5048#[derive(Default)]
5049pub struct ReloadParamsBuilder<'a> {
5050    ignore_cache: Option<bool>,
5051    script_to_evaluate_on_load: Option<Cow<'a, str>>,
5052    loader_id: Option<crate::network::LoaderId<'a>>,
5053}
5054
5055impl<'a> ReloadParamsBuilder<'a> {
5056    /// If true, browser cache is ignored (as if the user pressed Shift+refresh).
5057    pub fn ignore_cache(mut self, ignore_cache: bool) -> Self { self.ignore_cache = Some(ignore_cache); self }
5058    /// If set, the script will be injected into all frames of the inspected page after reload.
5059    /// Argument will be ignored if reloading dataURL origin.
5060    pub fn script_to_evaluate_on_load(mut self, script_to_evaluate_on_load: impl Into<Cow<'a, str>>) -> Self { self.script_to_evaluate_on_load = Some(script_to_evaluate_on_load.into()); self }
5061    /// If set, an error will be thrown if the target page's main frame's
5062    /// loader id does not match the provided id. This prevents accidentally
5063    /// reloading an unintended target in case there's a racing navigation.
5064    pub fn loader_id(mut self, loader_id: crate::network::LoaderId<'a>) -> Self { self.loader_id = Some(loader_id); self }
5065    pub fn build(self) -> ReloadParams<'a> {
5066        ReloadParams {
5067            ignore_cache: self.ignore_cache,
5068            script_to_evaluate_on_load: self.script_to_evaluate_on_load,
5069            loader_id: self.loader_id,
5070        }
5071    }
5072}
5073
5074impl<'a> ReloadParams<'a> { pub const METHOD: &'static str = "Page.reload"; }
5075
5076impl<'a> crate::CdpCommand<'a> for ReloadParams<'a> {
5077    const METHOD: &'static str = "Page.reload";
5078    type Response = crate::EmptyReturns;
5079}
5080
5081/// Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
5082
5083#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5084#[serde(rename_all = "camelCase")]
5085pub struct RemoveScriptToEvaluateOnLoadParams<'a> {
5086    identifier: ScriptIdentifier<'a>,
5087}
5088
5089impl<'a> RemoveScriptToEvaluateOnLoadParams<'a> {
5090    /// Creates a builder for this type with the required parameters:
5091    /// * `identifier`: 
5092    pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> RemoveScriptToEvaluateOnLoadParamsBuilder<'a> {
5093        RemoveScriptToEvaluateOnLoadParamsBuilder {
5094            identifier: identifier.into(),
5095        }
5096    }
5097    pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
5098}
5099
5100
5101pub struct RemoveScriptToEvaluateOnLoadParamsBuilder<'a> {
5102    identifier: ScriptIdentifier<'a>,
5103}
5104
5105impl<'a> RemoveScriptToEvaluateOnLoadParamsBuilder<'a> {
5106    pub fn build(self) -> RemoveScriptToEvaluateOnLoadParams<'a> {
5107        RemoveScriptToEvaluateOnLoadParams {
5108            identifier: self.identifier,
5109        }
5110    }
5111}
5112
5113impl<'a> RemoveScriptToEvaluateOnLoadParams<'a> { pub const METHOD: &'static str = "Page.removeScriptToEvaluateOnLoad"; }
5114
5115impl<'a> crate::CdpCommand<'a> for RemoveScriptToEvaluateOnLoadParams<'a> {
5116    const METHOD: &'static str = "Page.removeScriptToEvaluateOnLoad";
5117    type Response = crate::EmptyReturns;
5118}
5119
5120/// Removes given script from the list.
5121
5122#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5123#[serde(rename_all = "camelCase")]
5124pub struct RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5125    identifier: ScriptIdentifier<'a>,
5126}
5127
5128impl<'a> RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5129    /// Creates a builder for this type with the required parameters:
5130    /// * `identifier`: 
5131    pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> RemoveScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
5132        RemoveScriptToEvaluateOnNewDocumentParamsBuilder {
5133            identifier: identifier.into(),
5134        }
5135    }
5136    pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
5137}
5138
5139
5140pub struct RemoveScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
5141    identifier: ScriptIdentifier<'a>,
5142}
5143
5144impl<'a> RemoveScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
5145    pub fn build(self) -> RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5146        RemoveScriptToEvaluateOnNewDocumentParams {
5147            identifier: self.identifier,
5148        }
5149    }
5150}
5151
5152impl<'a> RemoveScriptToEvaluateOnNewDocumentParams<'a> { pub const METHOD: &'static str = "Page.removeScriptToEvaluateOnNewDocument"; }
5153
5154impl<'a> crate::CdpCommand<'a> for RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5155    const METHOD: &'static str = "Page.removeScriptToEvaluateOnNewDocument";
5156    type Response = crate::EmptyReturns;
5157}
5158
5159/// Acknowledges that a screencast frame has been received by the frontend.
5160
5161#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5162#[serde(rename_all = "camelCase")]
5163pub struct ScreencastFrameAckParams {
5164    /// Frame number.
5165    #[serde(rename = "sessionId")]
5166    session_id: u64,
5167}
5168
5169impl ScreencastFrameAckParams {
5170    /// Creates a builder for this type with the required parameters:
5171    /// * `session_id`: Frame number.
5172    pub fn builder(session_id: u64) -> ScreencastFrameAckParamsBuilder {
5173        ScreencastFrameAckParamsBuilder {
5174            session_id: session_id,
5175        }
5176    }
5177    /// Frame number.
5178    pub fn session_id(&self) -> u64 { self.session_id }
5179}
5180
5181
5182pub struct ScreencastFrameAckParamsBuilder {
5183    session_id: u64,
5184}
5185
5186impl ScreencastFrameAckParamsBuilder {
5187    pub fn build(self) -> ScreencastFrameAckParams {
5188        ScreencastFrameAckParams {
5189            session_id: self.session_id,
5190        }
5191    }
5192}
5193
5194impl ScreencastFrameAckParams { pub const METHOD: &'static str = "Page.screencastFrameAck"; }
5195
5196impl<'a> crate::CdpCommand<'a> for ScreencastFrameAckParams {
5197    const METHOD: &'static str = "Page.screencastFrameAck";
5198    type Response = crate::EmptyReturns;
5199}
5200
5201/// Searches for given string in resource content.
5202
5203#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5204#[serde(rename_all = "camelCase")]
5205pub struct SearchInResourceParams<'a> {
5206    /// Frame id for resource to search in.
5207    #[serde(rename = "frameId")]
5208    frame_id: FrameId<'a>,
5209    /// URL of the resource to search in.
5210    url: Cow<'a, str>,
5211    /// String to search for.
5212    query: Cow<'a, str>,
5213    /// If true, search is case sensitive.
5214    #[serde(skip_serializing_if = "Option::is_none", rename = "caseSensitive")]
5215    case_sensitive: Option<bool>,
5216    /// If true, treats string parameter as regex.
5217    #[serde(skip_serializing_if = "Option::is_none", rename = "isRegex")]
5218    is_regex: Option<bool>,
5219}
5220
5221impl<'a> SearchInResourceParams<'a> {
5222    /// Creates a builder for this type with the required parameters:
5223    /// * `frame_id`: Frame id for resource to search in.
5224    /// * `url`: URL of the resource to search in.
5225    /// * `query`: String to search for.
5226    pub fn builder(frame_id: impl Into<FrameId<'a>>, url: impl Into<Cow<'a, str>>, query: impl Into<Cow<'a, str>>) -> SearchInResourceParamsBuilder<'a> {
5227        SearchInResourceParamsBuilder {
5228            frame_id: frame_id.into(),
5229            url: url.into(),
5230            query: query.into(),
5231            case_sensitive: None,
5232            is_regex: None,
5233        }
5234    }
5235    /// Frame id for resource to search in.
5236    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5237    /// URL of the resource to search in.
5238    pub fn url(&self) -> &str { self.url.as_ref() }
5239    /// String to search for.
5240    pub fn query(&self) -> &str { self.query.as_ref() }
5241    /// If true, search is case sensitive.
5242    pub fn case_sensitive(&self) -> Option<bool> { self.case_sensitive }
5243    /// If true, treats string parameter as regex.
5244    pub fn is_regex(&self) -> Option<bool> { self.is_regex }
5245}
5246
5247
5248pub struct SearchInResourceParamsBuilder<'a> {
5249    frame_id: FrameId<'a>,
5250    url: Cow<'a, str>,
5251    query: Cow<'a, str>,
5252    case_sensitive: Option<bool>,
5253    is_regex: Option<bool>,
5254}
5255
5256impl<'a> SearchInResourceParamsBuilder<'a> {
5257    /// If true, search is case sensitive.
5258    pub fn case_sensitive(mut self, case_sensitive: bool) -> Self { self.case_sensitive = Some(case_sensitive); self }
5259    /// If true, treats string parameter as regex.
5260    pub fn is_regex(mut self, is_regex: bool) -> Self { self.is_regex = Some(is_regex); self }
5261    pub fn build(self) -> SearchInResourceParams<'a> {
5262        SearchInResourceParams {
5263            frame_id: self.frame_id,
5264            url: self.url,
5265            query: self.query,
5266            case_sensitive: self.case_sensitive,
5267            is_regex: self.is_regex,
5268        }
5269    }
5270}
5271
5272/// Searches for given string in resource content.
5273
5274#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5275#[serde(rename_all = "camelCase")]
5276pub struct SearchInResourceReturns {
5277    /// List of search matches.
5278    result: Vec<crate::debugger::SearchMatch>,
5279}
5280
5281impl SearchInResourceReturns {
5282    /// Creates a builder for this type with the required parameters:
5283    /// * `result`: List of search matches.
5284    pub fn builder(result: Vec<crate::debugger::SearchMatch>) -> SearchInResourceReturnsBuilder {
5285        SearchInResourceReturnsBuilder {
5286            result: result,
5287        }
5288    }
5289    /// List of search matches.
5290    pub fn result(&self) -> &[crate::debugger::SearchMatch] { &self.result }
5291}
5292
5293
5294pub struct SearchInResourceReturnsBuilder {
5295    result: Vec<crate::debugger::SearchMatch>,
5296}
5297
5298impl SearchInResourceReturnsBuilder {
5299    pub fn build(self) -> SearchInResourceReturns {
5300        SearchInResourceReturns {
5301            result: self.result,
5302        }
5303    }
5304}
5305
5306impl<'a> SearchInResourceParams<'a> { pub const METHOD: &'static str = "Page.searchInResource"; }
5307
5308impl<'a> crate::CdpCommand<'a> for SearchInResourceParams<'a> {
5309    const METHOD: &'static str = "Page.searchInResource";
5310    type Response = SearchInResourceReturns;
5311}
5312
5313/// Enable Chrome's experimental ad filter on all sites.
5314
5315#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5316#[serde(rename_all = "camelCase")]
5317pub struct SetAdBlockingEnabledParams {
5318    /// Whether to block ads.
5319    enabled: bool,
5320}
5321
5322impl SetAdBlockingEnabledParams {
5323    /// Creates a builder for this type with the required parameters:
5324    /// * `enabled`: Whether to block ads.
5325    pub fn builder(enabled: bool) -> SetAdBlockingEnabledParamsBuilder {
5326        SetAdBlockingEnabledParamsBuilder {
5327            enabled: enabled,
5328        }
5329    }
5330    /// Whether to block ads.
5331    pub fn enabled(&self) -> bool { self.enabled }
5332}
5333
5334
5335pub struct SetAdBlockingEnabledParamsBuilder {
5336    enabled: bool,
5337}
5338
5339impl SetAdBlockingEnabledParamsBuilder {
5340    pub fn build(self) -> SetAdBlockingEnabledParams {
5341        SetAdBlockingEnabledParams {
5342            enabled: self.enabled,
5343        }
5344    }
5345}
5346
5347impl SetAdBlockingEnabledParams { pub const METHOD: &'static str = "Page.setAdBlockingEnabled"; }
5348
5349impl<'a> crate::CdpCommand<'a> for SetAdBlockingEnabledParams {
5350    const METHOD: &'static str = "Page.setAdBlockingEnabled";
5351    type Response = crate::EmptyReturns;
5352}
5353
5354/// Enable page Content Security Policy by-passing.
5355
5356#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5357#[serde(rename_all = "camelCase")]
5358pub struct SetBypassCSPParams {
5359    /// Whether to bypass page CSP.
5360    enabled: bool,
5361}
5362
5363impl SetBypassCSPParams {
5364    /// Creates a builder for this type with the required parameters:
5365    /// * `enabled`: Whether to bypass page CSP.
5366    pub fn builder(enabled: bool) -> SetBypassCSPParamsBuilder {
5367        SetBypassCSPParamsBuilder {
5368            enabled: enabled,
5369        }
5370    }
5371    /// Whether to bypass page CSP.
5372    pub fn enabled(&self) -> bool { self.enabled }
5373}
5374
5375
5376pub struct SetBypassCSPParamsBuilder {
5377    enabled: bool,
5378}
5379
5380impl SetBypassCSPParamsBuilder {
5381    pub fn build(self) -> SetBypassCSPParams {
5382        SetBypassCSPParams {
5383            enabled: self.enabled,
5384        }
5385    }
5386}
5387
5388impl SetBypassCSPParams { pub const METHOD: &'static str = "Page.setBypassCSP"; }
5389
5390impl<'a> crate::CdpCommand<'a> for SetBypassCSPParams {
5391    const METHOD: &'static str = "Page.setBypassCSP";
5392    type Response = crate::EmptyReturns;
5393}
5394
5395/// Get Permissions Policy state on given frame.
5396
5397#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5398#[serde(rename_all = "camelCase")]
5399pub struct GetPermissionsPolicyStateParams<'a> {
5400    #[serde(rename = "frameId")]
5401    frame_id: FrameId<'a>,
5402}
5403
5404impl<'a> GetPermissionsPolicyStateParams<'a> {
5405    /// Creates a builder for this type with the required parameters:
5406    /// * `frame_id`: 
5407    pub fn builder(frame_id: impl Into<FrameId<'a>>) -> GetPermissionsPolicyStateParamsBuilder<'a> {
5408        GetPermissionsPolicyStateParamsBuilder {
5409            frame_id: frame_id.into(),
5410        }
5411    }
5412    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5413}
5414
5415
5416pub struct GetPermissionsPolicyStateParamsBuilder<'a> {
5417    frame_id: FrameId<'a>,
5418}
5419
5420impl<'a> GetPermissionsPolicyStateParamsBuilder<'a> {
5421    pub fn build(self) -> GetPermissionsPolicyStateParams<'a> {
5422        GetPermissionsPolicyStateParams {
5423            frame_id: self.frame_id,
5424        }
5425    }
5426}
5427
5428/// Get Permissions Policy state on given frame.
5429
5430#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5431#[serde(rename_all = "camelCase")]
5432pub struct GetPermissionsPolicyStateReturns<'a> {
5433    states: Vec<PermissionsPolicyFeatureState<'a>>,
5434}
5435
5436impl<'a> GetPermissionsPolicyStateReturns<'a> {
5437    /// Creates a builder for this type with the required parameters:
5438    /// * `states`: 
5439    pub fn builder(states: Vec<PermissionsPolicyFeatureState<'a>>) -> GetPermissionsPolicyStateReturnsBuilder<'a> {
5440        GetPermissionsPolicyStateReturnsBuilder {
5441            states: states,
5442        }
5443    }
5444    pub fn states(&self) -> &[PermissionsPolicyFeatureState<'a>] { &self.states }
5445}
5446
5447
5448pub struct GetPermissionsPolicyStateReturnsBuilder<'a> {
5449    states: Vec<PermissionsPolicyFeatureState<'a>>,
5450}
5451
5452impl<'a> GetPermissionsPolicyStateReturnsBuilder<'a> {
5453    pub fn build(self) -> GetPermissionsPolicyStateReturns<'a> {
5454        GetPermissionsPolicyStateReturns {
5455            states: self.states,
5456        }
5457    }
5458}
5459
5460impl<'a> GetPermissionsPolicyStateParams<'a> { pub const METHOD: &'static str = "Page.getPermissionsPolicyState"; }
5461
5462impl<'a> crate::CdpCommand<'a> for GetPermissionsPolicyStateParams<'a> {
5463    const METHOD: &'static str = "Page.getPermissionsPolicyState";
5464    type Response = GetPermissionsPolicyStateReturns<'a>;
5465}
5466
5467/// Get Origin Trials on given frame.
5468
5469#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5470#[serde(rename_all = "camelCase")]
5471pub struct GetOriginTrialsParams<'a> {
5472    #[serde(rename = "frameId")]
5473    frame_id: FrameId<'a>,
5474}
5475
5476impl<'a> GetOriginTrialsParams<'a> {
5477    /// Creates a builder for this type with the required parameters:
5478    /// * `frame_id`: 
5479    pub fn builder(frame_id: impl Into<FrameId<'a>>) -> GetOriginTrialsParamsBuilder<'a> {
5480        GetOriginTrialsParamsBuilder {
5481            frame_id: frame_id.into(),
5482        }
5483    }
5484    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5485}
5486
5487
5488pub struct GetOriginTrialsParamsBuilder<'a> {
5489    frame_id: FrameId<'a>,
5490}
5491
5492impl<'a> GetOriginTrialsParamsBuilder<'a> {
5493    pub fn build(self) -> GetOriginTrialsParams<'a> {
5494        GetOriginTrialsParams {
5495            frame_id: self.frame_id,
5496        }
5497    }
5498}
5499
5500/// Get Origin Trials on given frame.
5501
5502#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5503#[serde(rename_all = "camelCase")]
5504pub struct GetOriginTrialsReturns<'a> {
5505    #[serde(rename = "originTrials")]
5506    origin_trials: Vec<OriginTrial<'a>>,
5507}
5508
5509impl<'a> GetOriginTrialsReturns<'a> {
5510    /// Creates a builder for this type with the required parameters:
5511    /// * `origin_trials`: 
5512    pub fn builder(origin_trials: Vec<OriginTrial<'a>>) -> GetOriginTrialsReturnsBuilder<'a> {
5513        GetOriginTrialsReturnsBuilder {
5514            origin_trials: origin_trials,
5515        }
5516    }
5517    pub fn origin_trials(&self) -> &[OriginTrial<'a>] { &self.origin_trials }
5518}
5519
5520
5521pub struct GetOriginTrialsReturnsBuilder<'a> {
5522    origin_trials: Vec<OriginTrial<'a>>,
5523}
5524
5525impl<'a> GetOriginTrialsReturnsBuilder<'a> {
5526    pub fn build(self) -> GetOriginTrialsReturns<'a> {
5527        GetOriginTrialsReturns {
5528            origin_trials: self.origin_trials,
5529        }
5530    }
5531}
5532
5533impl<'a> GetOriginTrialsParams<'a> { pub const METHOD: &'static str = "Page.getOriginTrials"; }
5534
5535impl<'a> crate::CdpCommand<'a> for GetOriginTrialsParams<'a> {
5536    const METHOD: &'static str = "Page.getOriginTrials";
5537    type Response = GetOriginTrialsReturns<'a>;
5538}
5539
5540/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
5541/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
5542/// query results).
5543
5544#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5545#[serde(rename_all = "camelCase")]
5546pub struct SetDeviceMetricsOverrideParams<'a> {
5547    /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
5548    width: u64,
5549    /// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
5550    height: i64,
5551    /// Overriding device scale factor value. 0 disables the override.
5552    #[serde(rename = "deviceScaleFactor")]
5553    device_scale_factor: f64,
5554    /// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text
5555    /// autosizing and more.
5556    mobile: bool,
5557    /// Scale to apply to resulting view image.
5558    #[serde(skip_serializing_if = "Option::is_none")]
5559    scale: Option<f64>,
5560    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
5561    #[serde(skip_serializing_if = "Option::is_none", rename = "screenWidth")]
5562    screen_width: Option<u64>,
5563    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
5564    #[serde(skip_serializing_if = "Option::is_none", rename = "screenHeight")]
5565    screen_height: Option<i64>,
5566    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
5567    #[serde(skip_serializing_if = "Option::is_none", rename = "positionX")]
5568    position_x: Option<i64>,
5569    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
5570    #[serde(skip_serializing_if = "Option::is_none", rename = "positionY")]
5571    position_y: Option<i64>,
5572    /// Do not set visible view size, rely upon explicit setVisibleSize call.
5573    #[serde(skip_serializing_if = "Option::is_none", rename = "dontSetVisibleSize")]
5574    dont_set_visible_size: Option<bool>,
5575    /// Screen orientation override.
5576    #[serde(skip_serializing_if = "Option::is_none", rename = "screenOrientation")]
5577    screen_orientation: Option<crate::emulation::ScreenOrientation<'a>>,
5578    /// The viewport dimensions and scale. If not set, the override is cleared.
5579    #[serde(skip_serializing_if = "Option::is_none")]
5580    viewport: Option<Viewport>,
5581}
5582
5583impl<'a> SetDeviceMetricsOverrideParams<'a> {
5584    /// Creates a builder for this type with the required parameters:
5585    /// * `width`: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
5586    /// * `height`: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
5587    /// * `device_scale_factor`: Overriding device scale factor value. 0 disables the override.
5588    /// * `mobile`: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
5589    pub fn builder(width: u64, height: i64, device_scale_factor: f64, mobile: bool) -> SetDeviceMetricsOverrideParamsBuilder<'a> {
5590        SetDeviceMetricsOverrideParamsBuilder {
5591            width: width,
5592            height: height,
5593            device_scale_factor: device_scale_factor,
5594            mobile: mobile,
5595            scale: None,
5596            screen_width: None,
5597            screen_height: None,
5598            position_x: None,
5599            position_y: None,
5600            dont_set_visible_size: None,
5601            screen_orientation: None,
5602            viewport: None,
5603        }
5604    }
5605    /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
5606    pub fn width(&self) -> u64 { self.width }
5607    /// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
5608    pub fn height(&self) -> i64 { self.height }
5609    /// Overriding device scale factor value. 0 disables the override.
5610    pub fn device_scale_factor(&self) -> f64 { self.device_scale_factor }
5611    /// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text
5612    /// autosizing and more.
5613    pub fn mobile(&self) -> bool { self.mobile }
5614    /// Scale to apply to resulting view image.
5615    pub fn scale(&self) -> Option<f64> { self.scale }
5616    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
5617    pub fn screen_width(&self) -> Option<u64> { self.screen_width }
5618    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
5619    pub fn screen_height(&self) -> Option<i64> { self.screen_height }
5620    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
5621    pub fn position_x(&self) -> Option<i64> { self.position_x }
5622    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
5623    pub fn position_y(&self) -> Option<i64> { self.position_y }
5624    /// Do not set visible view size, rely upon explicit setVisibleSize call.
5625    pub fn dont_set_visible_size(&self) -> Option<bool> { self.dont_set_visible_size }
5626    /// Screen orientation override.
5627    pub fn screen_orientation(&self) -> Option<&crate::emulation::ScreenOrientation<'a>> { self.screen_orientation.as_ref() }
5628    /// The viewport dimensions and scale. If not set, the override is cleared.
5629    pub fn viewport(&self) -> Option<&Viewport> { self.viewport.as_ref() }
5630}
5631
5632
5633pub struct SetDeviceMetricsOverrideParamsBuilder<'a> {
5634    width: u64,
5635    height: i64,
5636    device_scale_factor: f64,
5637    mobile: bool,
5638    scale: Option<f64>,
5639    screen_width: Option<u64>,
5640    screen_height: Option<i64>,
5641    position_x: Option<i64>,
5642    position_y: Option<i64>,
5643    dont_set_visible_size: Option<bool>,
5644    screen_orientation: Option<crate::emulation::ScreenOrientation<'a>>,
5645    viewport: Option<Viewport>,
5646}
5647
5648impl<'a> SetDeviceMetricsOverrideParamsBuilder<'a> {
5649    /// Scale to apply to resulting view image.
5650    pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
5651    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
5652    pub fn screen_width(mut self, screen_width: u64) -> Self { self.screen_width = Some(screen_width); self }
5653    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
5654    pub fn screen_height(mut self, screen_height: i64) -> Self { self.screen_height = Some(screen_height); self }
5655    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
5656    pub fn position_x(mut self, position_x: i64) -> Self { self.position_x = Some(position_x); self }
5657    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
5658    pub fn position_y(mut self, position_y: i64) -> Self { self.position_y = Some(position_y); self }
5659    /// Do not set visible view size, rely upon explicit setVisibleSize call.
5660    pub fn dont_set_visible_size(mut self, dont_set_visible_size: bool) -> Self { self.dont_set_visible_size = Some(dont_set_visible_size); self }
5661    /// Screen orientation override.
5662    pub fn screen_orientation(mut self, screen_orientation: crate::emulation::ScreenOrientation<'a>) -> Self { self.screen_orientation = Some(screen_orientation); self }
5663    /// The viewport dimensions and scale. If not set, the override is cleared.
5664    pub fn viewport(mut self, viewport: Viewport) -> Self { self.viewport = Some(viewport); self }
5665    pub fn build(self) -> SetDeviceMetricsOverrideParams<'a> {
5666        SetDeviceMetricsOverrideParams {
5667            width: self.width,
5668            height: self.height,
5669            device_scale_factor: self.device_scale_factor,
5670            mobile: self.mobile,
5671            scale: self.scale,
5672            screen_width: self.screen_width,
5673            screen_height: self.screen_height,
5674            position_x: self.position_x,
5675            position_y: self.position_y,
5676            dont_set_visible_size: self.dont_set_visible_size,
5677            screen_orientation: self.screen_orientation,
5678            viewport: self.viewport,
5679        }
5680    }
5681}
5682
5683impl<'a> SetDeviceMetricsOverrideParams<'a> { pub const METHOD: &'static str = "Page.setDeviceMetricsOverride"; }
5684
5685impl<'a> crate::CdpCommand<'a> for SetDeviceMetricsOverrideParams<'a> {
5686    const METHOD: &'static str = "Page.setDeviceMetricsOverride";
5687    type Response = crate::EmptyReturns;
5688}
5689
5690/// Overrides the Device Orientation.
5691
5692#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5693#[serde(rename_all = "camelCase")]
5694pub struct SetDeviceOrientationOverrideParams {
5695    /// Mock alpha
5696    alpha: f64,
5697    /// Mock beta
5698    beta: f64,
5699    /// Mock gamma
5700    gamma: f64,
5701}
5702
5703impl SetDeviceOrientationOverrideParams {
5704    /// Creates a builder for this type with the required parameters:
5705    /// * `alpha`: Mock alpha
5706    /// * `beta`: Mock beta
5707    /// * `gamma`: Mock gamma
5708    pub fn builder(alpha: f64, beta: f64, gamma: f64) -> SetDeviceOrientationOverrideParamsBuilder {
5709        SetDeviceOrientationOverrideParamsBuilder {
5710            alpha: alpha,
5711            beta: beta,
5712            gamma: gamma,
5713        }
5714    }
5715    /// Mock alpha
5716    pub fn alpha(&self) -> f64 { self.alpha }
5717    /// Mock beta
5718    pub fn beta(&self) -> f64 { self.beta }
5719    /// Mock gamma
5720    pub fn gamma(&self) -> f64 { self.gamma }
5721}
5722
5723
5724pub struct SetDeviceOrientationOverrideParamsBuilder {
5725    alpha: f64,
5726    beta: f64,
5727    gamma: f64,
5728}
5729
5730impl SetDeviceOrientationOverrideParamsBuilder {
5731    pub fn build(self) -> SetDeviceOrientationOverrideParams {
5732        SetDeviceOrientationOverrideParams {
5733            alpha: self.alpha,
5734            beta: self.beta,
5735            gamma: self.gamma,
5736        }
5737    }
5738}
5739
5740impl SetDeviceOrientationOverrideParams { pub const METHOD: &'static str = "Page.setDeviceOrientationOverride"; }
5741
5742impl<'a> crate::CdpCommand<'a> for SetDeviceOrientationOverrideParams {
5743    const METHOD: &'static str = "Page.setDeviceOrientationOverride";
5744    type Response = crate::EmptyReturns;
5745}
5746
5747/// Set generic font families.
5748
5749#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5750#[serde(rename_all = "camelCase")]
5751pub struct SetFontFamiliesParams<'a> {
5752    /// Specifies font families to set. If a font family is not specified, it won't be changed.
5753    #[serde(rename = "fontFamilies")]
5754    font_families: FontFamilies<'a>,
5755    /// Specifies font families to set for individual scripts.
5756    #[serde(skip_serializing_if = "Option::is_none", rename = "forScripts")]
5757    for_scripts: Option<Vec<ScriptFontFamilies<'a>>>,
5758}
5759
5760impl<'a> SetFontFamiliesParams<'a> {
5761    /// Creates a builder for this type with the required parameters:
5762    /// * `font_families`: Specifies font families to set. If a font family is not specified, it won't be changed.
5763    pub fn builder(font_families: FontFamilies<'a>) -> SetFontFamiliesParamsBuilder<'a> {
5764        SetFontFamiliesParamsBuilder {
5765            font_families: font_families,
5766            for_scripts: None,
5767        }
5768    }
5769    /// Specifies font families to set. If a font family is not specified, it won't be changed.
5770    pub fn font_families(&self) -> &FontFamilies<'a> { &self.font_families }
5771    /// Specifies font families to set for individual scripts.
5772    pub fn for_scripts(&self) -> Option<&[ScriptFontFamilies<'a>]> { self.for_scripts.as_deref() }
5773}
5774
5775
5776pub struct SetFontFamiliesParamsBuilder<'a> {
5777    font_families: FontFamilies<'a>,
5778    for_scripts: Option<Vec<ScriptFontFamilies<'a>>>,
5779}
5780
5781impl<'a> SetFontFamiliesParamsBuilder<'a> {
5782    /// Specifies font families to set for individual scripts.
5783    pub fn for_scripts(mut self, for_scripts: Vec<ScriptFontFamilies<'a>>) -> Self { self.for_scripts = Some(for_scripts); self }
5784    pub fn build(self) -> SetFontFamiliesParams<'a> {
5785        SetFontFamiliesParams {
5786            font_families: self.font_families,
5787            for_scripts: self.for_scripts,
5788        }
5789    }
5790}
5791
5792impl<'a> SetFontFamiliesParams<'a> { pub const METHOD: &'static str = "Page.setFontFamilies"; }
5793
5794impl<'a> crate::CdpCommand<'a> for SetFontFamiliesParams<'a> {
5795    const METHOD: &'static str = "Page.setFontFamilies";
5796    type Response = crate::EmptyReturns;
5797}
5798
5799/// Set default font sizes.
5800
5801#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5802#[serde(rename_all = "camelCase")]
5803pub struct SetFontSizesParams {
5804    /// Specifies font sizes to set. If a font size is not specified, it won't be changed.
5805    #[serde(rename = "fontSizes")]
5806    font_sizes: FontSizes,
5807}
5808
5809impl SetFontSizesParams {
5810    /// Creates a builder for this type with the required parameters:
5811    /// * `font_sizes`: Specifies font sizes to set. If a font size is not specified, it won't be changed.
5812    pub fn builder(font_sizes: FontSizes) -> SetFontSizesParamsBuilder {
5813        SetFontSizesParamsBuilder {
5814            font_sizes: font_sizes,
5815        }
5816    }
5817    /// Specifies font sizes to set. If a font size is not specified, it won't be changed.
5818    pub fn font_sizes(&self) -> &FontSizes { &self.font_sizes }
5819}
5820
5821
5822pub struct SetFontSizesParamsBuilder {
5823    font_sizes: FontSizes,
5824}
5825
5826impl SetFontSizesParamsBuilder {
5827    pub fn build(self) -> SetFontSizesParams {
5828        SetFontSizesParams {
5829            font_sizes: self.font_sizes,
5830        }
5831    }
5832}
5833
5834impl SetFontSizesParams { pub const METHOD: &'static str = "Page.setFontSizes"; }
5835
5836impl<'a> crate::CdpCommand<'a> for SetFontSizesParams {
5837    const METHOD: &'static str = "Page.setFontSizes";
5838    type Response = crate::EmptyReturns;
5839}
5840
5841/// Sets given markup as the document's HTML.
5842
5843#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5844#[serde(rename_all = "camelCase")]
5845pub struct SetDocumentContentParams<'a> {
5846    /// Frame id to set HTML for.
5847    #[serde(rename = "frameId")]
5848    frame_id: FrameId<'a>,
5849    /// HTML content to set.
5850    html: Cow<'a, str>,
5851}
5852
5853impl<'a> SetDocumentContentParams<'a> {
5854    /// Creates a builder for this type with the required parameters:
5855    /// * `frame_id`: Frame id to set HTML for.
5856    /// * `html`: HTML content to set.
5857    pub fn builder(frame_id: impl Into<FrameId<'a>>, html: impl Into<Cow<'a, str>>) -> SetDocumentContentParamsBuilder<'a> {
5858        SetDocumentContentParamsBuilder {
5859            frame_id: frame_id.into(),
5860            html: html.into(),
5861        }
5862    }
5863    /// Frame id to set HTML for.
5864    pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5865    /// HTML content to set.
5866    pub fn html(&self) -> &str { self.html.as_ref() }
5867}
5868
5869
5870pub struct SetDocumentContentParamsBuilder<'a> {
5871    frame_id: FrameId<'a>,
5872    html: Cow<'a, str>,
5873}
5874
5875impl<'a> SetDocumentContentParamsBuilder<'a> {
5876    pub fn build(self) -> SetDocumentContentParams<'a> {
5877        SetDocumentContentParams {
5878            frame_id: self.frame_id,
5879            html: self.html,
5880        }
5881    }
5882}
5883
5884impl<'a> SetDocumentContentParams<'a> { pub const METHOD: &'static str = "Page.setDocumentContent"; }
5885
5886impl<'a> crate::CdpCommand<'a> for SetDocumentContentParams<'a> {
5887    const METHOD: &'static str = "Page.setDocumentContent";
5888    type Response = crate::EmptyReturns;
5889}
5890
5891/// Set the behavior when downloading a file.
5892
5893#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5894#[serde(rename_all = "camelCase")]
5895pub struct SetDownloadBehaviorParams<'a> {
5896    /// Whether to allow all or deny all download requests, or use default Chrome behavior if
5897    /// available (otherwise deny).
5898    behavior: Cow<'a, str>,
5899    /// The default path to save downloaded files to. This is required if behavior is set to 'allow'
5900    #[serde(skip_serializing_if = "Option::is_none", rename = "downloadPath")]
5901    download_path: Option<Cow<'a, str>>,
5902}
5903
5904impl<'a> SetDownloadBehaviorParams<'a> {
5905    /// Creates a builder for this type with the required parameters:
5906    /// * `behavior`: Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
5907    pub fn builder(behavior: impl Into<Cow<'a, str>>) -> SetDownloadBehaviorParamsBuilder<'a> {
5908        SetDownloadBehaviorParamsBuilder {
5909            behavior: behavior.into(),
5910            download_path: None,
5911        }
5912    }
5913    /// Whether to allow all or deny all download requests, or use default Chrome behavior if
5914    /// available (otherwise deny).
5915    pub fn behavior(&self) -> &str { self.behavior.as_ref() }
5916    /// The default path to save downloaded files to. This is required if behavior is set to 'allow'
5917    pub fn download_path(&self) -> Option<&str> { self.download_path.as_deref() }
5918}
5919
5920
5921pub struct SetDownloadBehaviorParamsBuilder<'a> {
5922    behavior: Cow<'a, str>,
5923    download_path: Option<Cow<'a, str>>,
5924}
5925
5926impl<'a> SetDownloadBehaviorParamsBuilder<'a> {
5927    /// The default path to save downloaded files to. This is required if behavior is set to 'allow'
5928    pub fn download_path(mut self, download_path: impl Into<Cow<'a, str>>) -> Self { self.download_path = Some(download_path.into()); self }
5929    pub fn build(self) -> SetDownloadBehaviorParams<'a> {
5930        SetDownloadBehaviorParams {
5931            behavior: self.behavior,
5932            download_path: self.download_path,
5933        }
5934    }
5935}
5936
5937impl<'a> SetDownloadBehaviorParams<'a> { pub const METHOD: &'static str = "Page.setDownloadBehavior"; }
5938
5939impl<'a> crate::CdpCommand<'a> for SetDownloadBehaviorParams<'a> {
5940    const METHOD: &'static str = "Page.setDownloadBehavior";
5941    type Response = crate::EmptyReturns;
5942}
5943
5944/// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position
5945/// unavailable.
5946
5947#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5948#[serde(rename_all = "camelCase")]
5949pub struct SetGeolocationOverrideParams {
5950    /// Mock latitude
5951    #[serde(skip_serializing_if = "Option::is_none")]
5952    latitude: Option<f64>,
5953    /// Mock longitude
5954    #[serde(skip_serializing_if = "Option::is_none")]
5955    longitude: Option<f64>,
5956    /// Mock accuracy
5957    #[serde(skip_serializing_if = "Option::is_none")]
5958    accuracy: Option<f64>,
5959}
5960
5961impl SetGeolocationOverrideParams {
5962    /// Creates a builder for this type.
5963    pub fn builder() -> SetGeolocationOverrideParamsBuilder {
5964        SetGeolocationOverrideParamsBuilder {
5965            latitude: None,
5966            longitude: None,
5967            accuracy: None,
5968        }
5969    }
5970    /// Mock latitude
5971    pub fn latitude(&self) -> Option<f64> { self.latitude }
5972    /// Mock longitude
5973    pub fn longitude(&self) -> Option<f64> { self.longitude }
5974    /// Mock accuracy
5975    pub fn accuracy(&self) -> Option<f64> { self.accuracy }
5976}
5977
5978#[derive(Default)]
5979pub struct SetGeolocationOverrideParamsBuilder {
5980    latitude: Option<f64>,
5981    longitude: Option<f64>,
5982    accuracy: Option<f64>,
5983}
5984
5985impl SetGeolocationOverrideParamsBuilder {
5986    /// Mock latitude
5987    pub fn latitude(mut self, latitude: f64) -> Self { self.latitude = Some(latitude); self }
5988    /// Mock longitude
5989    pub fn longitude(mut self, longitude: f64) -> Self { self.longitude = Some(longitude); self }
5990    /// Mock accuracy
5991    pub fn accuracy(mut self, accuracy: f64) -> Self { self.accuracy = Some(accuracy); self }
5992    pub fn build(self) -> SetGeolocationOverrideParams {
5993        SetGeolocationOverrideParams {
5994            latitude: self.latitude,
5995            longitude: self.longitude,
5996            accuracy: self.accuracy,
5997        }
5998    }
5999}
6000
6001impl SetGeolocationOverrideParams { pub const METHOD: &'static str = "Page.setGeolocationOverride"; }
6002
6003impl<'a> crate::CdpCommand<'a> for SetGeolocationOverrideParams {
6004    const METHOD: &'static str = "Page.setGeolocationOverride";
6005    type Response = crate::EmptyReturns;
6006}
6007
6008/// Controls whether page will emit lifecycle events.
6009
6010#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6011#[serde(rename_all = "camelCase")]
6012pub struct SetLifecycleEventsEnabledParams {
6013    /// If true, starts emitting lifecycle events.
6014    enabled: bool,
6015}
6016
6017impl SetLifecycleEventsEnabledParams {
6018    /// Creates a builder for this type with the required parameters:
6019    /// * `enabled`: If true, starts emitting lifecycle events.
6020    pub fn builder(enabled: bool) -> SetLifecycleEventsEnabledParamsBuilder {
6021        SetLifecycleEventsEnabledParamsBuilder {
6022            enabled: enabled,
6023        }
6024    }
6025    /// If true, starts emitting lifecycle events.
6026    pub fn enabled(&self) -> bool { self.enabled }
6027}
6028
6029
6030pub struct SetLifecycleEventsEnabledParamsBuilder {
6031    enabled: bool,
6032}
6033
6034impl SetLifecycleEventsEnabledParamsBuilder {
6035    pub fn build(self) -> SetLifecycleEventsEnabledParams {
6036        SetLifecycleEventsEnabledParams {
6037            enabled: self.enabled,
6038        }
6039    }
6040}
6041
6042impl SetLifecycleEventsEnabledParams { pub const METHOD: &'static str = "Page.setLifecycleEventsEnabled"; }
6043
6044impl<'a> crate::CdpCommand<'a> for SetLifecycleEventsEnabledParams {
6045    const METHOD: &'static str = "Page.setLifecycleEventsEnabled";
6046    type Response = crate::EmptyReturns;
6047}
6048
6049/// Toggles mouse event-based touch event emulation.
6050
6051#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6052#[serde(rename_all = "camelCase")]
6053pub struct SetTouchEmulationEnabledParams<'a> {
6054    /// Whether the touch event emulation should be enabled.
6055    enabled: bool,
6056    /// Touch/gesture events configuration. Default: current platform.
6057    #[serde(skip_serializing_if = "Option::is_none")]
6058    configuration: Option<Cow<'a, str>>,
6059}
6060
6061impl<'a> SetTouchEmulationEnabledParams<'a> {
6062    /// Creates a builder for this type with the required parameters:
6063    /// * `enabled`: Whether the touch event emulation should be enabled.
6064    pub fn builder(enabled: bool) -> SetTouchEmulationEnabledParamsBuilder<'a> {
6065        SetTouchEmulationEnabledParamsBuilder {
6066            enabled: enabled,
6067            configuration: None,
6068        }
6069    }
6070    /// Whether the touch event emulation should be enabled.
6071    pub fn enabled(&self) -> bool { self.enabled }
6072    /// Touch/gesture events configuration. Default: current platform.
6073    pub fn configuration(&self) -> Option<&str> { self.configuration.as_deref() }
6074}
6075
6076
6077pub struct SetTouchEmulationEnabledParamsBuilder<'a> {
6078    enabled: bool,
6079    configuration: Option<Cow<'a, str>>,
6080}
6081
6082impl<'a> SetTouchEmulationEnabledParamsBuilder<'a> {
6083    /// Touch/gesture events configuration. Default: current platform.
6084    pub fn configuration(mut self, configuration: impl Into<Cow<'a, str>>) -> Self { self.configuration = Some(configuration.into()); self }
6085    pub fn build(self) -> SetTouchEmulationEnabledParams<'a> {
6086        SetTouchEmulationEnabledParams {
6087            enabled: self.enabled,
6088            configuration: self.configuration,
6089        }
6090    }
6091}
6092
6093impl<'a> SetTouchEmulationEnabledParams<'a> { pub const METHOD: &'static str = "Page.setTouchEmulationEnabled"; }
6094
6095impl<'a> crate::CdpCommand<'a> for SetTouchEmulationEnabledParams<'a> {
6096    const METHOD: &'static str = "Page.setTouchEmulationEnabled";
6097    type Response = crate::EmptyReturns;
6098}
6099
6100/// Starts sending each frame using the 'screencastFrame' event.
6101
6102#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6103#[serde(rename_all = "camelCase")]
6104pub struct StartScreencastParams<'a> {
6105    /// Image compression format.
6106    #[serde(skip_serializing_if = "Option::is_none")]
6107    format: Option<Cow<'a, str>>,
6108    /// Compression quality from range \[0..100\].
6109    #[serde(skip_serializing_if = "Option::is_none")]
6110    quality: Option<i64>,
6111    /// Maximum screenshot width.
6112    #[serde(skip_serializing_if = "Option::is_none", rename = "maxWidth")]
6113    max_width: Option<u64>,
6114    /// Maximum screenshot height.
6115    #[serde(skip_serializing_if = "Option::is_none", rename = "maxHeight")]
6116    max_height: Option<i64>,
6117    /// Send every n-th frame.
6118    #[serde(skip_serializing_if = "Option::is_none", rename = "everyNthFrame")]
6119    every_nth_frame: Option<i64>,
6120}
6121
6122impl<'a> StartScreencastParams<'a> {
6123    /// Creates a builder for this type.
6124    pub fn builder() -> StartScreencastParamsBuilder<'a> {
6125        StartScreencastParamsBuilder {
6126            format: None,
6127            quality: None,
6128            max_width: None,
6129            max_height: None,
6130            every_nth_frame: None,
6131        }
6132    }
6133    /// Image compression format.
6134    pub fn format(&self) -> Option<&str> { self.format.as_deref() }
6135    /// Compression quality from range \[0..100\].
6136    pub fn quality(&self) -> Option<i64> { self.quality }
6137    /// Maximum screenshot width.
6138    pub fn max_width(&self) -> Option<u64> { self.max_width }
6139    /// Maximum screenshot height.
6140    pub fn max_height(&self) -> Option<i64> { self.max_height }
6141    /// Send every n-th frame.
6142    pub fn every_nth_frame(&self) -> Option<i64> { self.every_nth_frame }
6143}
6144
6145#[derive(Default)]
6146pub struct StartScreencastParamsBuilder<'a> {
6147    format: Option<Cow<'a, str>>,
6148    quality: Option<i64>,
6149    max_width: Option<u64>,
6150    max_height: Option<i64>,
6151    every_nth_frame: Option<i64>,
6152}
6153
6154impl<'a> StartScreencastParamsBuilder<'a> {
6155    /// Image compression format.
6156    pub fn format(mut self, format: impl Into<Cow<'a, str>>) -> Self { self.format = Some(format.into()); self }
6157    /// Compression quality from range \[0..100\].
6158    pub fn quality(mut self, quality: i64) -> Self { self.quality = Some(quality); self }
6159    /// Maximum screenshot width.
6160    pub fn max_width(mut self, max_width: u64) -> Self { self.max_width = Some(max_width); self }
6161    /// Maximum screenshot height.
6162    pub fn max_height(mut self, max_height: i64) -> Self { self.max_height = Some(max_height); self }
6163    /// Send every n-th frame.
6164    pub fn every_nth_frame(mut self, every_nth_frame: i64) -> Self { self.every_nth_frame = Some(every_nth_frame); self }
6165    pub fn build(self) -> StartScreencastParams<'a> {
6166        StartScreencastParams {
6167            format: self.format,
6168            quality: self.quality,
6169            max_width: self.max_width,
6170            max_height: self.max_height,
6171            every_nth_frame: self.every_nth_frame,
6172        }
6173    }
6174}
6175
6176impl<'a> StartScreencastParams<'a> { pub const METHOD: &'static str = "Page.startScreencast"; }
6177
6178impl<'a> crate::CdpCommand<'a> for StartScreencastParams<'a> {
6179    const METHOD: &'static str = "Page.startScreencast";
6180    type Response = crate::EmptyReturns;
6181}
6182
6183#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6184pub struct StopLoadingParams {}
6185
6186impl StopLoadingParams { pub const METHOD: &'static str = "Page.stopLoading"; }
6187
6188impl<'a> crate::CdpCommand<'a> for StopLoadingParams {
6189    const METHOD: &'static str = "Page.stopLoading";
6190    type Response = crate::EmptyReturns;
6191}
6192
6193#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6194pub struct CrashParams {}
6195
6196impl CrashParams { pub const METHOD: &'static str = "Page.crash"; }
6197
6198impl<'a> crate::CdpCommand<'a> for CrashParams {
6199    const METHOD: &'static str = "Page.crash";
6200    type Response = crate::EmptyReturns;
6201}
6202
6203#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6204pub struct CloseParams {}
6205
6206impl CloseParams { pub const METHOD: &'static str = "Page.close"; }
6207
6208impl<'a> crate::CdpCommand<'a> for CloseParams {
6209    const METHOD: &'static str = "Page.close";
6210    type Response = crate::EmptyReturns;
6211}
6212
6213/// Tries to update the web lifecycle state of the page.
6214/// It will transition the page to the given state according to:
6215/// <https://github.com/WICG/web-lifecycle/>
6216
6217#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6218#[serde(rename_all = "camelCase")]
6219pub struct SetWebLifecycleStateParams<'a> {
6220    /// Target lifecycle state
6221    state: Cow<'a, str>,
6222}
6223
6224impl<'a> SetWebLifecycleStateParams<'a> {
6225    /// Creates a builder for this type with the required parameters:
6226    /// * `state`: Target lifecycle state
6227    pub fn builder(state: impl Into<Cow<'a, str>>) -> SetWebLifecycleStateParamsBuilder<'a> {
6228        SetWebLifecycleStateParamsBuilder {
6229            state: state.into(),
6230        }
6231    }
6232    /// Target lifecycle state
6233    pub fn state(&self) -> &str { self.state.as_ref() }
6234}
6235
6236
6237pub struct SetWebLifecycleStateParamsBuilder<'a> {
6238    state: Cow<'a, str>,
6239}
6240
6241impl<'a> SetWebLifecycleStateParamsBuilder<'a> {
6242    pub fn build(self) -> SetWebLifecycleStateParams<'a> {
6243        SetWebLifecycleStateParams {
6244            state: self.state,
6245        }
6246    }
6247}
6248
6249impl<'a> SetWebLifecycleStateParams<'a> { pub const METHOD: &'static str = "Page.setWebLifecycleState"; }
6250
6251impl<'a> crate::CdpCommand<'a> for SetWebLifecycleStateParams<'a> {
6252    const METHOD: &'static str = "Page.setWebLifecycleState";
6253    type Response = crate::EmptyReturns;
6254}
6255
6256#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6257pub struct StopScreencastParams {}
6258
6259impl StopScreencastParams { pub const METHOD: &'static str = "Page.stopScreencast"; }
6260
6261impl<'a> crate::CdpCommand<'a> for StopScreencastParams {
6262    const METHOD: &'static str = "Page.stopScreencast";
6263    type Response = crate::EmptyReturns;
6264}
6265
6266/// Requests backend to produce compilation cache for the specified scripts.
6267/// 'scripts' are appended to the list of scripts for which the cache
6268/// would be produced. The list may be reset during page navigation.
6269/// When script with a matching URL is encountered, the cache is optionally
6270/// produced upon backend discretion, based on internal heuristics.
6271/// See also: 'Page.compilationCacheProduced'.
6272
6273#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6274#[serde(rename_all = "camelCase")]
6275pub struct ProduceCompilationCacheParams<'a> {
6276    scripts: Vec<CompilationCacheParams<'a>>,
6277}
6278
6279impl<'a> ProduceCompilationCacheParams<'a> {
6280    /// Creates a builder for this type with the required parameters:
6281    /// * `scripts`: 
6282    pub fn builder(scripts: Vec<CompilationCacheParams<'a>>) -> ProduceCompilationCacheParamsBuilder<'a> {
6283        ProduceCompilationCacheParamsBuilder {
6284            scripts: scripts,
6285        }
6286    }
6287    pub fn scripts(&self) -> &[CompilationCacheParams<'a>] { &self.scripts }
6288}
6289
6290
6291pub struct ProduceCompilationCacheParamsBuilder<'a> {
6292    scripts: Vec<CompilationCacheParams<'a>>,
6293}
6294
6295impl<'a> ProduceCompilationCacheParamsBuilder<'a> {
6296    pub fn build(self) -> ProduceCompilationCacheParams<'a> {
6297        ProduceCompilationCacheParams {
6298            scripts: self.scripts,
6299        }
6300    }
6301}
6302
6303impl<'a> ProduceCompilationCacheParams<'a> { pub const METHOD: &'static str = "Page.produceCompilationCache"; }
6304
6305impl<'a> crate::CdpCommand<'a> for ProduceCompilationCacheParams<'a> {
6306    const METHOD: &'static str = "Page.produceCompilationCache";
6307    type Response = crate::EmptyReturns;
6308}
6309
6310/// Seeds compilation cache for given url. Compilation cache does not survive
6311/// cross-process navigation.
6312
6313#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6314#[serde(rename_all = "camelCase")]
6315pub struct AddCompilationCacheParams<'a> {
6316    url: Cow<'a, str>,
6317    /// Base64-encoded data (Encoded as a base64 string when passed over JSON)
6318    data: Cow<'a, str>,
6319}
6320
6321impl<'a> AddCompilationCacheParams<'a> {
6322    /// Creates a builder for this type with the required parameters:
6323    /// * `url`: 
6324    /// * `data`: Base64-encoded data (Encoded as a base64 string when passed over JSON)
6325    pub fn builder(url: impl Into<Cow<'a, str>>, data: impl Into<Cow<'a, str>>) -> AddCompilationCacheParamsBuilder<'a> {
6326        AddCompilationCacheParamsBuilder {
6327            url: url.into(),
6328            data: data.into(),
6329        }
6330    }
6331    pub fn url(&self) -> &str { self.url.as_ref() }
6332    /// Base64-encoded data (Encoded as a base64 string when passed over JSON)
6333    pub fn data(&self) -> &str { self.data.as_ref() }
6334}
6335
6336
6337pub struct AddCompilationCacheParamsBuilder<'a> {
6338    url: Cow<'a, str>,
6339    data: Cow<'a, str>,
6340}
6341
6342impl<'a> AddCompilationCacheParamsBuilder<'a> {
6343    pub fn build(self) -> AddCompilationCacheParams<'a> {
6344        AddCompilationCacheParams {
6345            url: self.url,
6346            data: self.data,
6347        }
6348    }
6349}
6350
6351impl<'a> AddCompilationCacheParams<'a> { pub const METHOD: &'static str = "Page.addCompilationCache"; }
6352
6353impl<'a> crate::CdpCommand<'a> for AddCompilationCacheParams<'a> {
6354    const METHOD: &'static str = "Page.addCompilationCache";
6355    type Response = crate::EmptyReturns;
6356}
6357
6358#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6359pub struct ClearCompilationCacheParams {}
6360
6361impl ClearCompilationCacheParams { pub const METHOD: &'static str = "Page.clearCompilationCache"; }
6362
6363impl<'a> crate::CdpCommand<'a> for ClearCompilationCacheParams {
6364    const METHOD: &'static str = "Page.clearCompilationCache";
6365    type Response = crate::EmptyReturns;
6366}
6367
6368/// Sets the Secure Payment Confirmation transaction mode.
6369/// <https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode>
6370
6371#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6372#[serde(rename_all = "camelCase")]
6373pub struct SetSPCTransactionModeParams<'a> {
6374    mode: Cow<'a, str>,
6375}
6376
6377impl<'a> SetSPCTransactionModeParams<'a> {
6378    /// Creates a builder for this type with the required parameters:
6379    /// * `mode`: 
6380    pub fn builder(mode: impl Into<Cow<'a, str>>) -> SetSPCTransactionModeParamsBuilder<'a> {
6381        SetSPCTransactionModeParamsBuilder {
6382            mode: mode.into(),
6383        }
6384    }
6385    pub fn mode(&self) -> &str { self.mode.as_ref() }
6386}
6387
6388
6389pub struct SetSPCTransactionModeParamsBuilder<'a> {
6390    mode: Cow<'a, str>,
6391}
6392
6393impl<'a> SetSPCTransactionModeParamsBuilder<'a> {
6394    pub fn build(self) -> SetSPCTransactionModeParams<'a> {
6395        SetSPCTransactionModeParams {
6396            mode: self.mode,
6397        }
6398    }
6399}
6400
6401impl<'a> SetSPCTransactionModeParams<'a> { pub const METHOD: &'static str = "Page.setSPCTransactionMode"; }
6402
6403impl<'a> crate::CdpCommand<'a> for SetSPCTransactionModeParams<'a> {
6404    const METHOD: &'static str = "Page.setSPCTransactionMode";
6405    type Response = crate::EmptyReturns;
6406}
6407
6408/// Extensions for Custom Handlers API:
6409/// <https://html.spec.whatwg.org/multipage/system-state.html#rph-automation>
6410
6411#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6412#[serde(rename_all = "camelCase")]
6413pub struct SetRPHRegistrationModeParams<'a> {
6414    mode: Cow<'a, str>,
6415}
6416
6417impl<'a> SetRPHRegistrationModeParams<'a> {
6418    /// Creates a builder for this type with the required parameters:
6419    /// * `mode`: 
6420    pub fn builder(mode: impl Into<Cow<'a, str>>) -> SetRPHRegistrationModeParamsBuilder<'a> {
6421        SetRPHRegistrationModeParamsBuilder {
6422            mode: mode.into(),
6423        }
6424    }
6425    pub fn mode(&self) -> &str { self.mode.as_ref() }
6426}
6427
6428
6429pub struct SetRPHRegistrationModeParamsBuilder<'a> {
6430    mode: Cow<'a, str>,
6431}
6432
6433impl<'a> SetRPHRegistrationModeParamsBuilder<'a> {
6434    pub fn build(self) -> SetRPHRegistrationModeParams<'a> {
6435        SetRPHRegistrationModeParams {
6436            mode: self.mode,
6437        }
6438    }
6439}
6440
6441impl<'a> SetRPHRegistrationModeParams<'a> { pub const METHOD: &'static str = "Page.setRPHRegistrationMode"; }
6442
6443impl<'a> crate::CdpCommand<'a> for SetRPHRegistrationModeParams<'a> {
6444    const METHOD: &'static str = "Page.setRPHRegistrationMode";
6445    type Response = crate::EmptyReturns;
6446}
6447
6448/// Generates a report for testing.
6449
6450#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6451#[serde(rename_all = "camelCase")]
6452pub struct GenerateTestReportParams<'a> {
6453    /// Message to be displayed in the report.
6454    message: Cow<'a, str>,
6455    /// Specifies the endpoint group to deliver the report to.
6456    #[serde(skip_serializing_if = "Option::is_none")]
6457    group: Option<Cow<'a, str>>,
6458}
6459
6460impl<'a> GenerateTestReportParams<'a> {
6461    /// Creates a builder for this type with the required parameters:
6462    /// * `message`: Message to be displayed in the report.
6463    pub fn builder(message: impl Into<Cow<'a, str>>) -> GenerateTestReportParamsBuilder<'a> {
6464        GenerateTestReportParamsBuilder {
6465            message: message.into(),
6466            group: None,
6467        }
6468    }
6469    /// Message to be displayed in the report.
6470    pub fn message(&self) -> &str { self.message.as_ref() }
6471    /// Specifies the endpoint group to deliver the report to.
6472    pub fn group(&self) -> Option<&str> { self.group.as_deref() }
6473}
6474
6475
6476pub struct GenerateTestReportParamsBuilder<'a> {
6477    message: Cow<'a, str>,
6478    group: Option<Cow<'a, str>>,
6479}
6480
6481impl<'a> GenerateTestReportParamsBuilder<'a> {
6482    /// Specifies the endpoint group to deliver the report to.
6483    pub fn group(mut self, group: impl Into<Cow<'a, str>>) -> Self { self.group = Some(group.into()); self }
6484    pub fn build(self) -> GenerateTestReportParams<'a> {
6485        GenerateTestReportParams {
6486            message: self.message,
6487            group: self.group,
6488        }
6489    }
6490}
6491
6492impl<'a> GenerateTestReportParams<'a> { pub const METHOD: &'static str = "Page.generateTestReport"; }
6493
6494impl<'a> crate::CdpCommand<'a> for GenerateTestReportParams<'a> {
6495    const METHOD: &'static str = "Page.generateTestReport";
6496    type Response = crate::EmptyReturns;
6497}
6498
6499#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6500pub struct WaitForDebuggerParams {}
6501
6502impl WaitForDebuggerParams { pub const METHOD: &'static str = "Page.waitForDebugger"; }
6503
6504impl<'a> crate::CdpCommand<'a> for WaitForDebuggerParams {
6505    const METHOD: &'static str = "Page.waitForDebugger";
6506    type Response = crate::EmptyReturns;
6507}
6508
6509/// Intercept file chooser requests and transfer control to protocol clients.
6510/// When file chooser interception is enabled, native file chooser dialog is not shown.
6511/// Instead, a protocol event 'Page.fileChooserOpened' is emitted.
6512
6513#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6514#[serde(rename_all = "camelCase")]
6515pub struct SetInterceptFileChooserDialogParams {
6516    enabled: bool,
6517    /// If true, cancels the dialog by emitting relevant events (if any)
6518    /// in addition to not showing it if the interception is enabled
6519    /// (default: false).
6520    #[serde(skip_serializing_if = "Option::is_none")]
6521    cancel: Option<bool>,
6522}
6523
6524impl SetInterceptFileChooserDialogParams {
6525    /// Creates a builder for this type with the required parameters:
6526    /// * `enabled`: 
6527    pub fn builder(enabled: bool) -> SetInterceptFileChooserDialogParamsBuilder {
6528        SetInterceptFileChooserDialogParamsBuilder {
6529            enabled: enabled,
6530            cancel: None,
6531        }
6532    }
6533    pub fn enabled(&self) -> bool { self.enabled }
6534    /// If true, cancels the dialog by emitting relevant events (if any)
6535    /// in addition to not showing it if the interception is enabled
6536    /// (default: false).
6537    pub fn cancel(&self) -> Option<bool> { self.cancel }
6538}
6539
6540
6541pub struct SetInterceptFileChooserDialogParamsBuilder {
6542    enabled: bool,
6543    cancel: Option<bool>,
6544}
6545
6546impl SetInterceptFileChooserDialogParamsBuilder {
6547    /// If true, cancels the dialog by emitting relevant events (if any)
6548    /// in addition to not showing it if the interception is enabled
6549    /// (default: false).
6550    pub fn cancel(mut self, cancel: bool) -> Self { self.cancel = Some(cancel); self }
6551    pub fn build(self) -> SetInterceptFileChooserDialogParams {
6552        SetInterceptFileChooserDialogParams {
6553            enabled: self.enabled,
6554            cancel: self.cancel,
6555        }
6556    }
6557}
6558
6559impl SetInterceptFileChooserDialogParams { pub const METHOD: &'static str = "Page.setInterceptFileChooserDialog"; }
6560
6561impl<'a> crate::CdpCommand<'a> for SetInterceptFileChooserDialogParams {
6562    const METHOD: &'static str = "Page.setInterceptFileChooserDialog";
6563    type Response = crate::EmptyReturns;
6564}
6565
6566/// Enable/disable prerendering manually.
6567/// 
6568/// This command is a short-term solution for <https://crbug.com/1440085>.
6569/// See <https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA>
6570/// for more details.
6571/// 
6572/// TODO(<https://crbug.com/1440085>): Remove this once Puppeteer supports tab targets.
6573
6574#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6575#[serde(rename_all = "camelCase")]
6576pub struct SetPrerenderingAllowedParams {
6577    #[serde(rename = "isAllowed")]
6578    is_allowed: bool,
6579}
6580
6581impl SetPrerenderingAllowedParams {
6582    /// Creates a builder for this type with the required parameters:
6583    /// * `is_allowed`: 
6584    pub fn builder(is_allowed: bool) -> SetPrerenderingAllowedParamsBuilder {
6585        SetPrerenderingAllowedParamsBuilder {
6586            is_allowed: is_allowed,
6587        }
6588    }
6589    pub fn is_allowed(&self) -> bool { self.is_allowed }
6590}
6591
6592
6593pub struct SetPrerenderingAllowedParamsBuilder {
6594    is_allowed: bool,
6595}
6596
6597impl SetPrerenderingAllowedParamsBuilder {
6598    pub fn build(self) -> SetPrerenderingAllowedParams {
6599        SetPrerenderingAllowedParams {
6600            is_allowed: self.is_allowed,
6601        }
6602    }
6603}
6604
6605impl SetPrerenderingAllowedParams { pub const METHOD: &'static str = "Page.setPrerenderingAllowed"; }
6606
6607impl<'a> crate::CdpCommand<'a> for SetPrerenderingAllowedParams {
6608    const METHOD: &'static str = "Page.setPrerenderingAllowed";
6609    type Response = crate::EmptyReturns;
6610}
6611
6612/// Get the annotated page content for the main frame.
6613/// This is an experimental command that is subject to change.
6614
6615#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6616#[serde(rename_all = "camelCase")]
6617pub struct GetAnnotatedPageContentParams {
6618    /// Whether to include actionable information. Defaults to true.
6619    #[serde(skip_serializing_if = "Option::is_none", rename = "includeActionableInformation")]
6620    include_actionable_information: Option<bool>,
6621}
6622
6623impl GetAnnotatedPageContentParams {
6624    /// Creates a builder for this type.
6625    pub fn builder() -> GetAnnotatedPageContentParamsBuilder {
6626        GetAnnotatedPageContentParamsBuilder {
6627            include_actionable_information: None,
6628        }
6629    }
6630    /// Whether to include actionable information. Defaults to true.
6631    pub fn include_actionable_information(&self) -> Option<bool> { self.include_actionable_information }
6632}
6633
6634#[derive(Default)]
6635pub struct GetAnnotatedPageContentParamsBuilder {
6636    include_actionable_information: Option<bool>,
6637}
6638
6639impl GetAnnotatedPageContentParamsBuilder {
6640    /// Whether to include actionable information. Defaults to true.
6641    pub fn include_actionable_information(mut self, include_actionable_information: bool) -> Self { self.include_actionable_information = Some(include_actionable_information); self }
6642    pub fn build(self) -> GetAnnotatedPageContentParams {
6643        GetAnnotatedPageContentParams {
6644            include_actionable_information: self.include_actionable_information,
6645        }
6646    }
6647}
6648
6649/// Get the annotated page content for the main frame.
6650/// This is an experimental command that is subject to change.
6651
6652#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6653#[serde(rename_all = "camelCase")]
6654pub struct GetAnnotatedPageContentReturns<'a> {
6655    /// The annotated page content as a base64 encoded protobuf.
6656    /// The format is defined by the 'AnnotatedPageContent' message in
6657    /// components/optimization_guide/proto/features/common_quality_data.proto (Encoded as a base64 string when passed over JSON)
6658    content: Cow<'a, str>,
6659}
6660
6661impl<'a> GetAnnotatedPageContentReturns<'a> {
6662    /// Creates a builder for this type with the required parameters:
6663    /// * `content`: The annotated page content as a base64 encoded protobuf. The format is defined by the `AnnotatedPageContent` message in components/optimization_guide/proto/features/common_quality_data.proto (Encoded as a base64 string when passed over JSON)
6664    pub fn builder(content: impl Into<Cow<'a, str>>) -> GetAnnotatedPageContentReturnsBuilder<'a> {
6665        GetAnnotatedPageContentReturnsBuilder {
6666            content: content.into(),
6667        }
6668    }
6669    /// The annotated page content as a base64 encoded protobuf.
6670    /// The format is defined by the 'AnnotatedPageContent' message in
6671    /// components/optimization_guide/proto/features/common_quality_data.proto (Encoded as a base64 string when passed over JSON)
6672    pub fn content(&self) -> &str { self.content.as_ref() }
6673}
6674
6675
6676pub struct GetAnnotatedPageContentReturnsBuilder<'a> {
6677    content: Cow<'a, str>,
6678}
6679
6680impl<'a> GetAnnotatedPageContentReturnsBuilder<'a> {
6681    pub fn build(self) -> GetAnnotatedPageContentReturns<'a> {
6682        GetAnnotatedPageContentReturns {
6683            content: self.content,
6684        }
6685    }
6686}
6687
6688impl GetAnnotatedPageContentParams { pub const METHOD: &'static str = "Page.getAnnotatedPageContent"; }
6689
6690impl<'a> crate::CdpCommand<'a> for GetAnnotatedPageContentParams {
6691    const METHOD: &'static str = "Page.getAnnotatedPageContent";
6692    type Response = GetAnnotatedPageContentReturns<'a>;
6693}