Skip to main content

browser_protocol/emulation/
mod.rs

1//! This domain emulates different environments for the page.
2
3
4use serde::{Serialize, Deserialize};
5use serde_json::Value as JsonValue;
6use std::borrow::Cow;
7
8
9#[derive(Debug, Clone, Serialize, Deserialize, Default)]
10#[serde(rename_all = "camelCase")]
11pub struct SafeAreaInsets {
12    /// Overrides safe-area-inset-top.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    top: Option<i64>,
15    /// Overrides safe-area-max-inset-top.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    topMax: Option<i64>,
18    /// Overrides safe-area-inset-left.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    left: Option<i64>,
21    /// Overrides safe-area-max-inset-left.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    leftMax: Option<i64>,
24    /// Overrides safe-area-inset-bottom.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    bottom: Option<i64>,
27    /// Overrides safe-area-max-inset-bottom.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    bottomMax: Option<i64>,
30    /// Overrides safe-area-inset-right.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    right: Option<i64>,
33    /// Overrides safe-area-max-inset-right.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    rightMax: Option<i64>,
36}
37
38impl SafeAreaInsets {
39    pub fn builder() -> SafeAreaInsetsBuilder {
40        SafeAreaInsetsBuilder {
41            top: None,
42            topMax: None,
43            left: None,
44            leftMax: None,
45            bottom: None,
46            bottomMax: None,
47            right: None,
48            rightMax: None,
49        }
50    }
51    pub fn top(&self) -> Option<i64> { self.top }
52    pub fn topMax(&self) -> Option<i64> { self.topMax }
53    pub fn left(&self) -> Option<i64> { self.left }
54    pub fn leftMax(&self) -> Option<i64> { self.leftMax }
55    pub fn bottom(&self) -> Option<i64> { self.bottom }
56    pub fn bottomMax(&self) -> Option<i64> { self.bottomMax }
57    pub fn right(&self) -> Option<i64> { self.right }
58    pub fn rightMax(&self) -> Option<i64> { self.rightMax }
59}
60
61#[derive(Default)]
62pub struct SafeAreaInsetsBuilder {
63    top: Option<i64>,
64    topMax: Option<i64>,
65    left: Option<i64>,
66    leftMax: Option<i64>,
67    bottom: Option<i64>,
68    bottomMax: Option<i64>,
69    right: Option<i64>,
70    rightMax: Option<i64>,
71}
72
73impl SafeAreaInsetsBuilder {
74    /// Overrides safe-area-inset-top.
75    pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
76    /// Overrides safe-area-max-inset-top.
77    pub fn topMax(mut self, topMax: i64) -> Self { self.topMax = Some(topMax); self }
78    /// Overrides safe-area-inset-left.
79    pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
80    /// Overrides safe-area-max-inset-left.
81    pub fn leftMax(mut self, leftMax: i64) -> Self { self.leftMax = Some(leftMax); self }
82    /// Overrides safe-area-inset-bottom.
83    pub fn bottom(mut self, bottom: i64) -> Self { self.bottom = Some(bottom); self }
84    /// Overrides safe-area-max-inset-bottom.
85    pub fn bottomMax(mut self, bottomMax: i64) -> Self { self.bottomMax = Some(bottomMax); self }
86    /// Overrides safe-area-inset-right.
87    pub fn right(mut self, right: i64) -> Self { self.right = Some(right); self }
88    /// Overrides safe-area-max-inset-right.
89    pub fn rightMax(mut self, rightMax: i64) -> Self { self.rightMax = Some(rightMax); self }
90    pub fn build(self) -> SafeAreaInsets {
91        SafeAreaInsets {
92            top: self.top,
93            topMax: self.topMax,
94            left: self.left,
95            leftMax: self.leftMax,
96            bottom: self.bottom,
97            bottomMax: self.bottomMax,
98            right: self.right,
99            rightMax: self.rightMax,
100        }
101    }
102}
103
104/// Screen orientation.
105
106#[derive(Debug, Clone, Serialize, Deserialize, Default)]
107#[serde(rename_all = "camelCase")]
108pub struct ScreenOrientation<'a> {
109    /// Orientation type.
110    #[serde(rename = "type")]
111    type_: Cow<'a, str>,
112    /// Orientation angle.
113    angle: i64,
114}
115
116impl<'a> ScreenOrientation<'a> {
117    pub fn builder(type_: impl Into<Cow<'a, str>>, angle: i64) -> ScreenOrientationBuilder<'a> {
118        ScreenOrientationBuilder {
119            type_: type_.into(),
120            angle: angle,
121        }
122    }
123    pub fn type_(&self) -> &str { self.type_.as_ref() }
124    pub fn angle(&self) -> i64 { self.angle }
125}
126
127
128pub struct ScreenOrientationBuilder<'a> {
129    type_: Cow<'a, str>,
130    angle: i64,
131}
132
133impl<'a> ScreenOrientationBuilder<'a> {
134    pub fn build(self) -> ScreenOrientation<'a> {
135        ScreenOrientation {
136            type_: self.type_,
137            angle: self.angle,
138        }
139    }
140}
141
142
143#[derive(Debug, Clone, Serialize, Deserialize, Default)]
144#[serde(rename_all = "camelCase")]
145pub struct DisplayFeature<'a> {
146    /// Orientation of a display feature in relation to screen
147    orientation: Cow<'a, str>,
148    /// The offset from the screen origin in either the x (for vertical
149    /// orientation) or y (for horizontal orientation) direction.
150    offset: i32,
151    /// A display feature may mask content such that it is not physically
152    /// displayed - this length along with the offset describes this area.
153    /// A display feature that only splits content will have a 0 mask_length.
154    maskLength: u64,
155}
156
157impl<'a> DisplayFeature<'a> {
158    pub fn builder(orientation: impl Into<Cow<'a, str>>, offset: i32, maskLength: u64) -> DisplayFeatureBuilder<'a> {
159        DisplayFeatureBuilder {
160            orientation: orientation.into(),
161            offset: offset,
162            maskLength: maskLength,
163        }
164    }
165    pub fn orientation(&self) -> &str { self.orientation.as_ref() }
166    pub fn offset(&self) -> i32 { self.offset }
167    pub fn maskLength(&self) -> u64 { self.maskLength }
168}
169
170
171pub struct DisplayFeatureBuilder<'a> {
172    orientation: Cow<'a, str>,
173    offset: i32,
174    maskLength: u64,
175}
176
177impl<'a> DisplayFeatureBuilder<'a> {
178    pub fn build(self) -> DisplayFeature<'a> {
179        DisplayFeature {
180            orientation: self.orientation,
181            offset: self.offset,
182            maskLength: self.maskLength,
183        }
184    }
185}
186
187
188#[derive(Debug, Clone, Serialize, Deserialize, Default)]
189#[serde(rename_all = "camelCase")]
190pub struct DevicePosture<'a> {
191    /// Current posture of the device
192    #[serde(rename = "type")]
193    type_: Cow<'a, str>,
194}
195
196impl<'a> DevicePosture<'a> {
197    pub fn builder(type_: impl Into<Cow<'a, str>>) -> DevicePostureBuilder<'a> {
198        DevicePostureBuilder {
199            type_: type_.into(),
200        }
201    }
202    pub fn type_(&self) -> &str { self.type_.as_ref() }
203}
204
205
206pub struct DevicePostureBuilder<'a> {
207    type_: Cow<'a, str>,
208}
209
210impl<'a> DevicePostureBuilder<'a> {
211    pub fn build(self) -> DevicePosture<'a> {
212        DevicePosture {
213            type_: self.type_,
214        }
215    }
216}
217
218
219#[derive(Debug, Clone, Serialize, Deserialize, Default)]
220#[serde(rename_all = "camelCase")]
221pub struct MediaFeature<'a> {
222    name: Cow<'a, str>,
223    value: Cow<'a, str>,
224}
225
226impl<'a> MediaFeature<'a> {
227    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> MediaFeatureBuilder<'a> {
228        MediaFeatureBuilder {
229            name: name.into(),
230            value: value.into(),
231        }
232    }
233    pub fn name(&self) -> &str { self.name.as_ref() }
234    pub fn value(&self) -> &str { self.value.as_ref() }
235}
236
237
238pub struct MediaFeatureBuilder<'a> {
239    name: Cow<'a, str>,
240    value: Cow<'a, str>,
241}
242
243impl<'a> MediaFeatureBuilder<'a> {
244    pub fn build(self) -> MediaFeature<'a> {
245        MediaFeature {
246            name: self.name,
247            value: self.value,
248        }
249    }
250}
251
252/// advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to
253/// allow the next delayed task (if any) to run; pause: The virtual time base may not advance;
254/// pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending
255/// resource fetches.
256
257#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
258pub enum VirtualTimePolicy {
259    #[default]
260    #[serde(rename = "advance")]
261    Advance,
262    #[serde(rename = "pause")]
263    Pause,
264    #[serde(rename = "pauseIfNetworkFetchesPending")]
265    PauseIfNetworkFetchesPending,
266}
267
268/// Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
269
270#[derive(Debug, Clone, Serialize, Deserialize, Default)]
271#[serde(rename_all = "camelCase")]
272pub struct UserAgentBrandVersion<'a> {
273    brand: Cow<'a, str>,
274    version: Cow<'a, str>,
275}
276
277impl<'a> UserAgentBrandVersion<'a> {
278    pub fn builder(brand: impl Into<Cow<'a, str>>, version: impl Into<Cow<'a, str>>) -> UserAgentBrandVersionBuilder<'a> {
279        UserAgentBrandVersionBuilder {
280            brand: brand.into(),
281            version: version.into(),
282        }
283    }
284    pub fn brand(&self) -> &str { self.brand.as_ref() }
285    pub fn version(&self) -> &str { self.version.as_ref() }
286}
287
288
289pub struct UserAgentBrandVersionBuilder<'a> {
290    brand: Cow<'a, str>,
291    version: Cow<'a, str>,
292}
293
294impl<'a> UserAgentBrandVersionBuilder<'a> {
295    pub fn build(self) -> UserAgentBrandVersion<'a> {
296        UserAgentBrandVersion {
297            brand: self.brand,
298            version: self.version,
299        }
300    }
301}
302
303/// Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
304/// Missing optional values will be filled in by the target with what it would normally use.
305
306#[derive(Debug, Clone, Serialize, Deserialize, Default)]
307#[serde(rename_all = "camelCase")]
308pub struct UserAgentMetadata<'a> {
309    /// Brands appearing in Sec-CH-UA.
310    #[serde(skip_serializing_if = "Option::is_none")]
311    brands: Option<Vec<UserAgentBrandVersion<'a>>>,
312    /// Brands appearing in Sec-CH-UA-Full-Version-List.
313    #[serde(skip_serializing_if = "Option::is_none")]
314    fullVersionList: Option<Vec<UserAgentBrandVersion<'a>>>,
315    #[serde(skip_serializing_if = "Option::is_none")]
316    fullVersion: Option<Cow<'a, str>>,
317    platform: Cow<'a, str>,
318    platformVersion: Cow<'a, str>,
319    architecture: Cow<'a, str>,
320    model: Cow<'a, str>,
321    mobile: bool,
322    #[serde(skip_serializing_if = "Option::is_none")]
323    bitness: Option<Cow<'a, str>>,
324    #[serde(skip_serializing_if = "Option::is_none")]
325    wow64: Option<bool>,
326    /// Used to specify User Agent form-factor values.
327    /// See https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors
328    #[serde(skip_serializing_if = "Option::is_none")]
329    formFactors: Option<Vec<Cow<'a, str>>>,
330}
331
332impl<'a> UserAgentMetadata<'a> {
333    pub fn builder(platform: impl Into<Cow<'a, str>>, platformVersion: impl Into<Cow<'a, str>>, architecture: impl Into<Cow<'a, str>>, model: impl Into<Cow<'a, str>>, mobile: bool) -> UserAgentMetadataBuilder<'a> {
334        UserAgentMetadataBuilder {
335            brands: None,
336            fullVersionList: None,
337            fullVersion: None,
338            platform: platform.into(),
339            platformVersion: platformVersion.into(),
340            architecture: architecture.into(),
341            model: model.into(),
342            mobile: mobile,
343            bitness: None,
344            wow64: None,
345            formFactors: None,
346        }
347    }
348    pub fn brands(&self) -> Option<&[UserAgentBrandVersion<'a>]> { self.brands.as_deref() }
349    pub fn fullVersionList(&self) -> Option<&[UserAgentBrandVersion<'a>]> { self.fullVersionList.as_deref() }
350    pub fn fullVersion(&self) -> Option<&str> { self.fullVersion.as_deref() }
351    pub fn platform(&self) -> &str { self.platform.as_ref() }
352    pub fn platformVersion(&self) -> &str { self.platformVersion.as_ref() }
353    pub fn architecture(&self) -> &str { self.architecture.as_ref() }
354    pub fn model(&self) -> &str { self.model.as_ref() }
355    pub fn mobile(&self) -> bool { self.mobile }
356    pub fn bitness(&self) -> Option<&str> { self.bitness.as_deref() }
357    pub fn wow64(&self) -> Option<bool> { self.wow64 }
358    pub fn formFactors(&self) -> Option<&[Cow<'a, str>]> { self.formFactors.as_deref() }
359}
360
361
362pub struct UserAgentMetadataBuilder<'a> {
363    brands: Option<Vec<UserAgentBrandVersion<'a>>>,
364    fullVersionList: Option<Vec<UserAgentBrandVersion<'a>>>,
365    fullVersion: Option<Cow<'a, str>>,
366    platform: Cow<'a, str>,
367    platformVersion: Cow<'a, str>,
368    architecture: Cow<'a, str>,
369    model: Cow<'a, str>,
370    mobile: bool,
371    bitness: Option<Cow<'a, str>>,
372    wow64: Option<bool>,
373    formFactors: Option<Vec<Cow<'a, str>>>,
374}
375
376impl<'a> UserAgentMetadataBuilder<'a> {
377    /// Brands appearing in Sec-CH-UA.
378    pub fn brands(mut self, brands: Vec<UserAgentBrandVersion<'a>>) -> Self { self.brands = Some(brands); self }
379    /// Brands appearing in Sec-CH-UA-Full-Version-List.
380    pub fn fullVersionList(mut self, fullVersionList: Vec<UserAgentBrandVersion<'a>>) -> Self { self.fullVersionList = Some(fullVersionList); self }
381    pub fn fullVersion(mut self, fullVersion: impl Into<Cow<'a, str>>) -> Self { self.fullVersion = Some(fullVersion.into()); self }
382    pub fn bitness(mut self, bitness: impl Into<Cow<'a, str>>) -> Self { self.bitness = Some(bitness.into()); self }
383    pub fn wow64(mut self, wow64: bool) -> Self { self.wow64 = Some(wow64); self }
384    /// Used to specify User Agent form-factor values.
385    /// See https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors
386    pub fn formFactors(mut self, formFactors: Vec<Cow<'a, str>>) -> Self { self.formFactors = Some(formFactors); self }
387    pub fn build(self) -> UserAgentMetadata<'a> {
388        UserAgentMetadata {
389            brands: self.brands,
390            fullVersionList: self.fullVersionList,
391            fullVersion: self.fullVersion,
392            platform: self.platform,
393            platformVersion: self.platformVersion,
394            architecture: self.architecture,
395            model: self.model,
396            mobile: self.mobile,
397            bitness: self.bitness,
398            wow64: self.wow64,
399            formFactors: self.formFactors,
400        }
401    }
402}
403
404/// Used to specify sensor types to emulate.
405/// See https://w3c.github.io/sensors/#automation for more information.
406
407#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
408pub enum SensorType {
409    #[default]
410    #[serde(rename = "absolute-orientation")]
411    AbsoluteOrientation,
412    #[serde(rename = "accelerometer")]
413    Accelerometer,
414    #[serde(rename = "ambient-light")]
415    AmbientLight,
416    #[serde(rename = "gravity")]
417    Gravity,
418    #[serde(rename = "gyroscope")]
419    Gyroscope,
420    #[serde(rename = "linear-acceleration")]
421    LinearAcceleration,
422    #[serde(rename = "magnetometer")]
423    Magnetometer,
424    #[serde(rename = "relative-orientation")]
425    RelativeOrientation,
426}
427
428
429#[derive(Debug, Clone, Serialize, Deserialize, Default)]
430#[serde(rename_all = "camelCase")]
431pub struct SensorMetadata {
432    #[serde(skip_serializing_if = "Option::is_none")]
433    available: Option<bool>,
434    #[serde(skip_serializing_if = "Option::is_none")]
435    minimumFrequency: Option<f64>,
436    #[serde(skip_serializing_if = "Option::is_none")]
437    maximumFrequency: Option<f64>,
438}
439
440impl SensorMetadata {
441    pub fn builder() -> SensorMetadataBuilder {
442        SensorMetadataBuilder {
443            available: None,
444            minimumFrequency: None,
445            maximumFrequency: None,
446        }
447    }
448    pub fn available(&self) -> Option<bool> { self.available }
449    pub fn minimumFrequency(&self) -> Option<f64> { self.minimumFrequency }
450    pub fn maximumFrequency(&self) -> Option<f64> { self.maximumFrequency }
451}
452
453#[derive(Default)]
454pub struct SensorMetadataBuilder {
455    available: Option<bool>,
456    minimumFrequency: Option<f64>,
457    maximumFrequency: Option<f64>,
458}
459
460impl SensorMetadataBuilder {
461    pub fn available(mut self, available: bool) -> Self { self.available = Some(available); self }
462    pub fn minimumFrequency(mut self, minimumFrequency: f64) -> Self { self.minimumFrequency = Some(minimumFrequency); self }
463    pub fn maximumFrequency(mut self, maximumFrequency: f64) -> Self { self.maximumFrequency = Some(maximumFrequency); self }
464    pub fn build(self) -> SensorMetadata {
465        SensorMetadata {
466            available: self.available,
467            minimumFrequency: self.minimumFrequency,
468            maximumFrequency: self.maximumFrequency,
469        }
470    }
471}
472
473
474#[derive(Debug, Clone, Serialize, Deserialize, Default)]
475#[serde(rename_all = "camelCase")]
476pub struct SensorReadingSingle {
477    value: f64,
478}
479
480impl SensorReadingSingle {
481    pub fn builder(value: f64) -> SensorReadingSingleBuilder {
482        SensorReadingSingleBuilder {
483            value: value,
484        }
485    }
486    pub fn value(&self) -> f64 { self.value }
487}
488
489
490pub struct SensorReadingSingleBuilder {
491    value: f64,
492}
493
494impl SensorReadingSingleBuilder {
495    pub fn build(self) -> SensorReadingSingle {
496        SensorReadingSingle {
497            value: self.value,
498        }
499    }
500}
501
502
503#[derive(Debug, Clone, Serialize, Deserialize, Default)]
504#[serde(rename_all = "camelCase")]
505pub struct SensorReadingXYZ {
506    x: f64,
507    y: f64,
508    z: f64,
509}
510
511impl SensorReadingXYZ {
512    pub fn builder(x: f64, y: f64, z: f64) -> SensorReadingXYZBuilder {
513        SensorReadingXYZBuilder {
514            x: x,
515            y: y,
516            z: z,
517        }
518    }
519    pub fn x(&self) -> f64 { self.x }
520    pub fn y(&self) -> f64 { self.y }
521    pub fn z(&self) -> f64 { self.z }
522}
523
524
525pub struct SensorReadingXYZBuilder {
526    x: f64,
527    y: f64,
528    z: f64,
529}
530
531impl SensorReadingXYZBuilder {
532    pub fn build(self) -> SensorReadingXYZ {
533        SensorReadingXYZ {
534            x: self.x,
535            y: self.y,
536            z: self.z,
537        }
538    }
539}
540
541
542#[derive(Debug, Clone, Serialize, Deserialize, Default)]
543#[serde(rename_all = "camelCase")]
544pub struct SensorReadingQuaternion {
545    x: f64,
546    y: f64,
547    z: f64,
548    w: f64,
549}
550
551impl SensorReadingQuaternion {
552    pub fn builder(x: f64, y: f64, z: f64, w: f64) -> SensorReadingQuaternionBuilder {
553        SensorReadingQuaternionBuilder {
554            x: x,
555            y: y,
556            z: z,
557            w: w,
558        }
559    }
560    pub fn x(&self) -> f64 { self.x }
561    pub fn y(&self) -> f64 { self.y }
562    pub fn z(&self) -> f64 { self.z }
563    pub fn w(&self) -> f64 { self.w }
564}
565
566
567pub struct SensorReadingQuaternionBuilder {
568    x: f64,
569    y: f64,
570    z: f64,
571    w: f64,
572}
573
574impl SensorReadingQuaternionBuilder {
575    pub fn build(self) -> SensorReadingQuaternion {
576        SensorReadingQuaternion {
577            x: self.x,
578            y: self.y,
579            z: self.z,
580            w: self.w,
581        }
582    }
583}
584
585
586#[derive(Debug, Clone, Serialize, Deserialize, Default)]
587#[serde(rename_all = "camelCase")]
588pub struct SensorReading {
589    #[serde(skip_serializing_if = "Option::is_none")]
590    single: Option<SensorReadingSingle>,
591    #[serde(skip_serializing_if = "Option::is_none")]
592    xyz: Option<SensorReadingXYZ>,
593    #[serde(skip_serializing_if = "Option::is_none")]
594    quaternion: Option<SensorReadingQuaternion>,
595}
596
597impl SensorReading {
598    pub fn builder() -> SensorReadingBuilder {
599        SensorReadingBuilder {
600            single: None,
601            xyz: None,
602            quaternion: None,
603        }
604    }
605    pub fn single(&self) -> Option<&SensorReadingSingle> { self.single.as_ref() }
606    pub fn xyz(&self) -> Option<&SensorReadingXYZ> { self.xyz.as_ref() }
607    pub fn quaternion(&self) -> Option<&SensorReadingQuaternion> { self.quaternion.as_ref() }
608}
609
610#[derive(Default)]
611pub struct SensorReadingBuilder {
612    single: Option<SensorReadingSingle>,
613    xyz: Option<SensorReadingXYZ>,
614    quaternion: Option<SensorReadingQuaternion>,
615}
616
617impl SensorReadingBuilder {
618    pub fn single(mut self, single: SensorReadingSingle) -> Self { self.single = Some(single); self }
619    pub fn xyz(mut self, xyz: SensorReadingXYZ) -> Self { self.xyz = Some(xyz); self }
620    pub fn quaternion(mut self, quaternion: SensorReadingQuaternion) -> Self { self.quaternion = Some(quaternion); self }
621    pub fn build(self) -> SensorReading {
622        SensorReading {
623            single: self.single,
624            xyz: self.xyz,
625            quaternion: self.quaternion,
626        }
627    }
628}
629
630
631#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
632pub enum PressureSource {
633    #[default]
634    #[serde(rename = "cpu")]
635    Cpu,
636}
637
638
639#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
640pub enum PressureState {
641    #[default]
642    #[serde(rename = "nominal")]
643    Nominal,
644    #[serde(rename = "fair")]
645    Fair,
646    #[serde(rename = "serious")]
647    Serious,
648    #[serde(rename = "critical")]
649    Critical,
650}
651
652
653#[derive(Debug, Clone, Serialize, Deserialize, Default)]
654#[serde(rename_all = "camelCase")]
655pub struct PressureMetadata {
656    #[serde(skip_serializing_if = "Option::is_none")]
657    available: Option<bool>,
658}
659
660impl PressureMetadata {
661    pub fn builder() -> PressureMetadataBuilder {
662        PressureMetadataBuilder {
663            available: None,
664        }
665    }
666    pub fn available(&self) -> Option<bool> { self.available }
667}
668
669#[derive(Default)]
670pub struct PressureMetadataBuilder {
671    available: Option<bool>,
672}
673
674impl PressureMetadataBuilder {
675    pub fn available(mut self, available: bool) -> Self { self.available = Some(available); self }
676    pub fn build(self) -> PressureMetadata {
677        PressureMetadata {
678            available: self.available,
679        }
680    }
681}
682
683
684#[derive(Debug, Clone, Serialize, Deserialize, Default)]
685#[serde(rename_all = "camelCase")]
686pub struct WorkAreaInsets {
687    /// Work area top inset in pixels. Default is 0;
688    #[serde(skip_serializing_if = "Option::is_none")]
689    top: Option<i64>,
690    /// Work area left inset in pixels. Default is 0;
691    #[serde(skip_serializing_if = "Option::is_none")]
692    left: Option<i64>,
693    /// Work area bottom inset in pixels. Default is 0;
694    #[serde(skip_serializing_if = "Option::is_none")]
695    bottom: Option<i64>,
696    /// Work area right inset in pixels. Default is 0;
697    #[serde(skip_serializing_if = "Option::is_none")]
698    right: Option<i64>,
699}
700
701impl WorkAreaInsets {
702    pub fn builder() -> WorkAreaInsetsBuilder {
703        WorkAreaInsetsBuilder {
704            top: None,
705            left: None,
706            bottom: None,
707            right: None,
708        }
709    }
710    pub fn top(&self) -> Option<i64> { self.top }
711    pub fn left(&self) -> Option<i64> { self.left }
712    pub fn bottom(&self) -> Option<i64> { self.bottom }
713    pub fn right(&self) -> Option<i64> { self.right }
714}
715
716#[derive(Default)]
717pub struct WorkAreaInsetsBuilder {
718    top: Option<i64>,
719    left: Option<i64>,
720    bottom: Option<i64>,
721    right: Option<i64>,
722}
723
724impl WorkAreaInsetsBuilder {
725    /// Work area top inset in pixels. Default is 0;
726    pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
727    /// Work area left inset in pixels. Default is 0;
728    pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
729    /// Work area bottom inset in pixels. Default is 0;
730    pub fn bottom(mut self, bottom: i64) -> Self { self.bottom = Some(bottom); self }
731    /// Work area right inset in pixels. Default is 0;
732    pub fn right(mut self, right: i64) -> Self { self.right = Some(right); self }
733    pub fn build(self) -> WorkAreaInsets {
734        WorkAreaInsets {
735            top: self.top,
736            left: self.left,
737            bottom: self.bottom,
738            right: self.right,
739        }
740    }
741}
742
743
744pub type ScreenId<'a> = Cow<'a, str>;
745
746/// Screen information similar to the one returned by window.getScreenDetails() method,
747/// see https://w3c.github.io/window-management/#screendetailed.
748
749#[derive(Debug, Clone, Serialize, Deserialize, Default)]
750#[serde(rename_all = "camelCase")]
751pub struct ScreenInfo<'a> {
752    /// Offset of the left edge of the screen.
753    left: i64,
754    /// Offset of the top edge of the screen.
755    top: i64,
756    /// Width of the screen.
757    width: u64,
758    /// Height of the screen.
759    height: i64,
760    /// Offset of the left edge of the available screen area.
761    availLeft: i64,
762    /// Offset of the top edge of the available screen area.
763    availTop: i64,
764    /// Width of the available screen area.
765    availWidth: u64,
766    /// Height of the available screen area.
767    availHeight: i64,
768    /// Specifies the screen's device pixel ratio.
769    devicePixelRatio: f64,
770    /// Specifies the screen's orientation.
771    orientation: ScreenOrientation<'a>,
772    /// Specifies the screen's color depth in bits.
773    colorDepth: i64,
774    /// Indicates whether the device has multiple screens.
775    isExtended: bool,
776    /// Indicates whether the screen is internal to the device or external, attached to the device.
777    isInternal: bool,
778    /// Indicates whether the screen is set as the the operating system primary screen.
779    isPrimary: bool,
780    /// Specifies the descriptive label for the screen.
781    label: Cow<'a, str>,
782    /// Specifies the unique identifier of the screen.
783    id: ScreenId<'a>,
784}
785
786impl<'a> ScreenInfo<'a> {
787    pub fn builder(left: i64, top: i64, width: u64, height: i64, availLeft: i64, availTop: i64, availWidth: u64, availHeight: i64, devicePixelRatio: f64, orientation: ScreenOrientation<'a>, colorDepth: i64, isExtended: bool, isInternal: bool, isPrimary: bool, label: impl Into<Cow<'a, str>>, id: ScreenId<'a>) -> ScreenInfoBuilder<'a> {
788        ScreenInfoBuilder {
789            left: left,
790            top: top,
791            width: width,
792            height: height,
793            availLeft: availLeft,
794            availTop: availTop,
795            availWidth: availWidth,
796            availHeight: availHeight,
797            devicePixelRatio: devicePixelRatio,
798            orientation: orientation,
799            colorDepth: colorDepth,
800            isExtended: isExtended,
801            isInternal: isInternal,
802            isPrimary: isPrimary,
803            label: label.into(),
804            id: id,
805        }
806    }
807    pub fn left(&self) -> i64 { self.left }
808    pub fn top(&self) -> i64 { self.top }
809    pub fn width(&self) -> u64 { self.width }
810    pub fn height(&self) -> i64 { self.height }
811    pub fn availLeft(&self) -> i64 { self.availLeft }
812    pub fn availTop(&self) -> i64 { self.availTop }
813    pub fn availWidth(&self) -> u64 { self.availWidth }
814    pub fn availHeight(&self) -> i64 { self.availHeight }
815    pub fn devicePixelRatio(&self) -> f64 { self.devicePixelRatio }
816    pub fn orientation(&self) -> &ScreenOrientation<'a> { &self.orientation }
817    pub fn colorDepth(&self) -> i64 { self.colorDepth }
818    pub fn isExtended(&self) -> bool { self.isExtended }
819    pub fn isInternal(&self) -> bool { self.isInternal }
820    pub fn isPrimary(&self) -> bool { self.isPrimary }
821    pub fn label(&self) -> &str { self.label.as_ref() }
822    pub fn id(&self) -> &ScreenId<'a> { &self.id }
823}
824
825
826pub struct ScreenInfoBuilder<'a> {
827    left: i64,
828    top: i64,
829    width: u64,
830    height: i64,
831    availLeft: i64,
832    availTop: i64,
833    availWidth: u64,
834    availHeight: i64,
835    devicePixelRatio: f64,
836    orientation: ScreenOrientation<'a>,
837    colorDepth: i64,
838    isExtended: bool,
839    isInternal: bool,
840    isPrimary: bool,
841    label: Cow<'a, str>,
842    id: ScreenId<'a>,
843}
844
845impl<'a> ScreenInfoBuilder<'a> {
846    pub fn build(self) -> ScreenInfo<'a> {
847        ScreenInfo {
848            left: self.left,
849            top: self.top,
850            width: self.width,
851            height: self.height,
852            availLeft: self.availLeft,
853            availTop: self.availTop,
854            availWidth: self.availWidth,
855            availHeight: self.availHeight,
856            devicePixelRatio: self.devicePixelRatio,
857            orientation: self.orientation,
858            colorDepth: self.colorDepth,
859            isExtended: self.isExtended,
860            isInternal: self.isInternal,
861            isPrimary: self.isPrimary,
862            label: self.label,
863            id: self.id,
864        }
865    }
866}
867
868/// Enum of image types that can be disabled.
869
870#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
871pub enum DisabledImageType {
872    #[default]
873    #[serde(rename = "avif")]
874    Avif,
875    #[serde(rename = "jxl")]
876    Jxl,
877    #[serde(rename = "webp")]
878    Webp,
879}
880
881/// Tells whether emulation is supported.
882
883#[derive(Debug, Clone, Serialize, Deserialize, Default)]
884#[serde(rename_all = "camelCase")]
885pub struct CanEmulateReturns {
886    /// True if emulation is supported.
887    result: bool,
888}
889
890impl CanEmulateReturns {
891    pub fn builder(result: bool) -> CanEmulateReturnsBuilder {
892        CanEmulateReturnsBuilder {
893            result: result,
894        }
895    }
896    pub fn result(&self) -> bool { self.result }
897}
898
899
900pub struct CanEmulateReturnsBuilder {
901    result: bool,
902}
903
904impl CanEmulateReturnsBuilder {
905    pub fn build(self) -> CanEmulateReturns {
906        CanEmulateReturns {
907            result: self.result,
908        }
909    }
910}
911
912#[derive(Debug, Clone, Serialize, Deserialize, Default)]
913pub struct CanEmulateParams {}
914
915impl CanEmulateParams { pub const METHOD: &'static str = "Emulation.canEmulate"; }
916
917impl<'a> crate::CdpCommand<'a> for CanEmulateParams {
918    const METHOD: &'static str = "Emulation.canEmulate";
919    type Response = CanEmulateReturns;
920}
921
922#[derive(Debug, Clone, Serialize, Deserialize, Default)]
923pub struct ClearDeviceMetricsOverrideParams {}
924
925impl ClearDeviceMetricsOverrideParams { pub const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride"; }
926
927impl<'a> crate::CdpCommand<'a> for ClearDeviceMetricsOverrideParams {
928    const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride";
929    type Response = crate::EmptyReturns;
930}
931
932#[derive(Debug, Clone, Serialize, Deserialize, Default)]
933pub struct ClearGeolocationOverrideParams {}
934
935impl ClearGeolocationOverrideParams { pub const METHOD: &'static str = "Emulation.clearGeolocationOverride"; }
936
937impl<'a> crate::CdpCommand<'a> for ClearGeolocationOverrideParams {
938    const METHOD: &'static str = "Emulation.clearGeolocationOverride";
939    type Response = crate::EmptyReturns;
940}
941
942#[derive(Debug, Clone, Serialize, Deserialize, Default)]
943pub struct ResetPageScaleFactorParams {}
944
945impl ResetPageScaleFactorParams { pub const METHOD: &'static str = "Emulation.resetPageScaleFactor"; }
946
947impl<'a> crate::CdpCommand<'a> for ResetPageScaleFactorParams {
948    const METHOD: &'static str = "Emulation.resetPageScaleFactor";
949    type Response = crate::EmptyReturns;
950}
951
952/// Enables or disables simulating a focused and active page.
953
954#[derive(Debug, Clone, Serialize, Deserialize, Default)]
955#[serde(rename_all = "camelCase")]
956pub struct SetFocusEmulationEnabledParams {
957    /// Whether to enable to disable focus emulation.
958    enabled: bool,
959}
960
961impl SetFocusEmulationEnabledParams {
962    pub fn builder(enabled: bool) -> SetFocusEmulationEnabledParamsBuilder {
963        SetFocusEmulationEnabledParamsBuilder {
964            enabled: enabled,
965        }
966    }
967    pub fn enabled(&self) -> bool { self.enabled }
968}
969
970
971pub struct SetFocusEmulationEnabledParamsBuilder {
972    enabled: bool,
973}
974
975impl SetFocusEmulationEnabledParamsBuilder {
976    pub fn build(self) -> SetFocusEmulationEnabledParams {
977        SetFocusEmulationEnabledParams {
978            enabled: self.enabled,
979        }
980    }
981}
982
983impl SetFocusEmulationEnabledParams { pub const METHOD: &'static str = "Emulation.setFocusEmulationEnabled"; }
984
985impl<'a> crate::CdpCommand<'a> for SetFocusEmulationEnabledParams {
986    const METHOD: &'static str = "Emulation.setFocusEmulationEnabled";
987    type Response = crate::EmptyReturns;
988}
989
990/// Automatically render all web contents using a dark theme.
991
992#[derive(Debug, Clone, Serialize, Deserialize, Default)]
993#[serde(rename_all = "camelCase")]
994pub struct SetAutoDarkModeOverrideParams {
995    /// Whether to enable or disable automatic dark mode.
996    /// If not specified, any existing override will be cleared.
997    #[serde(skip_serializing_if = "Option::is_none")]
998    enabled: Option<bool>,
999}
1000
1001impl SetAutoDarkModeOverrideParams {
1002    pub fn builder() -> SetAutoDarkModeOverrideParamsBuilder {
1003        SetAutoDarkModeOverrideParamsBuilder {
1004            enabled: None,
1005        }
1006    }
1007    pub fn enabled(&self) -> Option<bool> { self.enabled }
1008}
1009
1010#[derive(Default)]
1011pub struct SetAutoDarkModeOverrideParamsBuilder {
1012    enabled: Option<bool>,
1013}
1014
1015impl SetAutoDarkModeOverrideParamsBuilder {
1016    /// Whether to enable or disable automatic dark mode.
1017    /// If not specified, any existing override will be cleared.
1018    pub fn enabled(mut self, enabled: bool) -> Self { self.enabled = Some(enabled); self }
1019    pub fn build(self) -> SetAutoDarkModeOverrideParams {
1020        SetAutoDarkModeOverrideParams {
1021            enabled: self.enabled,
1022        }
1023    }
1024}
1025
1026impl SetAutoDarkModeOverrideParams { pub const METHOD: &'static str = "Emulation.setAutoDarkModeOverride"; }
1027
1028impl<'a> crate::CdpCommand<'a> for SetAutoDarkModeOverrideParams {
1029    const METHOD: &'static str = "Emulation.setAutoDarkModeOverride";
1030    type Response = crate::EmptyReturns;
1031}
1032
1033/// Enables CPU throttling to emulate slow CPUs.
1034
1035#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1036#[serde(rename_all = "camelCase")]
1037pub struct SetCPUThrottlingRateParams {
1038    /// Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
1039    rate: f64,
1040}
1041
1042impl SetCPUThrottlingRateParams {
1043    pub fn builder(rate: f64) -> SetCPUThrottlingRateParamsBuilder {
1044        SetCPUThrottlingRateParamsBuilder {
1045            rate: rate,
1046        }
1047    }
1048    pub fn rate(&self) -> f64 { self.rate }
1049}
1050
1051
1052pub struct SetCPUThrottlingRateParamsBuilder {
1053    rate: f64,
1054}
1055
1056impl SetCPUThrottlingRateParamsBuilder {
1057    pub fn build(self) -> SetCPUThrottlingRateParams {
1058        SetCPUThrottlingRateParams {
1059            rate: self.rate,
1060        }
1061    }
1062}
1063
1064impl SetCPUThrottlingRateParams { pub const METHOD: &'static str = "Emulation.setCPUThrottlingRate"; }
1065
1066impl<'a> crate::CdpCommand<'a> for SetCPUThrottlingRateParams {
1067    const METHOD: &'static str = "Emulation.setCPUThrottlingRate";
1068    type Response = crate::EmptyReturns;
1069}
1070
1071/// Sets or clears an override of the default background color of the frame. This override is used
1072/// if the content does not specify one.
1073
1074#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1075#[serde(rename_all = "camelCase")]
1076pub struct SetDefaultBackgroundColorOverrideParams {
1077    /// RGBA of the default background color. If not specified, any existing override will be
1078    /// cleared.
1079    #[serde(skip_serializing_if = "Option::is_none")]
1080    color: Option<crate::dom::RGBA>,
1081}
1082
1083impl SetDefaultBackgroundColorOverrideParams {
1084    pub fn builder() -> SetDefaultBackgroundColorOverrideParamsBuilder {
1085        SetDefaultBackgroundColorOverrideParamsBuilder {
1086            color: None,
1087        }
1088    }
1089    pub fn color(&self) -> Option<&crate::dom::RGBA> { self.color.as_ref() }
1090}
1091
1092#[derive(Default)]
1093pub struct SetDefaultBackgroundColorOverrideParamsBuilder {
1094    color: Option<crate::dom::RGBA>,
1095}
1096
1097impl SetDefaultBackgroundColorOverrideParamsBuilder {
1098    /// RGBA of the default background color. If not specified, any existing override will be
1099    /// cleared.
1100    pub fn color(mut self, color: crate::dom::RGBA) -> Self { self.color = Some(color); self }
1101    pub fn build(self) -> SetDefaultBackgroundColorOverrideParams {
1102        SetDefaultBackgroundColorOverrideParams {
1103            color: self.color,
1104        }
1105    }
1106}
1107
1108impl SetDefaultBackgroundColorOverrideParams { pub const METHOD: &'static str = "Emulation.setDefaultBackgroundColorOverride"; }
1109
1110impl<'a> crate::CdpCommand<'a> for SetDefaultBackgroundColorOverrideParams {
1111    const METHOD: &'static str = "Emulation.setDefaultBackgroundColorOverride";
1112    type Response = crate::EmptyReturns;
1113}
1114
1115/// Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the
1116/// respective variables to be undefined, even if previously overridden.
1117
1118#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1119#[serde(rename_all = "camelCase")]
1120pub struct SetSafeAreaInsetsOverrideParams {
1121    insets: SafeAreaInsets,
1122}
1123
1124impl SetSafeAreaInsetsOverrideParams {
1125    pub fn builder(insets: SafeAreaInsets) -> SetSafeAreaInsetsOverrideParamsBuilder {
1126        SetSafeAreaInsetsOverrideParamsBuilder {
1127            insets: insets,
1128        }
1129    }
1130    pub fn insets(&self) -> &SafeAreaInsets { &self.insets }
1131}
1132
1133
1134pub struct SetSafeAreaInsetsOverrideParamsBuilder {
1135    insets: SafeAreaInsets,
1136}
1137
1138impl SetSafeAreaInsetsOverrideParamsBuilder {
1139    pub fn build(self) -> SetSafeAreaInsetsOverrideParams {
1140        SetSafeAreaInsetsOverrideParams {
1141            insets: self.insets,
1142        }
1143    }
1144}
1145
1146impl SetSafeAreaInsetsOverrideParams { pub const METHOD: &'static str = "Emulation.setSafeAreaInsetsOverride"; }
1147
1148impl<'a> crate::CdpCommand<'a> for SetSafeAreaInsetsOverrideParams {
1149    const METHOD: &'static str = "Emulation.setSafeAreaInsetsOverride";
1150    type Response = crate::EmptyReturns;
1151}
1152
1153/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
1154/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
1155/// query results).
1156
1157#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1158#[serde(rename_all = "camelCase")]
1159pub struct SetDeviceMetricsOverrideParams<'a> {
1160    /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1161    width: u64,
1162    /// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1163    height: i64,
1164    /// Overriding device scale factor value. 0 disables the override.
1165    deviceScaleFactor: f64,
1166    /// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text
1167    /// autosizing and more.
1168    mobile: bool,
1169    /// Scale to apply to resulting view image.
1170    #[serde(skip_serializing_if = "Option::is_none")]
1171    scale: Option<f64>,
1172    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
1173    #[serde(skip_serializing_if = "Option::is_none")]
1174    screenWidth: Option<u64>,
1175    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
1176    #[serde(skip_serializing_if = "Option::is_none")]
1177    screenHeight: Option<i64>,
1178    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
1179    #[serde(skip_serializing_if = "Option::is_none")]
1180    positionX: Option<i64>,
1181    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
1182    #[serde(skip_serializing_if = "Option::is_none")]
1183    positionY: Option<i64>,
1184    /// Do not set visible view size, rely upon explicit setVisibleSize call.
1185    #[serde(skip_serializing_if = "Option::is_none")]
1186    dontSetVisibleSize: Option<bool>,
1187    /// Screen orientation override.
1188    #[serde(skip_serializing_if = "Option::is_none")]
1189    screenOrientation: Option<ScreenOrientation<'a>>,
1190    /// If set, the visible area of the page will be overridden to this viewport. This viewport
1191    /// change is not observed by the page, e.g. viewport-relative elements do not change positions.
1192    #[serde(skip_serializing_if = "Option::is_none")]
1193    viewport: Option<crate::page::Viewport>,
1194    /// If set, the display feature of a multi-segment screen. If not set, multi-segment support
1195    /// is turned-off.
1196    /// Deprecated, use Emulation.setDisplayFeaturesOverride.
1197    #[serde(skip_serializing_if = "Option::is_none")]
1198    displayFeature: Option<DisplayFeature<'a>>,
1199    /// If set, the posture of a foldable device. If not set the posture is set
1200    /// to continuous.
1201    /// Deprecated, use Emulation.setDevicePostureOverride.
1202    #[serde(skip_serializing_if = "Option::is_none")]
1203    devicePosture: Option<DevicePosture<'a>>,
1204    /// Scrollbar type. Default: 'default'.
1205    #[serde(skip_serializing_if = "Option::is_none")]
1206    scrollbarType: Option<Cow<'a, str>>,
1207    /// If set to true, enables screen orientation lock emulation, which
1208    /// intercepts screen.orientation.lock() calls from the page and reports
1209    /// orientation changes via screenOrientationLockChanged events. This is
1210    /// useful for emulating mobile device orientation lock behavior in
1211    /// responsive design mode.
1212    #[serde(skip_serializing_if = "Option::is_none")]
1213    screenOrientationLockEmulation: Option<bool>,
1214}
1215
1216impl<'a> SetDeviceMetricsOverrideParams<'a> {
1217    pub fn builder(width: u64, height: i64, deviceScaleFactor: f64, mobile: bool) -> SetDeviceMetricsOverrideParamsBuilder<'a> {
1218        SetDeviceMetricsOverrideParamsBuilder {
1219            width: width,
1220            height: height,
1221            deviceScaleFactor: deviceScaleFactor,
1222            mobile: mobile,
1223            scale: None,
1224            screenWidth: None,
1225            screenHeight: None,
1226            positionX: None,
1227            positionY: None,
1228            dontSetVisibleSize: None,
1229            screenOrientation: None,
1230            viewport: None,
1231            displayFeature: None,
1232            devicePosture: None,
1233            scrollbarType: None,
1234            screenOrientationLockEmulation: None,
1235        }
1236    }
1237    pub fn width(&self) -> u64 { self.width }
1238    pub fn height(&self) -> i64 { self.height }
1239    pub fn deviceScaleFactor(&self) -> f64 { self.deviceScaleFactor }
1240    pub fn mobile(&self) -> bool { self.mobile }
1241    pub fn scale(&self) -> Option<f64> { self.scale }
1242    pub fn screenWidth(&self) -> Option<u64> { self.screenWidth }
1243    pub fn screenHeight(&self) -> Option<i64> { self.screenHeight }
1244    pub fn positionX(&self) -> Option<i64> { self.positionX }
1245    pub fn positionY(&self) -> Option<i64> { self.positionY }
1246    pub fn dontSetVisibleSize(&self) -> Option<bool> { self.dontSetVisibleSize }
1247    pub fn screenOrientation(&self) -> Option<&ScreenOrientation<'a>> { self.screenOrientation.as_ref() }
1248    pub fn viewport(&self) -> Option<&crate::page::Viewport> { self.viewport.as_ref() }
1249    pub fn displayFeature(&self) -> Option<&DisplayFeature<'a>> { self.displayFeature.as_ref() }
1250    pub fn devicePosture(&self) -> Option<&DevicePosture<'a>> { self.devicePosture.as_ref() }
1251    pub fn scrollbarType(&self) -> Option<&str> { self.scrollbarType.as_deref() }
1252    pub fn screenOrientationLockEmulation(&self) -> Option<bool> { self.screenOrientationLockEmulation }
1253}
1254
1255
1256pub struct SetDeviceMetricsOverrideParamsBuilder<'a> {
1257    width: u64,
1258    height: i64,
1259    deviceScaleFactor: f64,
1260    mobile: bool,
1261    scale: Option<f64>,
1262    screenWidth: Option<u64>,
1263    screenHeight: Option<i64>,
1264    positionX: Option<i64>,
1265    positionY: Option<i64>,
1266    dontSetVisibleSize: Option<bool>,
1267    screenOrientation: Option<ScreenOrientation<'a>>,
1268    viewport: Option<crate::page::Viewport>,
1269    displayFeature: Option<DisplayFeature<'a>>,
1270    devicePosture: Option<DevicePosture<'a>>,
1271    scrollbarType: Option<Cow<'a, str>>,
1272    screenOrientationLockEmulation: Option<bool>,
1273}
1274
1275impl<'a> SetDeviceMetricsOverrideParamsBuilder<'a> {
1276    /// Scale to apply to resulting view image.
1277    pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
1278    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
1279    pub fn screenWidth(mut self, screenWidth: u64) -> Self { self.screenWidth = Some(screenWidth); self }
1280    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
1281    pub fn screenHeight(mut self, screenHeight: i64) -> Self { self.screenHeight = Some(screenHeight); self }
1282    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
1283    pub fn positionX(mut self, positionX: i64) -> Self { self.positionX = Some(positionX); self }
1284    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
1285    pub fn positionY(mut self, positionY: i64) -> Self { self.positionY = Some(positionY); self }
1286    /// Do not set visible view size, rely upon explicit setVisibleSize call.
1287    pub fn dontSetVisibleSize(mut self, dontSetVisibleSize: bool) -> Self { self.dontSetVisibleSize = Some(dontSetVisibleSize); self }
1288    /// Screen orientation override.
1289    pub fn screenOrientation(mut self, screenOrientation: ScreenOrientation<'a>) -> Self { self.screenOrientation = Some(screenOrientation); self }
1290    /// If set, the visible area of the page will be overridden to this viewport. This viewport
1291    /// change is not observed by the page, e.g. viewport-relative elements do not change positions.
1292    pub fn viewport(mut self, viewport: crate::page::Viewport) -> Self { self.viewport = Some(viewport); self }
1293    /// If set, the display feature of a multi-segment screen. If not set, multi-segment support
1294    /// is turned-off.
1295    /// Deprecated, use Emulation.setDisplayFeaturesOverride.
1296    pub fn displayFeature(mut self, displayFeature: DisplayFeature<'a>) -> Self { self.displayFeature = Some(displayFeature); self }
1297    /// If set, the posture of a foldable device. If not set the posture is set
1298    /// to continuous.
1299    /// Deprecated, use Emulation.setDevicePostureOverride.
1300    pub fn devicePosture(mut self, devicePosture: DevicePosture<'a>) -> Self { self.devicePosture = Some(devicePosture); self }
1301    /// Scrollbar type. Default: 'default'.
1302    pub fn scrollbarType(mut self, scrollbarType: impl Into<Cow<'a, str>>) -> Self { self.scrollbarType = Some(scrollbarType.into()); self }
1303    /// If set to true, enables screen orientation lock emulation, which
1304    /// intercepts screen.orientation.lock() calls from the page and reports
1305    /// orientation changes via screenOrientationLockChanged events. This is
1306    /// useful for emulating mobile device orientation lock behavior in
1307    /// responsive design mode.
1308    pub fn screenOrientationLockEmulation(mut self, screenOrientationLockEmulation: bool) -> Self { self.screenOrientationLockEmulation = Some(screenOrientationLockEmulation); self }
1309    pub fn build(self) -> SetDeviceMetricsOverrideParams<'a> {
1310        SetDeviceMetricsOverrideParams {
1311            width: self.width,
1312            height: self.height,
1313            deviceScaleFactor: self.deviceScaleFactor,
1314            mobile: self.mobile,
1315            scale: self.scale,
1316            screenWidth: self.screenWidth,
1317            screenHeight: self.screenHeight,
1318            positionX: self.positionX,
1319            positionY: self.positionY,
1320            dontSetVisibleSize: self.dontSetVisibleSize,
1321            screenOrientation: self.screenOrientation,
1322            viewport: self.viewport,
1323            displayFeature: self.displayFeature,
1324            devicePosture: self.devicePosture,
1325            scrollbarType: self.scrollbarType,
1326            screenOrientationLockEmulation: self.screenOrientationLockEmulation,
1327        }
1328    }
1329}
1330
1331impl<'a> SetDeviceMetricsOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setDeviceMetricsOverride"; }
1332
1333impl<'a> crate::CdpCommand<'a> for SetDeviceMetricsOverrideParams<'a> {
1334    const METHOD: &'static str = "Emulation.setDeviceMetricsOverride";
1335    type Response = crate::EmptyReturns;
1336}
1337
1338/// Start reporting the given posture value to the Device Posture API.
1339/// This override can also be set in setDeviceMetricsOverride().
1340
1341#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1342#[serde(rename_all = "camelCase")]
1343pub struct SetDevicePostureOverrideParams<'a> {
1344    posture: DevicePosture<'a>,
1345}
1346
1347impl<'a> SetDevicePostureOverrideParams<'a> {
1348    pub fn builder(posture: DevicePosture<'a>) -> SetDevicePostureOverrideParamsBuilder<'a> {
1349        SetDevicePostureOverrideParamsBuilder {
1350            posture: posture,
1351        }
1352    }
1353    pub fn posture(&self) -> &DevicePosture<'a> { &self.posture }
1354}
1355
1356
1357pub struct SetDevicePostureOverrideParamsBuilder<'a> {
1358    posture: DevicePosture<'a>,
1359}
1360
1361impl<'a> SetDevicePostureOverrideParamsBuilder<'a> {
1362    pub fn build(self) -> SetDevicePostureOverrideParams<'a> {
1363        SetDevicePostureOverrideParams {
1364            posture: self.posture,
1365        }
1366    }
1367}
1368
1369impl<'a> SetDevicePostureOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setDevicePostureOverride"; }
1370
1371impl<'a> crate::CdpCommand<'a> for SetDevicePostureOverrideParams<'a> {
1372    const METHOD: &'static str = "Emulation.setDevicePostureOverride";
1373    type Response = crate::EmptyReturns;
1374}
1375
1376#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1377pub struct ClearDevicePostureOverrideParams {}
1378
1379impl ClearDevicePostureOverrideParams { pub const METHOD: &'static str = "Emulation.clearDevicePostureOverride"; }
1380
1381impl<'a> crate::CdpCommand<'a> for ClearDevicePostureOverrideParams {
1382    const METHOD: &'static str = "Emulation.clearDevicePostureOverride";
1383    type Response = crate::EmptyReturns;
1384}
1385
1386/// Start using the given display features to pupulate the Viewport Segments API.
1387/// This override can also be set in setDeviceMetricsOverride().
1388
1389#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1390#[serde(rename_all = "camelCase")]
1391pub struct SetDisplayFeaturesOverrideParams<'a> {
1392    features: Vec<DisplayFeature<'a>>,
1393}
1394
1395impl<'a> SetDisplayFeaturesOverrideParams<'a> {
1396    pub fn builder(features: Vec<DisplayFeature<'a>>) -> SetDisplayFeaturesOverrideParamsBuilder<'a> {
1397        SetDisplayFeaturesOverrideParamsBuilder {
1398            features: features,
1399        }
1400    }
1401    pub fn features(&self) -> &[DisplayFeature<'a>] { &self.features }
1402}
1403
1404
1405pub struct SetDisplayFeaturesOverrideParamsBuilder<'a> {
1406    features: Vec<DisplayFeature<'a>>,
1407}
1408
1409impl<'a> SetDisplayFeaturesOverrideParamsBuilder<'a> {
1410    pub fn build(self) -> SetDisplayFeaturesOverrideParams<'a> {
1411        SetDisplayFeaturesOverrideParams {
1412            features: self.features,
1413        }
1414    }
1415}
1416
1417impl<'a> SetDisplayFeaturesOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setDisplayFeaturesOverride"; }
1418
1419impl<'a> crate::CdpCommand<'a> for SetDisplayFeaturesOverrideParams<'a> {
1420    const METHOD: &'static str = "Emulation.setDisplayFeaturesOverride";
1421    type Response = crate::EmptyReturns;
1422}
1423
1424#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1425pub struct ClearDisplayFeaturesOverrideParams {}
1426
1427impl ClearDisplayFeaturesOverrideParams { pub const METHOD: &'static str = "Emulation.clearDisplayFeaturesOverride"; }
1428
1429impl<'a> crate::CdpCommand<'a> for ClearDisplayFeaturesOverrideParams {
1430    const METHOD: &'static str = "Emulation.clearDisplayFeaturesOverride";
1431    type Response = crate::EmptyReturns;
1432}
1433
1434
1435#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1436#[serde(rename_all = "camelCase")]
1437pub struct SetScrollbarsHiddenParams {
1438    /// Whether scrollbars should be always hidden.
1439    hidden: bool,
1440}
1441
1442impl SetScrollbarsHiddenParams {
1443    pub fn builder(hidden: bool) -> SetScrollbarsHiddenParamsBuilder {
1444        SetScrollbarsHiddenParamsBuilder {
1445            hidden: hidden,
1446        }
1447    }
1448    pub fn hidden(&self) -> bool { self.hidden }
1449}
1450
1451
1452pub struct SetScrollbarsHiddenParamsBuilder {
1453    hidden: bool,
1454}
1455
1456impl SetScrollbarsHiddenParamsBuilder {
1457    pub fn build(self) -> SetScrollbarsHiddenParams {
1458        SetScrollbarsHiddenParams {
1459            hidden: self.hidden,
1460        }
1461    }
1462}
1463
1464impl SetScrollbarsHiddenParams { pub const METHOD: &'static str = "Emulation.setScrollbarsHidden"; }
1465
1466impl<'a> crate::CdpCommand<'a> for SetScrollbarsHiddenParams {
1467    const METHOD: &'static str = "Emulation.setScrollbarsHidden";
1468    type Response = crate::EmptyReturns;
1469}
1470
1471
1472#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1473#[serde(rename_all = "camelCase")]
1474pub struct SetDocumentCookieDisabledParams {
1475    /// Whether document.coookie API should be disabled.
1476    disabled: bool,
1477}
1478
1479impl SetDocumentCookieDisabledParams {
1480    pub fn builder(disabled: bool) -> SetDocumentCookieDisabledParamsBuilder {
1481        SetDocumentCookieDisabledParamsBuilder {
1482            disabled: disabled,
1483        }
1484    }
1485    pub fn disabled(&self) -> bool { self.disabled }
1486}
1487
1488
1489pub struct SetDocumentCookieDisabledParamsBuilder {
1490    disabled: bool,
1491}
1492
1493impl SetDocumentCookieDisabledParamsBuilder {
1494    pub fn build(self) -> SetDocumentCookieDisabledParams {
1495        SetDocumentCookieDisabledParams {
1496            disabled: self.disabled,
1497        }
1498    }
1499}
1500
1501impl SetDocumentCookieDisabledParams { pub const METHOD: &'static str = "Emulation.setDocumentCookieDisabled"; }
1502
1503impl<'a> crate::CdpCommand<'a> for SetDocumentCookieDisabledParams {
1504    const METHOD: &'static str = "Emulation.setDocumentCookieDisabled";
1505    type Response = crate::EmptyReturns;
1506}
1507
1508
1509#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1510#[serde(rename_all = "camelCase")]
1511pub struct SetEmitTouchEventsForMouseParams<'a> {
1512    /// Whether touch emulation based on mouse input should be enabled.
1513    enabled: bool,
1514    /// Touch/gesture events configuration. Default: current platform.
1515    #[serde(skip_serializing_if = "Option::is_none")]
1516    configuration: Option<Cow<'a, str>>,
1517}
1518
1519impl<'a> SetEmitTouchEventsForMouseParams<'a> {
1520    pub fn builder(enabled: bool) -> SetEmitTouchEventsForMouseParamsBuilder<'a> {
1521        SetEmitTouchEventsForMouseParamsBuilder {
1522            enabled: enabled,
1523            configuration: None,
1524        }
1525    }
1526    pub fn enabled(&self) -> bool { self.enabled }
1527    pub fn configuration(&self) -> Option<&str> { self.configuration.as_deref() }
1528}
1529
1530
1531pub struct SetEmitTouchEventsForMouseParamsBuilder<'a> {
1532    enabled: bool,
1533    configuration: Option<Cow<'a, str>>,
1534}
1535
1536impl<'a> SetEmitTouchEventsForMouseParamsBuilder<'a> {
1537    /// Touch/gesture events configuration. Default: current platform.
1538    pub fn configuration(mut self, configuration: impl Into<Cow<'a, str>>) -> Self { self.configuration = Some(configuration.into()); self }
1539    pub fn build(self) -> SetEmitTouchEventsForMouseParams<'a> {
1540        SetEmitTouchEventsForMouseParams {
1541            enabled: self.enabled,
1542            configuration: self.configuration,
1543        }
1544    }
1545}
1546
1547impl<'a> SetEmitTouchEventsForMouseParams<'a> { pub const METHOD: &'static str = "Emulation.setEmitTouchEventsForMouse"; }
1548
1549impl<'a> crate::CdpCommand<'a> for SetEmitTouchEventsForMouseParams<'a> {
1550    const METHOD: &'static str = "Emulation.setEmitTouchEventsForMouse";
1551    type Response = crate::EmptyReturns;
1552}
1553
1554/// Emulates the given media type or media feature for CSS media queries.
1555
1556#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1557#[serde(rename_all = "camelCase")]
1558pub struct SetEmulatedMediaParams<'a> {
1559    /// Media type to emulate. Empty string disables the override.
1560    #[serde(skip_serializing_if = "Option::is_none")]
1561    media: Option<Cow<'a, str>>,
1562    /// Media features to emulate.
1563    #[serde(skip_serializing_if = "Option::is_none")]
1564    features: Option<Vec<MediaFeature<'a>>>,
1565}
1566
1567impl<'a> SetEmulatedMediaParams<'a> {
1568    pub fn builder() -> SetEmulatedMediaParamsBuilder<'a> {
1569        SetEmulatedMediaParamsBuilder {
1570            media: None,
1571            features: None,
1572        }
1573    }
1574    pub fn media(&self) -> Option<&str> { self.media.as_deref() }
1575    pub fn features(&self) -> Option<&[MediaFeature<'a>]> { self.features.as_deref() }
1576}
1577
1578#[derive(Default)]
1579pub struct SetEmulatedMediaParamsBuilder<'a> {
1580    media: Option<Cow<'a, str>>,
1581    features: Option<Vec<MediaFeature<'a>>>,
1582}
1583
1584impl<'a> SetEmulatedMediaParamsBuilder<'a> {
1585    /// Media type to emulate. Empty string disables the override.
1586    pub fn media(mut self, media: impl Into<Cow<'a, str>>) -> Self { self.media = Some(media.into()); self }
1587    /// Media features to emulate.
1588    pub fn features(mut self, features: Vec<MediaFeature<'a>>) -> Self { self.features = Some(features); self }
1589    pub fn build(self) -> SetEmulatedMediaParams<'a> {
1590        SetEmulatedMediaParams {
1591            media: self.media,
1592            features: self.features,
1593        }
1594    }
1595}
1596
1597impl<'a> SetEmulatedMediaParams<'a> { pub const METHOD: &'static str = "Emulation.setEmulatedMedia"; }
1598
1599impl<'a> crate::CdpCommand<'a> for SetEmulatedMediaParams<'a> {
1600    const METHOD: &'static str = "Emulation.setEmulatedMedia";
1601    type Response = crate::EmptyReturns;
1602}
1603
1604/// Emulates the given vision deficiency.
1605
1606#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1607#[serde(rename_all = "camelCase")]
1608pub struct SetEmulatedVisionDeficiencyParams<'a> {
1609    /// Vision deficiency to emulate. Order: best-effort emulations come first, followed by any
1610    /// physiologically accurate emulations for medically recognized color vision deficiencies.
1611    #[serde(rename = "type")]
1612    type_: Cow<'a, str>,
1613}
1614
1615impl<'a> SetEmulatedVisionDeficiencyParams<'a> {
1616    pub fn builder(type_: impl Into<Cow<'a, str>>) -> SetEmulatedVisionDeficiencyParamsBuilder<'a> {
1617        SetEmulatedVisionDeficiencyParamsBuilder {
1618            type_: type_.into(),
1619        }
1620    }
1621    pub fn type_(&self) -> &str { self.type_.as_ref() }
1622}
1623
1624
1625pub struct SetEmulatedVisionDeficiencyParamsBuilder<'a> {
1626    type_: Cow<'a, str>,
1627}
1628
1629impl<'a> SetEmulatedVisionDeficiencyParamsBuilder<'a> {
1630    pub fn build(self) -> SetEmulatedVisionDeficiencyParams<'a> {
1631        SetEmulatedVisionDeficiencyParams {
1632            type_: self.type_,
1633        }
1634    }
1635}
1636
1637impl<'a> SetEmulatedVisionDeficiencyParams<'a> { pub const METHOD: &'static str = "Emulation.setEmulatedVisionDeficiency"; }
1638
1639impl<'a> crate::CdpCommand<'a> for SetEmulatedVisionDeficiencyParams<'a> {
1640    const METHOD: &'static str = "Emulation.setEmulatedVisionDeficiency";
1641    type Response = crate::EmptyReturns;
1642}
1643
1644/// Emulates the given OS text scale.
1645
1646#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1647#[serde(rename_all = "camelCase")]
1648pub struct SetEmulatedOSTextScaleParams {
1649    #[serde(skip_serializing_if = "Option::is_none")]
1650    scale: Option<f64>,
1651}
1652
1653impl SetEmulatedOSTextScaleParams {
1654    pub fn builder() -> SetEmulatedOSTextScaleParamsBuilder {
1655        SetEmulatedOSTextScaleParamsBuilder {
1656            scale: None,
1657        }
1658    }
1659    pub fn scale(&self) -> Option<f64> { self.scale }
1660}
1661
1662#[derive(Default)]
1663pub struct SetEmulatedOSTextScaleParamsBuilder {
1664    scale: Option<f64>,
1665}
1666
1667impl SetEmulatedOSTextScaleParamsBuilder {
1668    pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
1669    pub fn build(self) -> SetEmulatedOSTextScaleParams {
1670        SetEmulatedOSTextScaleParams {
1671            scale: self.scale,
1672        }
1673    }
1674}
1675
1676impl SetEmulatedOSTextScaleParams { pub const METHOD: &'static str = "Emulation.setEmulatedOSTextScale"; }
1677
1678impl<'a> crate::CdpCommand<'a> for SetEmulatedOSTextScaleParams {
1679    const METHOD: &'static str = "Emulation.setEmulatedOSTextScale";
1680    type Response = crate::EmptyReturns;
1681}
1682
1683/// Overrides the Geolocation Position or Error. Omitting latitude, longitude or
1684/// accuracy emulates position unavailable.
1685
1686#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1687#[serde(rename_all = "camelCase")]
1688pub struct SetGeolocationOverrideParams {
1689    /// Mock latitude
1690    #[serde(skip_serializing_if = "Option::is_none")]
1691    latitude: Option<f64>,
1692    /// Mock longitude
1693    #[serde(skip_serializing_if = "Option::is_none")]
1694    longitude: Option<f64>,
1695    /// Mock accuracy
1696    #[serde(skip_serializing_if = "Option::is_none")]
1697    accuracy: Option<f64>,
1698    /// Mock altitude
1699    #[serde(skip_serializing_if = "Option::is_none")]
1700    altitude: Option<f64>,
1701    /// Mock altitudeAccuracy
1702    #[serde(skip_serializing_if = "Option::is_none")]
1703    altitudeAccuracy: Option<f64>,
1704    /// Mock heading
1705    #[serde(skip_serializing_if = "Option::is_none")]
1706    heading: Option<f64>,
1707    /// Mock speed
1708    #[serde(skip_serializing_if = "Option::is_none")]
1709    speed: Option<f64>,
1710}
1711
1712impl SetGeolocationOverrideParams {
1713    pub fn builder() -> SetGeolocationOverrideParamsBuilder {
1714        SetGeolocationOverrideParamsBuilder {
1715            latitude: None,
1716            longitude: None,
1717            accuracy: None,
1718            altitude: None,
1719            altitudeAccuracy: None,
1720            heading: None,
1721            speed: None,
1722        }
1723    }
1724    pub fn latitude(&self) -> Option<f64> { self.latitude }
1725    pub fn longitude(&self) -> Option<f64> { self.longitude }
1726    pub fn accuracy(&self) -> Option<f64> { self.accuracy }
1727    pub fn altitude(&self) -> Option<f64> { self.altitude }
1728    pub fn altitudeAccuracy(&self) -> Option<f64> { self.altitudeAccuracy }
1729    pub fn heading(&self) -> Option<f64> { self.heading }
1730    pub fn speed(&self) -> Option<f64> { self.speed }
1731}
1732
1733#[derive(Default)]
1734pub struct SetGeolocationOverrideParamsBuilder {
1735    latitude: Option<f64>,
1736    longitude: Option<f64>,
1737    accuracy: Option<f64>,
1738    altitude: Option<f64>,
1739    altitudeAccuracy: Option<f64>,
1740    heading: Option<f64>,
1741    speed: Option<f64>,
1742}
1743
1744impl SetGeolocationOverrideParamsBuilder {
1745    /// Mock latitude
1746    pub fn latitude(mut self, latitude: f64) -> Self { self.latitude = Some(latitude); self }
1747    /// Mock longitude
1748    pub fn longitude(mut self, longitude: f64) -> Self { self.longitude = Some(longitude); self }
1749    /// Mock accuracy
1750    pub fn accuracy(mut self, accuracy: f64) -> Self { self.accuracy = Some(accuracy); self }
1751    /// Mock altitude
1752    pub fn altitude(mut self, altitude: f64) -> Self { self.altitude = Some(altitude); self }
1753    /// Mock altitudeAccuracy
1754    pub fn altitudeAccuracy(mut self, altitudeAccuracy: f64) -> Self { self.altitudeAccuracy = Some(altitudeAccuracy); self }
1755    /// Mock heading
1756    pub fn heading(mut self, heading: f64) -> Self { self.heading = Some(heading); self }
1757    /// Mock speed
1758    pub fn speed(mut self, speed: f64) -> Self { self.speed = Some(speed); self }
1759    pub fn build(self) -> SetGeolocationOverrideParams {
1760        SetGeolocationOverrideParams {
1761            latitude: self.latitude,
1762            longitude: self.longitude,
1763            accuracy: self.accuracy,
1764            altitude: self.altitude,
1765            altitudeAccuracy: self.altitudeAccuracy,
1766            heading: self.heading,
1767            speed: self.speed,
1768        }
1769    }
1770}
1771
1772impl SetGeolocationOverrideParams { pub const METHOD: &'static str = "Emulation.setGeolocationOverride"; }
1773
1774impl<'a> crate::CdpCommand<'a> for SetGeolocationOverrideParams {
1775    const METHOD: &'static str = "Emulation.setGeolocationOverride";
1776    type Response = crate::EmptyReturns;
1777}
1778
1779
1780#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1781#[serde(rename_all = "camelCase")]
1782pub struct GetOverriddenSensorInformationParams {
1783    #[serde(rename = "type")]
1784    type_: SensorType,
1785}
1786
1787impl GetOverriddenSensorInformationParams {
1788    pub fn builder(type_: SensorType) -> GetOverriddenSensorInformationParamsBuilder {
1789        GetOverriddenSensorInformationParamsBuilder {
1790            type_: type_,
1791        }
1792    }
1793    pub fn type_(&self) -> &SensorType { &self.type_ }
1794}
1795
1796
1797pub struct GetOverriddenSensorInformationParamsBuilder {
1798    type_: SensorType,
1799}
1800
1801impl GetOverriddenSensorInformationParamsBuilder {
1802    pub fn build(self) -> GetOverriddenSensorInformationParams {
1803        GetOverriddenSensorInformationParams {
1804            type_: self.type_,
1805        }
1806    }
1807}
1808
1809
1810#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1811#[serde(rename_all = "camelCase")]
1812pub struct GetOverriddenSensorInformationReturns {
1813    requestedSamplingFrequency: f64,
1814}
1815
1816impl GetOverriddenSensorInformationReturns {
1817    pub fn builder(requestedSamplingFrequency: f64) -> GetOverriddenSensorInformationReturnsBuilder {
1818        GetOverriddenSensorInformationReturnsBuilder {
1819            requestedSamplingFrequency: requestedSamplingFrequency,
1820        }
1821    }
1822    pub fn requestedSamplingFrequency(&self) -> f64 { self.requestedSamplingFrequency }
1823}
1824
1825
1826pub struct GetOverriddenSensorInformationReturnsBuilder {
1827    requestedSamplingFrequency: f64,
1828}
1829
1830impl GetOverriddenSensorInformationReturnsBuilder {
1831    pub fn build(self) -> GetOverriddenSensorInformationReturns {
1832        GetOverriddenSensorInformationReturns {
1833            requestedSamplingFrequency: self.requestedSamplingFrequency,
1834        }
1835    }
1836}
1837
1838impl GetOverriddenSensorInformationParams { pub const METHOD: &'static str = "Emulation.getOverriddenSensorInformation"; }
1839
1840impl<'a> crate::CdpCommand<'a> for GetOverriddenSensorInformationParams {
1841    const METHOD: &'static str = "Emulation.getOverriddenSensorInformation";
1842    type Response = GetOverriddenSensorInformationReturns;
1843}
1844
1845/// Overrides a platform sensor of a given type. If |enabled| is true, calls to
1846/// Sensor.start() will use a virtual sensor as backend rather than fetching
1847/// data from a real hardware sensor. Otherwise, existing virtual
1848/// sensor-backend Sensor objects will fire an error event and new calls to
1849/// Sensor.start() will attempt to use a real sensor instead.
1850
1851#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1852#[serde(rename_all = "camelCase")]
1853pub struct SetSensorOverrideEnabledParams {
1854    enabled: bool,
1855    #[serde(rename = "type")]
1856    type_: SensorType,
1857    #[serde(skip_serializing_if = "Option::is_none")]
1858    metadata: Option<SensorMetadata>,
1859}
1860
1861impl SetSensorOverrideEnabledParams {
1862    pub fn builder(enabled: bool, type_: SensorType) -> SetSensorOverrideEnabledParamsBuilder {
1863        SetSensorOverrideEnabledParamsBuilder {
1864            enabled: enabled,
1865            type_: type_,
1866            metadata: None,
1867        }
1868    }
1869    pub fn enabled(&self) -> bool { self.enabled }
1870    pub fn type_(&self) -> &SensorType { &self.type_ }
1871    pub fn metadata(&self) -> Option<&SensorMetadata> { self.metadata.as_ref() }
1872}
1873
1874
1875pub struct SetSensorOverrideEnabledParamsBuilder {
1876    enabled: bool,
1877    type_: SensorType,
1878    metadata: Option<SensorMetadata>,
1879}
1880
1881impl SetSensorOverrideEnabledParamsBuilder {
1882    pub fn metadata(mut self, metadata: SensorMetadata) -> Self { self.metadata = Some(metadata); self }
1883    pub fn build(self) -> SetSensorOverrideEnabledParams {
1884        SetSensorOverrideEnabledParams {
1885            enabled: self.enabled,
1886            type_: self.type_,
1887            metadata: self.metadata,
1888        }
1889    }
1890}
1891
1892impl SetSensorOverrideEnabledParams { pub const METHOD: &'static str = "Emulation.setSensorOverrideEnabled"; }
1893
1894impl<'a> crate::CdpCommand<'a> for SetSensorOverrideEnabledParams {
1895    const METHOD: &'static str = "Emulation.setSensorOverrideEnabled";
1896    type Response = crate::EmptyReturns;
1897}
1898
1899/// Updates the sensor readings reported by a sensor type previously overridden
1900/// by setSensorOverrideEnabled.
1901
1902#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1903#[serde(rename_all = "camelCase")]
1904pub struct SetSensorOverrideReadingsParams {
1905    #[serde(rename = "type")]
1906    type_: SensorType,
1907    reading: SensorReading,
1908}
1909
1910impl SetSensorOverrideReadingsParams {
1911    pub fn builder(type_: SensorType, reading: SensorReading) -> SetSensorOverrideReadingsParamsBuilder {
1912        SetSensorOverrideReadingsParamsBuilder {
1913            type_: type_,
1914            reading: reading,
1915        }
1916    }
1917    pub fn type_(&self) -> &SensorType { &self.type_ }
1918    pub fn reading(&self) -> &SensorReading { &self.reading }
1919}
1920
1921
1922pub struct SetSensorOverrideReadingsParamsBuilder {
1923    type_: SensorType,
1924    reading: SensorReading,
1925}
1926
1927impl SetSensorOverrideReadingsParamsBuilder {
1928    pub fn build(self) -> SetSensorOverrideReadingsParams {
1929        SetSensorOverrideReadingsParams {
1930            type_: self.type_,
1931            reading: self.reading,
1932        }
1933    }
1934}
1935
1936impl SetSensorOverrideReadingsParams { pub const METHOD: &'static str = "Emulation.setSensorOverrideReadings"; }
1937
1938impl<'a> crate::CdpCommand<'a> for SetSensorOverrideReadingsParams {
1939    const METHOD: &'static str = "Emulation.setSensorOverrideReadings";
1940    type Response = crate::EmptyReturns;
1941}
1942
1943/// Overrides a pressure source of a given type, as used by the Compute
1944/// Pressure API, so that updates to PressureObserver.observe() are provided
1945/// via setPressureStateOverride instead of being retrieved from
1946/// platform-provided telemetry data.
1947
1948#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1949#[serde(rename_all = "camelCase")]
1950pub struct SetPressureSourceOverrideEnabledParams {
1951    enabled: bool,
1952    source: PressureSource,
1953    #[serde(skip_serializing_if = "Option::is_none")]
1954    metadata: Option<PressureMetadata>,
1955}
1956
1957impl SetPressureSourceOverrideEnabledParams {
1958    pub fn builder(enabled: bool, source: PressureSource) -> SetPressureSourceOverrideEnabledParamsBuilder {
1959        SetPressureSourceOverrideEnabledParamsBuilder {
1960            enabled: enabled,
1961            source: source,
1962            metadata: None,
1963        }
1964    }
1965    pub fn enabled(&self) -> bool { self.enabled }
1966    pub fn source(&self) -> &PressureSource { &self.source }
1967    pub fn metadata(&self) -> Option<&PressureMetadata> { self.metadata.as_ref() }
1968}
1969
1970
1971pub struct SetPressureSourceOverrideEnabledParamsBuilder {
1972    enabled: bool,
1973    source: PressureSource,
1974    metadata: Option<PressureMetadata>,
1975}
1976
1977impl SetPressureSourceOverrideEnabledParamsBuilder {
1978    pub fn metadata(mut self, metadata: PressureMetadata) -> Self { self.metadata = Some(metadata); self }
1979    pub fn build(self) -> SetPressureSourceOverrideEnabledParams {
1980        SetPressureSourceOverrideEnabledParams {
1981            enabled: self.enabled,
1982            source: self.source,
1983            metadata: self.metadata,
1984        }
1985    }
1986}
1987
1988impl SetPressureSourceOverrideEnabledParams { pub const METHOD: &'static str = "Emulation.setPressureSourceOverrideEnabled"; }
1989
1990impl<'a> crate::CdpCommand<'a> for SetPressureSourceOverrideEnabledParams {
1991    const METHOD: &'static str = "Emulation.setPressureSourceOverrideEnabled";
1992    type Response = crate::EmptyReturns;
1993}
1994
1995/// TODO: OBSOLETE: To remove when setPressureDataOverride is merged.
1996/// Provides a given pressure state that will be processed and eventually be
1997/// delivered to PressureObserver users. |source| must have been previously
1998/// overridden by setPressureSourceOverrideEnabled.
1999
2000#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2001#[serde(rename_all = "camelCase")]
2002pub struct SetPressureStateOverrideParams {
2003    source: PressureSource,
2004    state: PressureState,
2005}
2006
2007impl SetPressureStateOverrideParams {
2008    pub fn builder(source: PressureSource, state: PressureState) -> SetPressureStateOverrideParamsBuilder {
2009        SetPressureStateOverrideParamsBuilder {
2010            source: source,
2011            state: state,
2012        }
2013    }
2014    pub fn source(&self) -> &PressureSource { &self.source }
2015    pub fn state(&self) -> &PressureState { &self.state }
2016}
2017
2018
2019pub struct SetPressureStateOverrideParamsBuilder {
2020    source: PressureSource,
2021    state: PressureState,
2022}
2023
2024impl SetPressureStateOverrideParamsBuilder {
2025    pub fn build(self) -> SetPressureStateOverrideParams {
2026        SetPressureStateOverrideParams {
2027            source: self.source,
2028            state: self.state,
2029        }
2030    }
2031}
2032
2033impl SetPressureStateOverrideParams { pub const METHOD: &'static str = "Emulation.setPressureStateOverride"; }
2034
2035impl<'a> crate::CdpCommand<'a> for SetPressureStateOverrideParams {
2036    const METHOD: &'static str = "Emulation.setPressureStateOverride";
2037    type Response = crate::EmptyReturns;
2038}
2039
2040/// Provides a given pressure data set that will be processed and eventually be
2041/// delivered to PressureObserver users. |source| must have been previously
2042/// overridden by setPressureSourceOverrideEnabled.
2043
2044#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2045#[serde(rename_all = "camelCase")]
2046pub struct SetPressureDataOverrideParams {
2047    source: PressureSource,
2048    state: PressureState,
2049    #[serde(skip_serializing_if = "Option::is_none")]
2050    ownContributionEstimate: Option<f64>,
2051}
2052
2053impl SetPressureDataOverrideParams {
2054    pub fn builder(source: PressureSource, state: PressureState) -> SetPressureDataOverrideParamsBuilder {
2055        SetPressureDataOverrideParamsBuilder {
2056            source: source,
2057            state: state,
2058            ownContributionEstimate: None,
2059        }
2060    }
2061    pub fn source(&self) -> &PressureSource { &self.source }
2062    pub fn state(&self) -> &PressureState { &self.state }
2063    pub fn ownContributionEstimate(&self) -> Option<f64> { self.ownContributionEstimate }
2064}
2065
2066
2067pub struct SetPressureDataOverrideParamsBuilder {
2068    source: PressureSource,
2069    state: PressureState,
2070    ownContributionEstimate: Option<f64>,
2071}
2072
2073impl SetPressureDataOverrideParamsBuilder {
2074    pub fn ownContributionEstimate(mut self, ownContributionEstimate: f64) -> Self { self.ownContributionEstimate = Some(ownContributionEstimate); self }
2075    pub fn build(self) -> SetPressureDataOverrideParams {
2076        SetPressureDataOverrideParams {
2077            source: self.source,
2078            state: self.state,
2079            ownContributionEstimate: self.ownContributionEstimate,
2080        }
2081    }
2082}
2083
2084impl SetPressureDataOverrideParams { pub const METHOD: &'static str = "Emulation.setPressureDataOverride"; }
2085
2086impl<'a> crate::CdpCommand<'a> for SetPressureDataOverrideParams {
2087    const METHOD: &'static str = "Emulation.setPressureDataOverride";
2088    type Response = crate::EmptyReturns;
2089}
2090
2091/// Overrides the Idle state.
2092
2093#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2094#[serde(rename_all = "camelCase")]
2095pub struct SetIdleOverrideParams {
2096    /// Mock isUserActive
2097    isUserActive: bool,
2098    /// Mock isScreenUnlocked
2099    isScreenUnlocked: bool,
2100}
2101
2102impl SetIdleOverrideParams {
2103    pub fn builder(isUserActive: bool, isScreenUnlocked: bool) -> SetIdleOverrideParamsBuilder {
2104        SetIdleOverrideParamsBuilder {
2105            isUserActive: isUserActive,
2106            isScreenUnlocked: isScreenUnlocked,
2107        }
2108    }
2109    pub fn isUserActive(&self) -> bool { self.isUserActive }
2110    pub fn isScreenUnlocked(&self) -> bool { self.isScreenUnlocked }
2111}
2112
2113
2114pub struct SetIdleOverrideParamsBuilder {
2115    isUserActive: bool,
2116    isScreenUnlocked: bool,
2117}
2118
2119impl SetIdleOverrideParamsBuilder {
2120    pub fn build(self) -> SetIdleOverrideParams {
2121        SetIdleOverrideParams {
2122            isUserActive: self.isUserActive,
2123            isScreenUnlocked: self.isScreenUnlocked,
2124        }
2125    }
2126}
2127
2128impl SetIdleOverrideParams { pub const METHOD: &'static str = "Emulation.setIdleOverride"; }
2129
2130impl<'a> crate::CdpCommand<'a> for SetIdleOverrideParams {
2131    const METHOD: &'static str = "Emulation.setIdleOverride";
2132    type Response = crate::EmptyReturns;
2133}
2134
2135#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2136pub struct ClearIdleOverrideParams {}
2137
2138impl ClearIdleOverrideParams { pub const METHOD: &'static str = "Emulation.clearIdleOverride"; }
2139
2140impl<'a> crate::CdpCommand<'a> for ClearIdleOverrideParams {
2141    const METHOD: &'static str = "Emulation.clearIdleOverride";
2142    type Response = crate::EmptyReturns;
2143}
2144
2145/// Overrides value returned by the javascript navigator object.
2146
2147#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2148#[serde(rename_all = "camelCase")]
2149pub struct SetNavigatorOverridesParams<'a> {
2150    /// The platform navigator.platform should return.
2151    platform: Cow<'a, str>,
2152}
2153
2154impl<'a> SetNavigatorOverridesParams<'a> {
2155    pub fn builder(platform: impl Into<Cow<'a, str>>) -> SetNavigatorOverridesParamsBuilder<'a> {
2156        SetNavigatorOverridesParamsBuilder {
2157            platform: platform.into(),
2158        }
2159    }
2160    pub fn platform(&self) -> &str { self.platform.as_ref() }
2161}
2162
2163
2164pub struct SetNavigatorOverridesParamsBuilder<'a> {
2165    platform: Cow<'a, str>,
2166}
2167
2168impl<'a> SetNavigatorOverridesParamsBuilder<'a> {
2169    pub fn build(self) -> SetNavigatorOverridesParams<'a> {
2170        SetNavigatorOverridesParams {
2171            platform: self.platform,
2172        }
2173    }
2174}
2175
2176impl<'a> SetNavigatorOverridesParams<'a> { pub const METHOD: &'static str = "Emulation.setNavigatorOverrides"; }
2177
2178impl<'a> crate::CdpCommand<'a> for SetNavigatorOverridesParams<'a> {
2179    const METHOD: &'static str = "Emulation.setNavigatorOverrides";
2180    type Response = crate::EmptyReturns;
2181}
2182
2183/// Sets a specified page scale factor.
2184
2185#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2186#[serde(rename_all = "camelCase")]
2187pub struct SetPageScaleFactorParams {
2188    /// Page scale factor.
2189    pageScaleFactor: f64,
2190}
2191
2192impl SetPageScaleFactorParams {
2193    pub fn builder(pageScaleFactor: f64) -> SetPageScaleFactorParamsBuilder {
2194        SetPageScaleFactorParamsBuilder {
2195            pageScaleFactor: pageScaleFactor,
2196        }
2197    }
2198    pub fn pageScaleFactor(&self) -> f64 { self.pageScaleFactor }
2199}
2200
2201
2202pub struct SetPageScaleFactorParamsBuilder {
2203    pageScaleFactor: f64,
2204}
2205
2206impl SetPageScaleFactorParamsBuilder {
2207    pub fn build(self) -> SetPageScaleFactorParams {
2208        SetPageScaleFactorParams {
2209            pageScaleFactor: self.pageScaleFactor,
2210        }
2211    }
2212}
2213
2214impl SetPageScaleFactorParams { pub const METHOD: &'static str = "Emulation.setPageScaleFactor"; }
2215
2216impl<'a> crate::CdpCommand<'a> for SetPageScaleFactorParams {
2217    const METHOD: &'static str = "Emulation.setPageScaleFactor";
2218    type Response = crate::EmptyReturns;
2219}
2220
2221/// Switches script execution in the page.
2222
2223#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2224#[serde(rename_all = "camelCase")]
2225pub struct SetScriptExecutionDisabledParams {
2226    /// Whether script execution should be disabled in the page.
2227    value: bool,
2228}
2229
2230impl SetScriptExecutionDisabledParams {
2231    pub fn builder(value: bool) -> SetScriptExecutionDisabledParamsBuilder {
2232        SetScriptExecutionDisabledParamsBuilder {
2233            value: value,
2234        }
2235    }
2236    pub fn value(&self) -> bool { self.value }
2237}
2238
2239
2240pub struct SetScriptExecutionDisabledParamsBuilder {
2241    value: bool,
2242}
2243
2244impl SetScriptExecutionDisabledParamsBuilder {
2245    pub fn build(self) -> SetScriptExecutionDisabledParams {
2246        SetScriptExecutionDisabledParams {
2247            value: self.value,
2248        }
2249    }
2250}
2251
2252impl SetScriptExecutionDisabledParams { pub const METHOD: &'static str = "Emulation.setScriptExecutionDisabled"; }
2253
2254impl<'a> crate::CdpCommand<'a> for SetScriptExecutionDisabledParams {
2255    const METHOD: &'static str = "Emulation.setScriptExecutionDisabled";
2256    type Response = crate::EmptyReturns;
2257}
2258
2259/// Enables touch on platforms which do not support them.
2260
2261#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2262#[serde(rename_all = "camelCase")]
2263pub struct SetTouchEmulationEnabledParams {
2264    /// Whether the touch event emulation should be enabled.
2265    enabled: bool,
2266    /// Maximum touch points supported. Defaults to one.
2267    #[serde(skip_serializing_if = "Option::is_none")]
2268    maxTouchPoints: Option<i64>,
2269}
2270
2271impl SetTouchEmulationEnabledParams {
2272    pub fn builder(enabled: bool) -> SetTouchEmulationEnabledParamsBuilder {
2273        SetTouchEmulationEnabledParamsBuilder {
2274            enabled: enabled,
2275            maxTouchPoints: None,
2276        }
2277    }
2278    pub fn enabled(&self) -> bool { self.enabled }
2279    pub fn maxTouchPoints(&self) -> Option<i64> { self.maxTouchPoints }
2280}
2281
2282
2283pub struct SetTouchEmulationEnabledParamsBuilder {
2284    enabled: bool,
2285    maxTouchPoints: Option<i64>,
2286}
2287
2288impl SetTouchEmulationEnabledParamsBuilder {
2289    /// Maximum touch points supported. Defaults to one.
2290    pub fn maxTouchPoints(mut self, maxTouchPoints: i64) -> Self { self.maxTouchPoints = Some(maxTouchPoints); self }
2291    pub fn build(self) -> SetTouchEmulationEnabledParams {
2292        SetTouchEmulationEnabledParams {
2293            enabled: self.enabled,
2294            maxTouchPoints: self.maxTouchPoints,
2295        }
2296    }
2297}
2298
2299impl SetTouchEmulationEnabledParams { pub const METHOD: &'static str = "Emulation.setTouchEmulationEnabled"; }
2300
2301impl<'a> crate::CdpCommand<'a> for SetTouchEmulationEnabledParams {
2302    const METHOD: &'static str = "Emulation.setTouchEmulationEnabled";
2303    type Response = crate::EmptyReturns;
2304}
2305
2306/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
2307/// the current virtual time policy.  Note this supersedes any previous time budget.
2308
2309#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2310#[serde(rename_all = "camelCase")]
2311pub struct SetVirtualTimePolicyParams {
2312    policy: VirtualTimePolicy,
2313    /// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a
2314    /// virtualTimeBudgetExpired event is sent.
2315    #[serde(skip_serializing_if = "Option::is_none")]
2316    budget: Option<f64>,
2317    /// If set this specifies the maximum number of tasks that can be run before virtual is forced
2318    /// forwards to prevent deadlock.
2319    #[serde(skip_serializing_if = "Option::is_none")]
2320    maxVirtualTimeTaskStarvationCount: Option<u64>,
2321    /// If set, base::Time::Now will be overridden to initially return this value.
2322    #[serde(skip_serializing_if = "Option::is_none")]
2323    initialVirtualTime: Option<crate::network::TimeSinceEpoch>,
2324}
2325
2326impl SetVirtualTimePolicyParams {
2327    pub fn builder(policy: VirtualTimePolicy) -> SetVirtualTimePolicyParamsBuilder {
2328        SetVirtualTimePolicyParamsBuilder {
2329            policy: policy,
2330            budget: None,
2331            maxVirtualTimeTaskStarvationCount: None,
2332            initialVirtualTime: None,
2333        }
2334    }
2335    pub fn policy(&self) -> &VirtualTimePolicy { &self.policy }
2336    pub fn budget(&self) -> Option<f64> { self.budget }
2337    pub fn maxVirtualTimeTaskStarvationCount(&self) -> Option<u64> { self.maxVirtualTimeTaskStarvationCount }
2338    pub fn initialVirtualTime(&self) -> Option<&crate::network::TimeSinceEpoch> { self.initialVirtualTime.as_ref() }
2339}
2340
2341
2342pub struct SetVirtualTimePolicyParamsBuilder {
2343    policy: VirtualTimePolicy,
2344    budget: Option<f64>,
2345    maxVirtualTimeTaskStarvationCount: Option<u64>,
2346    initialVirtualTime: Option<crate::network::TimeSinceEpoch>,
2347}
2348
2349impl SetVirtualTimePolicyParamsBuilder {
2350    /// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a
2351    /// virtualTimeBudgetExpired event is sent.
2352    pub fn budget(mut self, budget: f64) -> Self { self.budget = Some(budget); self }
2353    /// If set this specifies the maximum number of tasks that can be run before virtual is forced
2354    /// forwards to prevent deadlock.
2355    pub fn maxVirtualTimeTaskStarvationCount(mut self, maxVirtualTimeTaskStarvationCount: u64) -> Self { self.maxVirtualTimeTaskStarvationCount = Some(maxVirtualTimeTaskStarvationCount); self }
2356    /// If set, base::Time::Now will be overridden to initially return this value.
2357    pub fn initialVirtualTime(mut self, initialVirtualTime: crate::network::TimeSinceEpoch) -> Self { self.initialVirtualTime = Some(initialVirtualTime); self }
2358    pub fn build(self) -> SetVirtualTimePolicyParams {
2359        SetVirtualTimePolicyParams {
2360            policy: self.policy,
2361            budget: self.budget,
2362            maxVirtualTimeTaskStarvationCount: self.maxVirtualTimeTaskStarvationCount,
2363            initialVirtualTime: self.initialVirtualTime,
2364        }
2365    }
2366}
2367
2368/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
2369/// the current virtual time policy.  Note this supersedes any previous time budget.
2370
2371#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2372#[serde(rename_all = "camelCase")]
2373pub struct SetVirtualTimePolicyReturns {
2374    /// Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
2375    virtualTimeTicksBase: f64,
2376}
2377
2378impl SetVirtualTimePolicyReturns {
2379    pub fn builder(virtualTimeTicksBase: f64) -> SetVirtualTimePolicyReturnsBuilder {
2380        SetVirtualTimePolicyReturnsBuilder {
2381            virtualTimeTicksBase: virtualTimeTicksBase,
2382        }
2383    }
2384    pub fn virtualTimeTicksBase(&self) -> f64 { self.virtualTimeTicksBase }
2385}
2386
2387
2388pub struct SetVirtualTimePolicyReturnsBuilder {
2389    virtualTimeTicksBase: f64,
2390}
2391
2392impl SetVirtualTimePolicyReturnsBuilder {
2393    pub fn build(self) -> SetVirtualTimePolicyReturns {
2394        SetVirtualTimePolicyReturns {
2395            virtualTimeTicksBase: self.virtualTimeTicksBase,
2396        }
2397    }
2398}
2399
2400impl SetVirtualTimePolicyParams { pub const METHOD: &'static str = "Emulation.setVirtualTimePolicy"; }
2401
2402impl<'a> crate::CdpCommand<'a> for SetVirtualTimePolicyParams {
2403    const METHOD: &'static str = "Emulation.setVirtualTimePolicy";
2404    type Response = SetVirtualTimePolicyReturns;
2405}
2406
2407/// Overrides default host system locale with the specified one.
2408
2409#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2410#[serde(rename_all = "camelCase")]
2411pub struct SetLocaleOverrideParams<'a> {
2412    /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and
2413    /// restores default host system locale.
2414    #[serde(skip_serializing_if = "Option::is_none")]
2415    locale: Option<Cow<'a, str>>,
2416}
2417
2418impl<'a> SetLocaleOverrideParams<'a> {
2419    pub fn builder() -> SetLocaleOverrideParamsBuilder<'a> {
2420        SetLocaleOverrideParamsBuilder {
2421            locale: None,
2422        }
2423    }
2424    pub fn locale(&self) -> Option<&str> { self.locale.as_deref() }
2425}
2426
2427#[derive(Default)]
2428pub struct SetLocaleOverrideParamsBuilder<'a> {
2429    locale: Option<Cow<'a, str>>,
2430}
2431
2432impl<'a> SetLocaleOverrideParamsBuilder<'a> {
2433    /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and
2434    /// restores default host system locale.
2435    pub fn locale(mut self, locale: impl Into<Cow<'a, str>>) -> Self { self.locale = Some(locale.into()); self }
2436    pub fn build(self) -> SetLocaleOverrideParams<'a> {
2437        SetLocaleOverrideParams {
2438            locale: self.locale,
2439        }
2440    }
2441}
2442
2443impl<'a> SetLocaleOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setLocaleOverride"; }
2444
2445impl<'a> crate::CdpCommand<'a> for SetLocaleOverrideParams<'a> {
2446    const METHOD: &'static str = "Emulation.setLocaleOverride";
2447    type Response = crate::EmptyReturns;
2448}
2449
2450/// Overrides default host system timezone with the specified one.
2451
2452#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2453#[serde(rename_all = "camelCase")]
2454pub struct SetTimezoneOverrideParams<'a> {
2455    /// The timezone identifier. List of supported timezones:
2456    /// https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt
2457    /// If empty, disables the override and restores default host system timezone.
2458    timezoneId: Cow<'a, str>,
2459}
2460
2461impl<'a> SetTimezoneOverrideParams<'a> {
2462    pub fn builder(timezoneId: impl Into<Cow<'a, str>>) -> SetTimezoneOverrideParamsBuilder<'a> {
2463        SetTimezoneOverrideParamsBuilder {
2464            timezoneId: timezoneId.into(),
2465        }
2466    }
2467    pub fn timezoneId(&self) -> &str { self.timezoneId.as_ref() }
2468}
2469
2470
2471pub struct SetTimezoneOverrideParamsBuilder<'a> {
2472    timezoneId: Cow<'a, str>,
2473}
2474
2475impl<'a> SetTimezoneOverrideParamsBuilder<'a> {
2476    pub fn build(self) -> SetTimezoneOverrideParams<'a> {
2477        SetTimezoneOverrideParams {
2478            timezoneId: self.timezoneId,
2479        }
2480    }
2481}
2482
2483impl<'a> SetTimezoneOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setTimezoneOverride"; }
2484
2485impl<'a> crate::CdpCommand<'a> for SetTimezoneOverrideParams<'a> {
2486    const METHOD: &'static str = "Emulation.setTimezoneOverride";
2487    type Response = crate::EmptyReturns;
2488}
2489
2490/// Resizes the frame/viewport of the page. Note that this does not affect the frame's container
2491/// (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
2492/// on Android.
2493
2494#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2495#[serde(rename_all = "camelCase")]
2496pub struct SetVisibleSizeParams {
2497    /// Frame width (DIP).
2498    width: u64,
2499    /// Frame height (DIP).
2500    height: i64,
2501}
2502
2503impl SetVisibleSizeParams {
2504    pub fn builder(width: u64, height: i64) -> SetVisibleSizeParamsBuilder {
2505        SetVisibleSizeParamsBuilder {
2506            width: width,
2507            height: height,
2508        }
2509    }
2510    pub fn width(&self) -> u64 { self.width }
2511    pub fn height(&self) -> i64 { self.height }
2512}
2513
2514
2515pub struct SetVisibleSizeParamsBuilder {
2516    width: u64,
2517    height: i64,
2518}
2519
2520impl SetVisibleSizeParamsBuilder {
2521    pub fn build(self) -> SetVisibleSizeParams {
2522        SetVisibleSizeParams {
2523            width: self.width,
2524            height: self.height,
2525        }
2526    }
2527}
2528
2529impl SetVisibleSizeParams { pub const METHOD: &'static str = "Emulation.setVisibleSize"; }
2530
2531impl<'a> crate::CdpCommand<'a> for SetVisibleSizeParams {
2532    const METHOD: &'static str = "Emulation.setVisibleSize";
2533    type Response = crate::EmptyReturns;
2534}
2535
2536
2537#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2538#[serde(rename_all = "camelCase")]
2539pub struct SetDisabledImageTypesParams {
2540    /// Image types to disable.
2541    imageTypes: Vec<DisabledImageType>,
2542}
2543
2544impl SetDisabledImageTypesParams {
2545    pub fn builder(imageTypes: Vec<DisabledImageType>) -> SetDisabledImageTypesParamsBuilder {
2546        SetDisabledImageTypesParamsBuilder {
2547            imageTypes: imageTypes,
2548        }
2549    }
2550    pub fn imageTypes(&self) -> &[DisabledImageType] { &self.imageTypes }
2551}
2552
2553
2554pub struct SetDisabledImageTypesParamsBuilder {
2555    imageTypes: Vec<DisabledImageType>,
2556}
2557
2558impl SetDisabledImageTypesParamsBuilder {
2559    pub fn build(self) -> SetDisabledImageTypesParams {
2560        SetDisabledImageTypesParams {
2561            imageTypes: self.imageTypes,
2562        }
2563    }
2564}
2565
2566impl SetDisabledImageTypesParams { pub const METHOD: &'static str = "Emulation.setDisabledImageTypes"; }
2567
2568impl<'a> crate::CdpCommand<'a> for SetDisabledImageTypesParams {
2569    const METHOD: &'static str = "Emulation.setDisabledImageTypes";
2570    type Response = crate::EmptyReturns;
2571}
2572
2573/// Override the value of navigator.connection.saveData
2574
2575#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2576#[serde(rename_all = "camelCase")]
2577pub struct SetDataSaverOverrideParams {
2578    /// Override value. Omitting the parameter disables the override.
2579    #[serde(skip_serializing_if = "Option::is_none")]
2580    dataSaverEnabled: Option<bool>,
2581}
2582
2583impl SetDataSaverOverrideParams {
2584    pub fn builder() -> SetDataSaverOverrideParamsBuilder {
2585        SetDataSaverOverrideParamsBuilder {
2586            dataSaverEnabled: None,
2587        }
2588    }
2589    pub fn dataSaverEnabled(&self) -> Option<bool> { self.dataSaverEnabled }
2590}
2591
2592#[derive(Default)]
2593pub struct SetDataSaverOverrideParamsBuilder {
2594    dataSaverEnabled: Option<bool>,
2595}
2596
2597impl SetDataSaverOverrideParamsBuilder {
2598    /// Override value. Omitting the parameter disables the override.
2599    pub fn dataSaverEnabled(mut self, dataSaverEnabled: bool) -> Self { self.dataSaverEnabled = Some(dataSaverEnabled); self }
2600    pub fn build(self) -> SetDataSaverOverrideParams {
2601        SetDataSaverOverrideParams {
2602            dataSaverEnabled: self.dataSaverEnabled,
2603        }
2604    }
2605}
2606
2607impl SetDataSaverOverrideParams { pub const METHOD: &'static str = "Emulation.setDataSaverOverride"; }
2608
2609impl<'a> crate::CdpCommand<'a> for SetDataSaverOverrideParams {
2610    const METHOD: &'static str = "Emulation.setDataSaverOverride";
2611    type Response = crate::EmptyReturns;
2612}
2613
2614
2615#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2616#[serde(rename_all = "camelCase")]
2617pub struct SetHardwareConcurrencyOverrideParams {
2618    /// Hardware concurrency to report
2619    hardwareConcurrency: i64,
2620}
2621
2622impl SetHardwareConcurrencyOverrideParams {
2623    pub fn builder(hardwareConcurrency: i64) -> SetHardwareConcurrencyOverrideParamsBuilder {
2624        SetHardwareConcurrencyOverrideParamsBuilder {
2625            hardwareConcurrency: hardwareConcurrency,
2626        }
2627    }
2628    pub fn hardwareConcurrency(&self) -> i64 { self.hardwareConcurrency }
2629}
2630
2631
2632pub struct SetHardwareConcurrencyOverrideParamsBuilder {
2633    hardwareConcurrency: i64,
2634}
2635
2636impl SetHardwareConcurrencyOverrideParamsBuilder {
2637    pub fn build(self) -> SetHardwareConcurrencyOverrideParams {
2638        SetHardwareConcurrencyOverrideParams {
2639            hardwareConcurrency: self.hardwareConcurrency,
2640        }
2641    }
2642}
2643
2644impl SetHardwareConcurrencyOverrideParams { pub const METHOD: &'static str = "Emulation.setHardwareConcurrencyOverride"; }
2645
2646impl<'a> crate::CdpCommand<'a> for SetHardwareConcurrencyOverrideParams {
2647    const METHOD: &'static str = "Emulation.setHardwareConcurrencyOverride";
2648    type Response = crate::EmptyReturns;
2649}
2650
2651/// Allows overriding user agent with the given string.
2652/// 'userAgentMetadata' must be set for Client Hint headers to be sent.
2653
2654#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2655#[serde(rename_all = "camelCase")]
2656pub struct SetUserAgentOverrideParams<'a> {
2657    /// User agent to use.
2658    userAgent: Cow<'a, str>,
2659    /// Browser language to emulate.
2660    #[serde(skip_serializing_if = "Option::is_none")]
2661    acceptLanguage: Option<Cow<'a, str>>,
2662    /// The platform navigator.platform should return.
2663    #[serde(skip_serializing_if = "Option::is_none")]
2664    platform: Option<Cow<'a, str>>,
2665    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
2666    #[serde(skip_serializing_if = "Option::is_none")]
2667    userAgentMetadata: Option<UserAgentMetadata<'a>>,
2668}
2669
2670impl<'a> SetUserAgentOverrideParams<'a> {
2671    pub fn builder(userAgent: impl Into<Cow<'a, str>>) -> SetUserAgentOverrideParamsBuilder<'a> {
2672        SetUserAgentOverrideParamsBuilder {
2673            userAgent: userAgent.into(),
2674            acceptLanguage: None,
2675            platform: None,
2676            userAgentMetadata: None,
2677        }
2678    }
2679    pub fn userAgent(&self) -> &str { self.userAgent.as_ref() }
2680    pub fn acceptLanguage(&self) -> Option<&str> { self.acceptLanguage.as_deref() }
2681    pub fn platform(&self) -> Option<&str> { self.platform.as_deref() }
2682    pub fn userAgentMetadata(&self) -> Option<&UserAgentMetadata<'a>> { self.userAgentMetadata.as_ref() }
2683}
2684
2685
2686pub struct SetUserAgentOverrideParamsBuilder<'a> {
2687    userAgent: Cow<'a, str>,
2688    acceptLanguage: Option<Cow<'a, str>>,
2689    platform: Option<Cow<'a, str>>,
2690    userAgentMetadata: Option<UserAgentMetadata<'a>>,
2691}
2692
2693impl<'a> SetUserAgentOverrideParamsBuilder<'a> {
2694    /// Browser language to emulate.
2695    pub fn acceptLanguage(mut self, acceptLanguage: impl Into<Cow<'a, str>>) -> Self { self.acceptLanguage = Some(acceptLanguage.into()); self }
2696    /// The platform navigator.platform should return.
2697    pub fn platform(mut self, platform: impl Into<Cow<'a, str>>) -> Self { self.platform = Some(platform.into()); self }
2698    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
2699    pub fn userAgentMetadata(mut self, userAgentMetadata: UserAgentMetadata<'a>) -> Self { self.userAgentMetadata = Some(userAgentMetadata); self }
2700    pub fn build(self) -> SetUserAgentOverrideParams<'a> {
2701        SetUserAgentOverrideParams {
2702            userAgent: self.userAgent,
2703            acceptLanguage: self.acceptLanguage,
2704            platform: self.platform,
2705            userAgentMetadata: self.userAgentMetadata,
2706        }
2707    }
2708}
2709
2710impl<'a> SetUserAgentOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setUserAgentOverride"; }
2711
2712impl<'a> crate::CdpCommand<'a> for SetUserAgentOverrideParams<'a> {
2713    const METHOD: &'static str = "Emulation.setUserAgentOverride";
2714    type Response = crate::EmptyReturns;
2715}
2716
2717/// Allows overriding the automation flag.
2718
2719#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2720#[serde(rename_all = "camelCase")]
2721pub struct SetAutomationOverrideParams {
2722    /// Whether the override should be enabled.
2723    enabled: bool,
2724}
2725
2726impl SetAutomationOverrideParams {
2727    pub fn builder(enabled: bool) -> SetAutomationOverrideParamsBuilder {
2728        SetAutomationOverrideParamsBuilder {
2729            enabled: enabled,
2730        }
2731    }
2732    pub fn enabled(&self) -> bool { self.enabled }
2733}
2734
2735
2736pub struct SetAutomationOverrideParamsBuilder {
2737    enabled: bool,
2738}
2739
2740impl SetAutomationOverrideParamsBuilder {
2741    pub fn build(self) -> SetAutomationOverrideParams {
2742        SetAutomationOverrideParams {
2743            enabled: self.enabled,
2744        }
2745    }
2746}
2747
2748impl SetAutomationOverrideParams { pub const METHOD: &'static str = "Emulation.setAutomationOverride"; }
2749
2750impl<'a> crate::CdpCommand<'a> for SetAutomationOverrideParams {
2751    const METHOD: &'static str = "Emulation.setAutomationOverride";
2752    type Response = crate::EmptyReturns;
2753}
2754
2755/// Allows overriding the difference between the small and large viewport sizes, which determine the
2756/// value of the 'svh' and 'lvh' unit, respectively. Only supported for top-level frames.
2757
2758#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2759#[serde(rename_all = "camelCase")]
2760pub struct SetSmallViewportHeightDifferenceOverrideParams {
2761    /// This will cause an element of size 100svh to be 'difference' pixels smaller than an element
2762    /// of size 100lvh.
2763    difference: i64,
2764}
2765
2766impl SetSmallViewportHeightDifferenceOverrideParams {
2767    pub fn builder(difference: i64) -> SetSmallViewportHeightDifferenceOverrideParamsBuilder {
2768        SetSmallViewportHeightDifferenceOverrideParamsBuilder {
2769            difference: difference,
2770        }
2771    }
2772    pub fn difference(&self) -> i64 { self.difference }
2773}
2774
2775
2776pub struct SetSmallViewportHeightDifferenceOverrideParamsBuilder {
2777    difference: i64,
2778}
2779
2780impl SetSmallViewportHeightDifferenceOverrideParamsBuilder {
2781    pub fn build(self) -> SetSmallViewportHeightDifferenceOverrideParams {
2782        SetSmallViewportHeightDifferenceOverrideParams {
2783            difference: self.difference,
2784        }
2785    }
2786}
2787
2788impl SetSmallViewportHeightDifferenceOverrideParams { pub const METHOD: &'static str = "Emulation.setSmallViewportHeightDifferenceOverride"; }
2789
2790impl<'a> crate::CdpCommand<'a> for SetSmallViewportHeightDifferenceOverrideParams {
2791    const METHOD: &'static str = "Emulation.setSmallViewportHeightDifferenceOverride";
2792    type Response = crate::EmptyReturns;
2793}
2794
2795/// Returns device's screen configuration. In headful mode, the physical screens configuration is returned,
2796/// whereas in headless mode, a virtual headless screen configuration is provided instead.
2797
2798#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2799#[serde(rename_all = "camelCase")]
2800pub struct GetScreenInfosReturns<'a> {
2801    screenInfos: Vec<ScreenInfo<'a>>,
2802}
2803
2804impl<'a> GetScreenInfosReturns<'a> {
2805    pub fn builder(screenInfos: Vec<ScreenInfo<'a>>) -> GetScreenInfosReturnsBuilder<'a> {
2806        GetScreenInfosReturnsBuilder {
2807            screenInfos: screenInfos,
2808        }
2809    }
2810    pub fn screenInfos(&self) -> &[ScreenInfo<'a>] { &self.screenInfos }
2811}
2812
2813
2814pub struct GetScreenInfosReturnsBuilder<'a> {
2815    screenInfos: Vec<ScreenInfo<'a>>,
2816}
2817
2818impl<'a> GetScreenInfosReturnsBuilder<'a> {
2819    pub fn build(self) -> GetScreenInfosReturns<'a> {
2820        GetScreenInfosReturns {
2821            screenInfos: self.screenInfos,
2822        }
2823    }
2824}
2825
2826#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2827pub struct GetScreenInfosParams {}
2828
2829impl GetScreenInfosParams { pub const METHOD: &'static str = "Emulation.getScreenInfos"; }
2830
2831impl<'a> crate::CdpCommand<'a> for GetScreenInfosParams {
2832    const METHOD: &'static str = "Emulation.getScreenInfos";
2833    type Response = GetScreenInfosReturns<'a>;
2834}
2835
2836/// Add a new screen to the device. Only supported in headless mode.
2837
2838#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2839#[serde(rename_all = "camelCase")]
2840pub struct AddScreenParams<'a> {
2841    /// Offset of the left edge of the screen in pixels.
2842    left: i64,
2843    /// Offset of the top edge of the screen in pixels.
2844    top: i64,
2845    /// The width of the screen in pixels.
2846    width: u64,
2847    /// The height of the screen in pixels.
2848    height: i64,
2849    /// Specifies the screen's work area. Default is entire screen.
2850    #[serde(skip_serializing_if = "Option::is_none")]
2851    workAreaInsets: Option<WorkAreaInsets>,
2852    /// Specifies the screen's device pixel ratio. Default is 1.
2853    #[serde(skip_serializing_if = "Option::is_none")]
2854    devicePixelRatio: Option<f64>,
2855    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
2856    #[serde(skip_serializing_if = "Option::is_none")]
2857    rotation: Option<i64>,
2858    /// Specifies the screen's color depth in bits. Default is 24.
2859    #[serde(skip_serializing_if = "Option::is_none")]
2860    colorDepth: Option<i64>,
2861    /// Specifies the descriptive label for the screen. Default is none.
2862    #[serde(skip_serializing_if = "Option::is_none")]
2863    label: Option<Cow<'a, str>>,
2864    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
2865    #[serde(skip_serializing_if = "Option::is_none")]
2866    isInternal: Option<bool>,
2867}
2868
2869impl<'a> AddScreenParams<'a> {
2870    pub fn builder(left: i64, top: i64, width: u64, height: i64) -> AddScreenParamsBuilder<'a> {
2871        AddScreenParamsBuilder {
2872            left: left,
2873            top: top,
2874            width: width,
2875            height: height,
2876            workAreaInsets: None,
2877            devicePixelRatio: None,
2878            rotation: None,
2879            colorDepth: None,
2880            label: None,
2881            isInternal: None,
2882        }
2883    }
2884    pub fn left(&self) -> i64 { self.left }
2885    pub fn top(&self) -> i64 { self.top }
2886    pub fn width(&self) -> u64 { self.width }
2887    pub fn height(&self) -> i64 { self.height }
2888    pub fn workAreaInsets(&self) -> Option<&WorkAreaInsets> { self.workAreaInsets.as_ref() }
2889    pub fn devicePixelRatio(&self) -> Option<f64> { self.devicePixelRatio }
2890    pub fn rotation(&self) -> Option<i64> { self.rotation }
2891    pub fn colorDepth(&self) -> Option<i64> { self.colorDepth }
2892    pub fn label(&self) -> Option<&str> { self.label.as_deref() }
2893    pub fn isInternal(&self) -> Option<bool> { self.isInternal }
2894}
2895
2896
2897pub struct AddScreenParamsBuilder<'a> {
2898    left: i64,
2899    top: i64,
2900    width: u64,
2901    height: i64,
2902    workAreaInsets: Option<WorkAreaInsets>,
2903    devicePixelRatio: Option<f64>,
2904    rotation: Option<i64>,
2905    colorDepth: Option<i64>,
2906    label: Option<Cow<'a, str>>,
2907    isInternal: Option<bool>,
2908}
2909
2910impl<'a> AddScreenParamsBuilder<'a> {
2911    /// Specifies the screen's work area. Default is entire screen.
2912    pub fn workAreaInsets(mut self, workAreaInsets: WorkAreaInsets) -> Self { self.workAreaInsets = Some(workAreaInsets); self }
2913    /// Specifies the screen's device pixel ratio. Default is 1.
2914    pub fn devicePixelRatio(mut self, devicePixelRatio: f64) -> Self { self.devicePixelRatio = Some(devicePixelRatio); self }
2915    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
2916    pub fn rotation(mut self, rotation: i64) -> Self { self.rotation = Some(rotation); self }
2917    /// Specifies the screen's color depth in bits. Default is 24.
2918    pub fn colorDepth(mut self, colorDepth: i64) -> Self { self.colorDepth = Some(colorDepth); self }
2919    /// Specifies the descriptive label for the screen. Default is none.
2920    pub fn label(mut self, label: impl Into<Cow<'a, str>>) -> Self { self.label = Some(label.into()); self }
2921    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
2922    pub fn isInternal(mut self, isInternal: bool) -> Self { self.isInternal = Some(isInternal); self }
2923    pub fn build(self) -> AddScreenParams<'a> {
2924        AddScreenParams {
2925            left: self.left,
2926            top: self.top,
2927            width: self.width,
2928            height: self.height,
2929            workAreaInsets: self.workAreaInsets,
2930            devicePixelRatio: self.devicePixelRatio,
2931            rotation: self.rotation,
2932            colorDepth: self.colorDepth,
2933            label: self.label,
2934            isInternal: self.isInternal,
2935        }
2936    }
2937}
2938
2939/// Add a new screen to the device. Only supported in headless mode.
2940
2941#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2942#[serde(rename_all = "camelCase")]
2943pub struct AddScreenReturns<'a> {
2944    screenInfo: ScreenInfo<'a>,
2945}
2946
2947impl<'a> AddScreenReturns<'a> {
2948    pub fn builder(screenInfo: ScreenInfo<'a>) -> AddScreenReturnsBuilder<'a> {
2949        AddScreenReturnsBuilder {
2950            screenInfo: screenInfo,
2951        }
2952    }
2953    pub fn screenInfo(&self) -> &ScreenInfo<'a> { &self.screenInfo }
2954}
2955
2956
2957pub struct AddScreenReturnsBuilder<'a> {
2958    screenInfo: ScreenInfo<'a>,
2959}
2960
2961impl<'a> AddScreenReturnsBuilder<'a> {
2962    pub fn build(self) -> AddScreenReturns<'a> {
2963        AddScreenReturns {
2964            screenInfo: self.screenInfo,
2965        }
2966    }
2967}
2968
2969impl<'a> AddScreenParams<'a> { pub const METHOD: &'static str = "Emulation.addScreen"; }
2970
2971impl<'a> crate::CdpCommand<'a> for AddScreenParams<'a> {
2972    const METHOD: &'static str = "Emulation.addScreen";
2973    type Response = AddScreenReturns<'a>;
2974}
2975
2976/// Updates specified screen parameters. Only supported in headless mode.
2977
2978#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2979#[serde(rename_all = "camelCase")]
2980pub struct UpdateScreenParams<'a> {
2981    /// Target screen identifier.
2982    screenId: ScreenId<'a>,
2983    /// Offset of the left edge of the screen in pixels.
2984    #[serde(skip_serializing_if = "Option::is_none")]
2985    left: Option<i64>,
2986    /// Offset of the top edge of the screen in pixels.
2987    #[serde(skip_serializing_if = "Option::is_none")]
2988    top: Option<i64>,
2989    /// The width of the screen in pixels.
2990    #[serde(skip_serializing_if = "Option::is_none")]
2991    width: Option<u64>,
2992    /// The height of the screen in pixels.
2993    #[serde(skip_serializing_if = "Option::is_none")]
2994    height: Option<i64>,
2995    /// Specifies the screen's work area.
2996    #[serde(skip_serializing_if = "Option::is_none")]
2997    workAreaInsets: Option<WorkAreaInsets>,
2998    /// Specifies the screen's device pixel ratio.
2999    #[serde(skip_serializing_if = "Option::is_none")]
3000    devicePixelRatio: Option<f64>,
3001    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
3002    #[serde(skip_serializing_if = "Option::is_none")]
3003    rotation: Option<i64>,
3004    /// Specifies the screen's color depth in bits.
3005    #[serde(skip_serializing_if = "Option::is_none")]
3006    colorDepth: Option<i64>,
3007    /// Specifies the descriptive label for the screen.
3008    #[serde(skip_serializing_if = "Option::is_none")]
3009    label: Option<Cow<'a, str>>,
3010    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3011    #[serde(skip_serializing_if = "Option::is_none")]
3012    isInternal: Option<bool>,
3013}
3014
3015impl<'a> UpdateScreenParams<'a> {
3016    pub fn builder(screenId: ScreenId<'a>) -> UpdateScreenParamsBuilder<'a> {
3017        UpdateScreenParamsBuilder {
3018            screenId: screenId,
3019            left: None,
3020            top: None,
3021            width: None,
3022            height: None,
3023            workAreaInsets: None,
3024            devicePixelRatio: None,
3025            rotation: None,
3026            colorDepth: None,
3027            label: None,
3028            isInternal: None,
3029        }
3030    }
3031    pub fn screenId(&self) -> &ScreenId<'a> { &self.screenId }
3032    pub fn left(&self) -> Option<i64> { self.left }
3033    pub fn top(&self) -> Option<i64> { self.top }
3034    pub fn width(&self) -> Option<u64> { self.width }
3035    pub fn height(&self) -> Option<i64> { self.height }
3036    pub fn workAreaInsets(&self) -> Option<&WorkAreaInsets> { self.workAreaInsets.as_ref() }
3037    pub fn devicePixelRatio(&self) -> Option<f64> { self.devicePixelRatio }
3038    pub fn rotation(&self) -> Option<i64> { self.rotation }
3039    pub fn colorDepth(&self) -> Option<i64> { self.colorDepth }
3040    pub fn label(&self) -> Option<&str> { self.label.as_deref() }
3041    pub fn isInternal(&self) -> Option<bool> { self.isInternal }
3042}
3043
3044
3045pub struct UpdateScreenParamsBuilder<'a> {
3046    screenId: ScreenId<'a>,
3047    left: Option<i64>,
3048    top: Option<i64>,
3049    width: Option<u64>,
3050    height: Option<i64>,
3051    workAreaInsets: Option<WorkAreaInsets>,
3052    devicePixelRatio: Option<f64>,
3053    rotation: Option<i64>,
3054    colorDepth: Option<i64>,
3055    label: Option<Cow<'a, str>>,
3056    isInternal: Option<bool>,
3057}
3058
3059impl<'a> UpdateScreenParamsBuilder<'a> {
3060    /// Offset of the left edge of the screen in pixels.
3061    pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
3062    /// Offset of the top edge of the screen in pixels.
3063    pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
3064    /// The width of the screen in pixels.
3065    pub fn width(mut self, width: u64) -> Self { self.width = Some(width); self }
3066    /// The height of the screen in pixels.
3067    pub fn height(mut self, height: i64) -> Self { self.height = Some(height); self }
3068    /// Specifies the screen's work area.
3069    pub fn workAreaInsets(mut self, workAreaInsets: WorkAreaInsets) -> Self { self.workAreaInsets = Some(workAreaInsets); self }
3070    /// Specifies the screen's device pixel ratio.
3071    pub fn devicePixelRatio(mut self, devicePixelRatio: f64) -> Self { self.devicePixelRatio = Some(devicePixelRatio); self }
3072    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
3073    pub fn rotation(mut self, rotation: i64) -> Self { self.rotation = Some(rotation); self }
3074    /// Specifies the screen's color depth in bits.
3075    pub fn colorDepth(mut self, colorDepth: i64) -> Self { self.colorDepth = Some(colorDepth); self }
3076    /// Specifies the descriptive label for the screen.
3077    pub fn label(mut self, label: impl Into<Cow<'a, str>>) -> Self { self.label = Some(label.into()); self }
3078    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3079    pub fn isInternal(mut self, isInternal: bool) -> Self { self.isInternal = Some(isInternal); self }
3080    pub fn build(self) -> UpdateScreenParams<'a> {
3081        UpdateScreenParams {
3082            screenId: self.screenId,
3083            left: self.left,
3084            top: self.top,
3085            width: self.width,
3086            height: self.height,
3087            workAreaInsets: self.workAreaInsets,
3088            devicePixelRatio: self.devicePixelRatio,
3089            rotation: self.rotation,
3090            colorDepth: self.colorDepth,
3091            label: self.label,
3092            isInternal: self.isInternal,
3093        }
3094    }
3095}
3096
3097/// Updates specified screen parameters. Only supported in headless mode.
3098
3099#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3100#[serde(rename_all = "camelCase")]
3101pub struct UpdateScreenReturns<'a> {
3102    screenInfo: ScreenInfo<'a>,
3103}
3104
3105impl<'a> UpdateScreenReturns<'a> {
3106    pub fn builder(screenInfo: ScreenInfo<'a>) -> UpdateScreenReturnsBuilder<'a> {
3107        UpdateScreenReturnsBuilder {
3108            screenInfo: screenInfo,
3109        }
3110    }
3111    pub fn screenInfo(&self) -> &ScreenInfo<'a> { &self.screenInfo }
3112}
3113
3114
3115pub struct UpdateScreenReturnsBuilder<'a> {
3116    screenInfo: ScreenInfo<'a>,
3117}
3118
3119impl<'a> UpdateScreenReturnsBuilder<'a> {
3120    pub fn build(self) -> UpdateScreenReturns<'a> {
3121        UpdateScreenReturns {
3122            screenInfo: self.screenInfo,
3123        }
3124    }
3125}
3126
3127impl<'a> UpdateScreenParams<'a> { pub const METHOD: &'static str = "Emulation.updateScreen"; }
3128
3129impl<'a> crate::CdpCommand<'a> for UpdateScreenParams<'a> {
3130    const METHOD: &'static str = "Emulation.updateScreen";
3131    type Response = UpdateScreenReturns<'a>;
3132}
3133
3134/// Remove screen from the device. Only supported in headless mode.
3135
3136#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3137#[serde(rename_all = "camelCase")]
3138pub struct RemoveScreenParams<'a> {
3139    screenId: ScreenId<'a>,
3140}
3141
3142impl<'a> RemoveScreenParams<'a> {
3143    pub fn builder(screenId: ScreenId<'a>) -> RemoveScreenParamsBuilder<'a> {
3144        RemoveScreenParamsBuilder {
3145            screenId: screenId,
3146        }
3147    }
3148    pub fn screenId(&self) -> &ScreenId<'a> { &self.screenId }
3149}
3150
3151
3152pub struct RemoveScreenParamsBuilder<'a> {
3153    screenId: ScreenId<'a>,
3154}
3155
3156impl<'a> RemoveScreenParamsBuilder<'a> {
3157    pub fn build(self) -> RemoveScreenParams<'a> {
3158        RemoveScreenParams {
3159            screenId: self.screenId,
3160        }
3161    }
3162}
3163
3164impl<'a> RemoveScreenParams<'a> { pub const METHOD: &'static str = "Emulation.removeScreen"; }
3165
3166impl<'a> crate::CdpCommand<'a> for RemoveScreenParams<'a> {
3167    const METHOD: &'static str = "Emulation.removeScreen";
3168    type Response = crate::EmptyReturns;
3169}
3170
3171/// Set primary screen. Only supported in headless mode.
3172/// Note that this changes the coordinate system origin to the top-left
3173/// of the new primary screen, updating the bounds and work areas
3174/// of all existing screens accordingly.
3175
3176#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3177#[serde(rename_all = "camelCase")]
3178pub struct SetPrimaryScreenParams<'a> {
3179    screenId: ScreenId<'a>,
3180}
3181
3182impl<'a> SetPrimaryScreenParams<'a> {
3183    pub fn builder(screenId: ScreenId<'a>) -> SetPrimaryScreenParamsBuilder<'a> {
3184        SetPrimaryScreenParamsBuilder {
3185            screenId: screenId,
3186        }
3187    }
3188    pub fn screenId(&self) -> &ScreenId<'a> { &self.screenId }
3189}
3190
3191
3192pub struct SetPrimaryScreenParamsBuilder<'a> {
3193    screenId: ScreenId<'a>,
3194}
3195
3196impl<'a> SetPrimaryScreenParamsBuilder<'a> {
3197    pub fn build(self) -> SetPrimaryScreenParams<'a> {
3198        SetPrimaryScreenParams {
3199            screenId: self.screenId,
3200        }
3201    }
3202}
3203
3204impl<'a> SetPrimaryScreenParams<'a> { pub const METHOD: &'static str = "Emulation.setPrimaryScreen"; }
3205
3206impl<'a> crate::CdpCommand<'a> for SetPrimaryScreenParams<'a> {
3207    const METHOD: &'static str = "Emulation.setPrimaryScreen";
3208    type Response = crate::EmptyReturns;
3209}