Skip to main content

browser_protocol/emulation/
mod.rs

1//! This domain emulates different environments for the page.
2use serde::{Serialize, Deserialize};
3use serde_json::Value as JsonValue;
4
5
6#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7#[serde(rename_all = "camelCase")]
8pub struct SafeAreaInsets {
9    /// Overrides safe-area-inset-top.
10
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub top: Option<i64>,
13    /// Overrides safe-area-max-inset-top.
14
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub topMax: Option<i64>,
17    /// Overrides safe-area-inset-left.
18
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub left: Option<i64>,
21    /// Overrides safe-area-max-inset-left.
22
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub leftMax: Option<i64>,
25    /// Overrides safe-area-inset-bottom.
26
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub bottom: Option<i64>,
29    /// Overrides safe-area-max-inset-bottom.
30
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub bottomMax: Option<i64>,
33    /// Overrides safe-area-inset-right.
34
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub right: Option<i64>,
37    /// Overrides safe-area-max-inset-right.
38
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub rightMax: Option<i64>,
41}
42
43/// Screen orientation.
44
45#[derive(Debug, Clone, Serialize, Deserialize, Default)]
46#[serde(rename_all = "camelCase")]
47pub struct ScreenOrientation {
48    /// Orientation type.
49
50    #[serde(rename = "type")]
51    pub type_: String,
52    /// Orientation angle.
53
54    pub angle: i64,
55}
56
57
58#[derive(Debug, Clone, Serialize, Deserialize, Default)]
59#[serde(rename_all = "camelCase")]
60pub struct DisplayFeature {
61    /// Orientation of a display feature in relation to screen
62
63    pub orientation: String,
64    /// The offset from the screen origin in either the x (for vertical
65    /// orientation) or y (for horizontal orientation) direction.
66
67    pub offset: i32,
68    /// A display feature may mask content such that it is not physically
69    /// displayed - this length along with the offset describes this area.
70    /// A display feature that only splits content will have a 0 mask_length.
71
72    pub maskLength: u64,
73}
74
75
76#[derive(Debug, Clone, Serialize, Deserialize, Default)]
77#[serde(rename_all = "camelCase")]
78pub struct DevicePosture {
79    /// Current posture of the device
80
81    #[serde(rename = "type")]
82    pub type_: String,
83}
84
85
86#[derive(Debug, Clone, Serialize, Deserialize, Default)]
87#[serde(rename_all = "camelCase")]
88pub struct MediaFeature {
89
90    pub name: String,
91
92    pub value: String,
93}
94
95/// advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to
96/// allow the next delayed task (if any) to run; pause: The virtual time base may not advance;
97/// pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending
98/// resource fetches.
99
100#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
101pub enum VirtualTimePolicy {
102    #[default]
103    Advance,
104    Pause,
105    PauseIfNetworkFetchesPending,
106}
107
108/// Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
109
110#[derive(Debug, Clone, Serialize, Deserialize, Default)]
111#[serde(rename_all = "camelCase")]
112pub struct UserAgentBrandVersion {
113
114    pub brand: String,
115
116    pub version: String,
117}
118
119/// Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
120/// Missing optional values will be filled in by the target with what it would normally use.
121
122#[derive(Debug, Clone, Serialize, Deserialize, Default)]
123#[serde(rename_all = "camelCase")]
124pub struct UserAgentMetadata {
125    /// Brands appearing in Sec-CH-UA.
126
127    #[serde(skip_serializing_if = "Option::is_none")]
128    pub brands: Option<Vec<UserAgentBrandVersion>>,
129    /// Brands appearing in Sec-CH-UA-Full-Version-List.
130
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub fullVersionList: Option<Vec<UserAgentBrandVersion>>,
133
134    #[serde(skip_serializing_if = "Option::is_none")]
135    pub fullVersion: Option<String>,
136
137    pub platform: String,
138
139    pub platformVersion: String,
140
141    pub architecture: String,
142
143    pub model: String,
144
145    pub mobile: bool,
146
147    #[serde(skip_serializing_if = "Option::is_none")]
148    pub bitness: Option<String>,
149
150    #[serde(skip_serializing_if = "Option::is_none")]
151    pub wow64: Option<bool>,
152    /// Used to specify User Agent form-factor values.
153    /// See https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors
154
155    #[serde(skip_serializing_if = "Option::is_none")]
156    pub formFactors: Option<Vec<String>>,
157}
158
159/// Used to specify sensor types to emulate.
160/// See https://w3c.github.io/sensors/#automation for more information.
161
162#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
163pub enum SensorType {
164    #[default]
165    AbsoluteOrientation,
166    Accelerometer,
167    AmbientLight,
168    Gravity,
169    Gyroscope,
170    LinearAcceleration,
171    Magnetometer,
172    RelativeOrientation,
173}
174
175
176#[derive(Debug, Clone, Serialize, Deserialize, Default)]
177#[serde(rename_all = "camelCase")]
178pub struct SensorMetadata {
179
180    #[serde(skip_serializing_if = "Option::is_none")]
181    pub available: Option<bool>,
182
183    #[serde(skip_serializing_if = "Option::is_none")]
184    pub minimumFrequency: Option<f64>,
185
186    #[serde(skip_serializing_if = "Option::is_none")]
187    pub maximumFrequency: Option<f64>,
188}
189
190
191#[derive(Debug, Clone, Serialize, Deserialize, Default)]
192#[serde(rename_all = "camelCase")]
193pub struct SensorReadingSingle {
194
195    pub value: f64,
196}
197
198
199#[derive(Debug, Clone, Serialize, Deserialize, Default)]
200#[serde(rename_all = "camelCase")]
201pub struct SensorReadingXYZ {
202
203    pub x: f64,
204
205    pub y: f64,
206
207    pub z: f64,
208}
209
210
211#[derive(Debug, Clone, Serialize, Deserialize, Default)]
212#[serde(rename_all = "camelCase")]
213pub struct SensorReadingQuaternion {
214
215    pub x: f64,
216
217    pub y: f64,
218
219    pub z: f64,
220
221    pub w: f64,
222}
223
224
225#[derive(Debug, Clone, Serialize, Deserialize, Default)]
226#[serde(rename_all = "camelCase")]
227pub struct SensorReading {
228
229    #[serde(skip_serializing_if = "Option::is_none")]
230    pub single: Option<SensorReadingSingle>,
231
232    #[serde(skip_serializing_if = "Option::is_none")]
233    pub xyz: Option<SensorReadingXYZ>,
234
235    #[serde(skip_serializing_if = "Option::is_none")]
236    pub quaternion: Option<SensorReadingQuaternion>,
237}
238
239
240#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
241pub enum PressureSource {
242    #[default]
243    Cpu,
244}
245
246
247#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
248pub enum PressureState {
249    #[default]
250    Nominal,
251    Fair,
252    Serious,
253    Critical,
254}
255
256
257#[derive(Debug, Clone, Serialize, Deserialize, Default)]
258#[serde(rename_all = "camelCase")]
259pub struct PressureMetadata {
260
261    #[serde(skip_serializing_if = "Option::is_none")]
262    pub available: Option<bool>,
263}
264
265
266#[derive(Debug, Clone, Serialize, Deserialize, Default)]
267#[serde(rename_all = "camelCase")]
268pub struct WorkAreaInsets {
269    /// Work area top inset in pixels. Default is 0;
270
271    #[serde(skip_serializing_if = "Option::is_none")]
272    pub top: Option<i64>,
273    /// Work area left inset in pixels. Default is 0;
274
275    #[serde(skip_serializing_if = "Option::is_none")]
276    pub left: Option<i64>,
277    /// Work area bottom inset in pixels. Default is 0;
278
279    #[serde(skip_serializing_if = "Option::is_none")]
280    pub bottom: Option<i64>,
281    /// Work area right inset in pixels. Default is 0;
282
283    #[serde(skip_serializing_if = "Option::is_none")]
284    pub right: Option<i64>,
285}
286
287
288pub type ScreenId = String;
289
290/// Screen information similar to the one returned by window.getScreenDetails() method,
291/// see https://w3c.github.io/window-management/#screendetailed.
292
293#[derive(Debug, Clone, Serialize, Deserialize, Default)]
294#[serde(rename_all = "camelCase")]
295pub struct ScreenInfo {
296    /// Offset of the left edge of the screen.
297
298    pub left: i64,
299    /// Offset of the top edge of the screen.
300
301    pub top: i64,
302    /// Width of the screen.
303
304    pub width: u64,
305    /// Height of the screen.
306
307    pub height: i64,
308    /// Offset of the left edge of the available screen area.
309
310    pub availLeft: i64,
311    /// Offset of the top edge of the available screen area.
312
313    pub availTop: i64,
314    /// Width of the available screen area.
315
316    pub availWidth: u64,
317    /// Height of the available screen area.
318
319    pub availHeight: i64,
320    /// Specifies the screen's device pixel ratio.
321
322    pub devicePixelRatio: f64,
323    /// Specifies the screen's orientation.
324
325    pub orientation: ScreenOrientation,
326    /// Specifies the screen's color depth in bits.
327
328    pub colorDepth: i64,
329    /// Indicates whether the device has multiple screens.
330
331    pub isExtended: bool,
332    /// Indicates whether the screen is internal to the device or external, attached to the device.
333
334    pub isInternal: bool,
335    /// Indicates whether the screen is set as the the operating system primary screen.
336
337    pub isPrimary: bool,
338    /// Specifies the descriptive label for the screen.
339
340    pub label: String,
341    /// Specifies the unique identifier of the screen.
342
343    pub id: ScreenId,
344}
345
346/// Enum of image types that can be disabled.
347
348#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
349pub enum DisabledImageType {
350    #[default]
351    Avif,
352    Jxl,
353    Webp,
354}
355
356/// Tells whether emulation is supported.
357
358#[derive(Debug, Clone, Serialize, Deserialize, Default)]
359#[serde(rename_all = "camelCase")]
360pub struct CanEmulateReturns {
361    /// True if emulation is supported.
362
363    pub result: bool,
364}
365
366#[derive(Debug, Clone, Serialize, Deserialize, Default)]
367pub struct CanEmulateParams {}
368
369impl CanEmulateParams { pub const METHOD: &'static str = "Emulation.canEmulate"; }
370
371impl crate::CdpCommand for CanEmulateParams {
372    const METHOD: &'static str = "Emulation.canEmulate";
373    type Response = CanEmulateReturns;
374}
375
376#[derive(Debug, Clone, Serialize, Deserialize, Default)]
377pub struct ClearDeviceMetricsOverrideParams {}
378
379impl ClearDeviceMetricsOverrideParams { pub const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride"; }
380
381impl crate::CdpCommand for ClearDeviceMetricsOverrideParams {
382    const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride";
383    type Response = crate::EmptyReturns;
384}
385
386#[derive(Debug, Clone, Serialize, Deserialize, Default)]
387pub struct ClearGeolocationOverrideParams {}
388
389impl ClearGeolocationOverrideParams { pub const METHOD: &'static str = "Emulation.clearGeolocationOverride"; }
390
391impl crate::CdpCommand for ClearGeolocationOverrideParams {
392    const METHOD: &'static str = "Emulation.clearGeolocationOverride";
393    type Response = crate::EmptyReturns;
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize, Default)]
397pub struct ResetPageScaleFactorParams {}
398
399impl ResetPageScaleFactorParams { pub const METHOD: &'static str = "Emulation.resetPageScaleFactor"; }
400
401impl crate::CdpCommand for ResetPageScaleFactorParams {
402    const METHOD: &'static str = "Emulation.resetPageScaleFactor";
403    type Response = crate::EmptyReturns;
404}
405
406/// Enables or disables simulating a focused and active page.
407
408#[derive(Debug, Clone, Serialize, Deserialize, Default)]
409#[serde(rename_all = "camelCase")]
410pub struct SetFocusEmulationEnabledParams {
411    /// Whether to enable to disable focus emulation.
412
413    pub enabled: bool,
414}
415
416impl SetFocusEmulationEnabledParams { pub const METHOD: &'static str = "Emulation.setFocusEmulationEnabled"; }
417
418impl crate::CdpCommand for SetFocusEmulationEnabledParams {
419    const METHOD: &'static str = "Emulation.setFocusEmulationEnabled";
420    type Response = crate::EmptyReturns;
421}
422
423/// Automatically render all web contents using a dark theme.
424
425#[derive(Debug, Clone, Serialize, Deserialize, Default)]
426#[serde(rename_all = "camelCase")]
427pub struct SetAutoDarkModeOverrideParams {
428    /// Whether to enable or disable automatic dark mode.
429    /// If not specified, any existing override will be cleared.
430
431    #[serde(skip_serializing_if = "Option::is_none")]
432    pub enabled: Option<bool>,
433}
434
435impl SetAutoDarkModeOverrideParams { pub const METHOD: &'static str = "Emulation.setAutoDarkModeOverride"; }
436
437impl crate::CdpCommand for SetAutoDarkModeOverrideParams {
438    const METHOD: &'static str = "Emulation.setAutoDarkModeOverride";
439    type Response = crate::EmptyReturns;
440}
441
442/// Enables CPU throttling to emulate slow CPUs.
443
444#[derive(Debug, Clone, Serialize, Deserialize, Default)]
445#[serde(rename_all = "camelCase")]
446pub struct SetCPUThrottlingRateParams {
447    /// Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
448
449    pub rate: f64,
450}
451
452impl SetCPUThrottlingRateParams { pub const METHOD: &'static str = "Emulation.setCPUThrottlingRate"; }
453
454impl crate::CdpCommand for SetCPUThrottlingRateParams {
455    const METHOD: &'static str = "Emulation.setCPUThrottlingRate";
456    type Response = crate::EmptyReturns;
457}
458
459/// Sets or clears an override of the default background color of the frame. This override is used
460/// if the content does not specify one.
461
462#[derive(Debug, Clone, Serialize, Deserialize, Default)]
463#[serde(rename_all = "camelCase")]
464pub struct SetDefaultBackgroundColorOverrideParams {
465    /// RGBA of the default background color. If not specified, any existing override will be
466    /// cleared.
467
468    #[serde(skip_serializing_if = "Option::is_none")]
469    pub color: Option<crate::dom::RGBA>,
470}
471
472impl SetDefaultBackgroundColorOverrideParams { pub const METHOD: &'static str = "Emulation.setDefaultBackgroundColorOverride"; }
473
474impl crate::CdpCommand for SetDefaultBackgroundColorOverrideParams {
475    const METHOD: &'static str = "Emulation.setDefaultBackgroundColorOverride";
476    type Response = crate::EmptyReturns;
477}
478
479/// Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the
480/// respective variables to be undefined, even if previously overridden.
481
482#[derive(Debug, Clone, Serialize, Deserialize, Default)]
483#[serde(rename_all = "camelCase")]
484pub struct SetSafeAreaInsetsOverrideParams {
485
486    pub insets: SafeAreaInsets,
487}
488
489impl SetSafeAreaInsetsOverrideParams { pub const METHOD: &'static str = "Emulation.setSafeAreaInsetsOverride"; }
490
491impl crate::CdpCommand for SetSafeAreaInsetsOverrideParams {
492    const METHOD: &'static str = "Emulation.setSafeAreaInsetsOverride";
493    type Response = crate::EmptyReturns;
494}
495
496/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
497/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
498/// query results).
499
500#[derive(Debug, Clone, Serialize, Deserialize, Default)]
501#[serde(rename_all = "camelCase")]
502pub struct SetDeviceMetricsOverrideParams {
503    /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
504
505    pub width: u64,
506    /// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
507
508    pub height: i64,
509    /// Overriding device scale factor value. 0 disables the override.
510
511    pub deviceScaleFactor: f64,
512    /// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text
513    /// autosizing and more.
514
515    pub mobile: bool,
516    /// Scale to apply to resulting view image.
517
518    #[serde(skip_serializing_if = "Option::is_none")]
519    pub scale: Option<f64>,
520    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
521
522    #[serde(skip_serializing_if = "Option::is_none")]
523    pub screenWidth: Option<u64>,
524    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
525
526    #[serde(skip_serializing_if = "Option::is_none")]
527    pub screenHeight: Option<i64>,
528    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
529
530    #[serde(skip_serializing_if = "Option::is_none")]
531    pub positionX: Option<i64>,
532    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
533
534    #[serde(skip_serializing_if = "Option::is_none")]
535    pub positionY: Option<i64>,
536    /// Do not set visible view size, rely upon explicit setVisibleSize call.
537
538    #[serde(skip_serializing_if = "Option::is_none")]
539    pub dontSetVisibleSize: Option<bool>,
540    /// Screen orientation override.
541
542    #[serde(skip_serializing_if = "Option::is_none")]
543    pub screenOrientation: Option<ScreenOrientation>,
544    /// If set, the visible area of the page will be overridden to this viewport. This viewport
545    /// change is not observed by the page, e.g. viewport-relative elements do not change positions.
546
547    #[serde(skip_serializing_if = "Option::is_none")]
548    pub viewport: Option<crate::page::Viewport>,
549    /// If set, the display feature of a multi-segment screen. If not set, multi-segment support
550    /// is turned-off.
551    /// Deprecated, use Emulation.setDisplayFeaturesOverride.
552
553    #[serde(skip_serializing_if = "Option::is_none")]
554    pub displayFeature: Option<DisplayFeature>,
555    /// If set, the posture of a foldable device. If not set the posture is set
556    /// to continuous.
557    /// Deprecated, use Emulation.setDevicePostureOverride.
558
559    #[serde(skip_serializing_if = "Option::is_none")]
560    pub devicePosture: Option<DevicePosture>,
561    /// Scrollbar type. Default: 'default'.
562
563    #[serde(skip_serializing_if = "Option::is_none")]
564    pub scrollbarType: Option<String>,
565    /// If set to true, enables screen orientation lock emulation, which
566    /// intercepts screen.orientation.lock() calls from the page and reports
567    /// orientation changes via screenOrientationLockChanged events. This is
568    /// useful for emulating mobile device orientation lock behavior in
569    /// responsive design mode.
570
571    #[serde(skip_serializing_if = "Option::is_none")]
572    pub screenOrientationLockEmulation: Option<bool>,
573}
574
575impl SetDeviceMetricsOverrideParams { pub const METHOD: &'static str = "Emulation.setDeviceMetricsOverride"; }
576
577impl crate::CdpCommand for SetDeviceMetricsOverrideParams {
578    const METHOD: &'static str = "Emulation.setDeviceMetricsOverride";
579    type Response = crate::EmptyReturns;
580}
581
582/// Start reporting the given posture value to the Device Posture API.
583/// This override can also be set in setDeviceMetricsOverride().
584
585#[derive(Debug, Clone, Serialize, Deserialize, Default)]
586#[serde(rename_all = "camelCase")]
587pub struct SetDevicePostureOverrideParams {
588
589    pub posture: DevicePosture,
590}
591
592impl SetDevicePostureOverrideParams { pub const METHOD: &'static str = "Emulation.setDevicePostureOverride"; }
593
594impl crate::CdpCommand for SetDevicePostureOverrideParams {
595    const METHOD: &'static str = "Emulation.setDevicePostureOverride";
596    type Response = crate::EmptyReturns;
597}
598
599#[derive(Debug, Clone, Serialize, Deserialize, Default)]
600pub struct ClearDevicePostureOverrideParams {}
601
602impl ClearDevicePostureOverrideParams { pub const METHOD: &'static str = "Emulation.clearDevicePostureOverride"; }
603
604impl crate::CdpCommand for ClearDevicePostureOverrideParams {
605    const METHOD: &'static str = "Emulation.clearDevicePostureOverride";
606    type Response = crate::EmptyReturns;
607}
608
609/// Start using the given display features to pupulate the Viewport Segments API.
610/// This override can also be set in setDeviceMetricsOverride().
611
612#[derive(Debug, Clone, Serialize, Deserialize, Default)]
613#[serde(rename_all = "camelCase")]
614pub struct SetDisplayFeaturesOverrideParams {
615
616    pub features: Vec<DisplayFeature>,
617}
618
619impl SetDisplayFeaturesOverrideParams { pub const METHOD: &'static str = "Emulation.setDisplayFeaturesOverride"; }
620
621impl crate::CdpCommand for SetDisplayFeaturesOverrideParams {
622    const METHOD: &'static str = "Emulation.setDisplayFeaturesOverride";
623    type Response = crate::EmptyReturns;
624}
625
626#[derive(Debug, Clone, Serialize, Deserialize, Default)]
627pub struct ClearDisplayFeaturesOverrideParams {}
628
629impl ClearDisplayFeaturesOverrideParams { pub const METHOD: &'static str = "Emulation.clearDisplayFeaturesOverride"; }
630
631impl crate::CdpCommand for ClearDisplayFeaturesOverrideParams {
632    const METHOD: &'static str = "Emulation.clearDisplayFeaturesOverride";
633    type Response = crate::EmptyReturns;
634}
635
636
637#[derive(Debug, Clone, Serialize, Deserialize, Default)]
638#[serde(rename_all = "camelCase")]
639pub struct SetScrollbarsHiddenParams {
640    /// Whether scrollbars should be always hidden.
641
642    pub hidden: bool,
643}
644
645impl SetScrollbarsHiddenParams { pub const METHOD: &'static str = "Emulation.setScrollbarsHidden"; }
646
647impl crate::CdpCommand for SetScrollbarsHiddenParams {
648    const METHOD: &'static str = "Emulation.setScrollbarsHidden";
649    type Response = crate::EmptyReturns;
650}
651
652
653#[derive(Debug, Clone, Serialize, Deserialize, Default)]
654#[serde(rename_all = "camelCase")]
655pub struct SetDocumentCookieDisabledParams {
656    /// Whether document.coookie API should be disabled.
657
658    pub disabled: bool,
659}
660
661impl SetDocumentCookieDisabledParams { pub const METHOD: &'static str = "Emulation.setDocumentCookieDisabled"; }
662
663impl crate::CdpCommand for SetDocumentCookieDisabledParams {
664    const METHOD: &'static str = "Emulation.setDocumentCookieDisabled";
665    type Response = crate::EmptyReturns;
666}
667
668
669#[derive(Debug, Clone, Serialize, Deserialize, Default)]
670#[serde(rename_all = "camelCase")]
671pub struct SetEmitTouchEventsForMouseParams {
672    /// Whether touch emulation based on mouse input should be enabled.
673
674    pub enabled: bool,
675    /// Touch/gesture events configuration. Default: current platform.
676
677    #[serde(skip_serializing_if = "Option::is_none")]
678    pub configuration: Option<String>,
679}
680
681impl SetEmitTouchEventsForMouseParams { pub const METHOD: &'static str = "Emulation.setEmitTouchEventsForMouse"; }
682
683impl crate::CdpCommand for SetEmitTouchEventsForMouseParams {
684    const METHOD: &'static str = "Emulation.setEmitTouchEventsForMouse";
685    type Response = crate::EmptyReturns;
686}
687
688/// Emulates the given media type or media feature for CSS media queries.
689
690#[derive(Debug, Clone, Serialize, Deserialize, Default)]
691#[serde(rename_all = "camelCase")]
692pub struct SetEmulatedMediaParams {
693    /// Media type to emulate. Empty string disables the override.
694
695    #[serde(skip_serializing_if = "Option::is_none")]
696    pub media: Option<String>,
697    /// Media features to emulate.
698
699    #[serde(skip_serializing_if = "Option::is_none")]
700    pub features: Option<Vec<MediaFeature>>,
701}
702
703impl SetEmulatedMediaParams { pub const METHOD: &'static str = "Emulation.setEmulatedMedia"; }
704
705impl crate::CdpCommand for SetEmulatedMediaParams {
706    const METHOD: &'static str = "Emulation.setEmulatedMedia";
707    type Response = crate::EmptyReturns;
708}
709
710/// Emulates the given vision deficiency.
711
712#[derive(Debug, Clone, Serialize, Deserialize, Default)]
713#[serde(rename_all = "camelCase")]
714pub struct SetEmulatedVisionDeficiencyParams {
715    /// Vision deficiency to emulate. Order: best-effort emulations come first, followed by any
716    /// physiologically accurate emulations for medically recognized color vision deficiencies.
717
718    #[serde(rename = "type")]
719    pub type_: String,
720}
721
722impl SetEmulatedVisionDeficiencyParams { pub const METHOD: &'static str = "Emulation.setEmulatedVisionDeficiency"; }
723
724impl crate::CdpCommand for SetEmulatedVisionDeficiencyParams {
725    const METHOD: &'static str = "Emulation.setEmulatedVisionDeficiency";
726    type Response = crate::EmptyReturns;
727}
728
729/// Emulates the given OS text scale.
730
731#[derive(Debug, Clone, Serialize, Deserialize, Default)]
732#[serde(rename_all = "camelCase")]
733pub struct SetEmulatedOSTextScaleParams {
734
735    #[serde(skip_serializing_if = "Option::is_none")]
736    pub scale: Option<f64>,
737}
738
739impl SetEmulatedOSTextScaleParams { pub const METHOD: &'static str = "Emulation.setEmulatedOSTextScale"; }
740
741impl crate::CdpCommand for SetEmulatedOSTextScaleParams {
742    const METHOD: &'static str = "Emulation.setEmulatedOSTextScale";
743    type Response = crate::EmptyReturns;
744}
745
746/// Overrides the Geolocation Position or Error. Omitting latitude, longitude or
747/// accuracy emulates position unavailable.
748
749#[derive(Debug, Clone, Serialize, Deserialize, Default)]
750#[serde(rename_all = "camelCase")]
751pub struct SetGeolocationOverrideParams {
752    /// Mock latitude
753
754    #[serde(skip_serializing_if = "Option::is_none")]
755    pub latitude: Option<f64>,
756    /// Mock longitude
757
758    #[serde(skip_serializing_if = "Option::is_none")]
759    pub longitude: Option<f64>,
760    /// Mock accuracy
761
762    #[serde(skip_serializing_if = "Option::is_none")]
763    pub accuracy: Option<f64>,
764    /// Mock altitude
765
766    #[serde(skip_serializing_if = "Option::is_none")]
767    pub altitude: Option<f64>,
768    /// Mock altitudeAccuracy
769
770    #[serde(skip_serializing_if = "Option::is_none")]
771    pub altitudeAccuracy: Option<f64>,
772    /// Mock heading
773
774    #[serde(skip_serializing_if = "Option::is_none")]
775    pub heading: Option<f64>,
776    /// Mock speed
777
778    #[serde(skip_serializing_if = "Option::is_none")]
779    pub speed: Option<f64>,
780}
781
782impl SetGeolocationOverrideParams { pub const METHOD: &'static str = "Emulation.setGeolocationOverride"; }
783
784impl crate::CdpCommand for SetGeolocationOverrideParams {
785    const METHOD: &'static str = "Emulation.setGeolocationOverride";
786    type Response = crate::EmptyReturns;
787}
788
789
790#[derive(Debug, Clone, Serialize, Deserialize, Default)]
791#[serde(rename_all = "camelCase")]
792pub struct GetOverriddenSensorInformationParams {
793
794    #[serde(rename = "type")]
795    pub type_: SensorType,
796}
797
798
799#[derive(Debug, Clone, Serialize, Deserialize, Default)]
800#[serde(rename_all = "camelCase")]
801pub struct GetOverriddenSensorInformationReturns {
802
803    pub requestedSamplingFrequency: f64,
804}
805
806impl GetOverriddenSensorInformationParams { pub const METHOD: &'static str = "Emulation.getOverriddenSensorInformation"; }
807
808impl crate::CdpCommand for GetOverriddenSensorInformationParams {
809    const METHOD: &'static str = "Emulation.getOverriddenSensorInformation";
810    type Response = GetOverriddenSensorInformationReturns;
811}
812
813/// Overrides a platform sensor of a given type. If |enabled| is true, calls to
814/// Sensor.start() will use a virtual sensor as backend rather than fetching
815/// data from a real hardware sensor. Otherwise, existing virtual
816/// sensor-backend Sensor objects will fire an error event and new calls to
817/// Sensor.start() will attempt to use a real sensor instead.
818
819#[derive(Debug, Clone, Serialize, Deserialize, Default)]
820#[serde(rename_all = "camelCase")]
821pub struct SetSensorOverrideEnabledParams {
822
823    pub enabled: bool,
824
825    #[serde(rename = "type")]
826    pub type_: SensorType,
827
828    #[serde(skip_serializing_if = "Option::is_none")]
829    pub metadata: Option<SensorMetadata>,
830}
831
832impl SetSensorOverrideEnabledParams { pub const METHOD: &'static str = "Emulation.setSensorOverrideEnabled"; }
833
834impl crate::CdpCommand for SetSensorOverrideEnabledParams {
835    const METHOD: &'static str = "Emulation.setSensorOverrideEnabled";
836    type Response = crate::EmptyReturns;
837}
838
839/// Updates the sensor readings reported by a sensor type previously overridden
840/// by setSensorOverrideEnabled.
841
842#[derive(Debug, Clone, Serialize, Deserialize, Default)]
843#[serde(rename_all = "camelCase")]
844pub struct SetSensorOverrideReadingsParams {
845
846    #[serde(rename = "type")]
847    pub type_: SensorType,
848
849    pub reading: SensorReading,
850}
851
852impl SetSensorOverrideReadingsParams { pub const METHOD: &'static str = "Emulation.setSensorOverrideReadings"; }
853
854impl crate::CdpCommand for SetSensorOverrideReadingsParams {
855    const METHOD: &'static str = "Emulation.setSensorOverrideReadings";
856    type Response = crate::EmptyReturns;
857}
858
859/// Overrides a pressure source of a given type, as used by the Compute
860/// Pressure API, so that updates to PressureObserver.observe() are provided
861/// via setPressureStateOverride instead of being retrieved from
862/// platform-provided telemetry data.
863
864#[derive(Debug, Clone, Serialize, Deserialize, Default)]
865#[serde(rename_all = "camelCase")]
866pub struct SetPressureSourceOverrideEnabledParams {
867
868    pub enabled: bool,
869
870    pub source: PressureSource,
871
872    #[serde(skip_serializing_if = "Option::is_none")]
873    pub metadata: Option<PressureMetadata>,
874}
875
876impl SetPressureSourceOverrideEnabledParams { pub const METHOD: &'static str = "Emulation.setPressureSourceOverrideEnabled"; }
877
878impl crate::CdpCommand for SetPressureSourceOverrideEnabledParams {
879    const METHOD: &'static str = "Emulation.setPressureSourceOverrideEnabled";
880    type Response = crate::EmptyReturns;
881}
882
883/// TODO: OBSOLETE: To remove when setPressureDataOverride is merged.
884/// Provides a given pressure state that will be processed and eventually be
885/// delivered to PressureObserver users. |source| must have been previously
886/// overridden by setPressureSourceOverrideEnabled.
887
888#[derive(Debug, Clone, Serialize, Deserialize, Default)]
889#[serde(rename_all = "camelCase")]
890pub struct SetPressureStateOverrideParams {
891
892    pub source: PressureSource,
893
894    pub state: PressureState,
895}
896
897impl SetPressureStateOverrideParams { pub const METHOD: &'static str = "Emulation.setPressureStateOverride"; }
898
899impl crate::CdpCommand for SetPressureStateOverrideParams {
900    const METHOD: &'static str = "Emulation.setPressureStateOverride";
901    type Response = crate::EmptyReturns;
902}
903
904/// Provides a given pressure data set that will be processed and eventually be
905/// delivered to PressureObserver users. |source| must have been previously
906/// overridden by setPressureSourceOverrideEnabled.
907
908#[derive(Debug, Clone, Serialize, Deserialize, Default)]
909#[serde(rename_all = "camelCase")]
910pub struct SetPressureDataOverrideParams {
911
912    pub source: PressureSource,
913
914    pub state: PressureState,
915
916    #[serde(skip_serializing_if = "Option::is_none")]
917    pub ownContributionEstimate: Option<f64>,
918}
919
920impl SetPressureDataOverrideParams { pub const METHOD: &'static str = "Emulation.setPressureDataOverride"; }
921
922impl crate::CdpCommand for SetPressureDataOverrideParams {
923    const METHOD: &'static str = "Emulation.setPressureDataOverride";
924    type Response = crate::EmptyReturns;
925}
926
927/// Overrides the Idle state.
928
929#[derive(Debug, Clone, Serialize, Deserialize, Default)]
930#[serde(rename_all = "camelCase")]
931pub struct SetIdleOverrideParams {
932    /// Mock isUserActive
933
934    pub isUserActive: bool,
935    /// Mock isScreenUnlocked
936
937    pub isScreenUnlocked: bool,
938}
939
940impl SetIdleOverrideParams { pub const METHOD: &'static str = "Emulation.setIdleOverride"; }
941
942impl crate::CdpCommand for SetIdleOverrideParams {
943    const METHOD: &'static str = "Emulation.setIdleOverride";
944    type Response = crate::EmptyReturns;
945}
946
947#[derive(Debug, Clone, Serialize, Deserialize, Default)]
948pub struct ClearIdleOverrideParams {}
949
950impl ClearIdleOverrideParams { pub const METHOD: &'static str = "Emulation.clearIdleOverride"; }
951
952impl crate::CdpCommand for ClearIdleOverrideParams {
953    const METHOD: &'static str = "Emulation.clearIdleOverride";
954    type Response = crate::EmptyReturns;
955}
956
957/// Overrides value returned by the javascript navigator object.
958
959#[derive(Debug, Clone, Serialize, Deserialize, Default)]
960#[serde(rename_all = "camelCase")]
961pub struct SetNavigatorOverridesParams {
962    /// The platform navigator.platform should return.
963
964    pub platform: String,
965}
966
967impl SetNavigatorOverridesParams { pub const METHOD: &'static str = "Emulation.setNavigatorOverrides"; }
968
969impl crate::CdpCommand for SetNavigatorOverridesParams {
970    const METHOD: &'static str = "Emulation.setNavigatorOverrides";
971    type Response = crate::EmptyReturns;
972}
973
974/// Sets a specified page scale factor.
975
976#[derive(Debug, Clone, Serialize, Deserialize, Default)]
977#[serde(rename_all = "camelCase")]
978pub struct SetPageScaleFactorParams {
979    /// Page scale factor.
980
981    pub pageScaleFactor: f64,
982}
983
984impl SetPageScaleFactorParams { pub const METHOD: &'static str = "Emulation.setPageScaleFactor"; }
985
986impl crate::CdpCommand for SetPageScaleFactorParams {
987    const METHOD: &'static str = "Emulation.setPageScaleFactor";
988    type Response = crate::EmptyReturns;
989}
990
991/// Switches script execution in the page.
992
993#[derive(Debug, Clone, Serialize, Deserialize, Default)]
994#[serde(rename_all = "camelCase")]
995pub struct SetScriptExecutionDisabledParams {
996    /// Whether script execution should be disabled in the page.
997
998    pub value: bool,
999}
1000
1001impl SetScriptExecutionDisabledParams { pub const METHOD: &'static str = "Emulation.setScriptExecutionDisabled"; }
1002
1003impl crate::CdpCommand for SetScriptExecutionDisabledParams {
1004    const METHOD: &'static str = "Emulation.setScriptExecutionDisabled";
1005    type Response = crate::EmptyReturns;
1006}
1007
1008/// Enables touch on platforms which do not support them.
1009
1010#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1011#[serde(rename_all = "camelCase")]
1012pub struct SetTouchEmulationEnabledParams {
1013    /// Whether the touch event emulation should be enabled.
1014
1015    pub enabled: bool,
1016    /// Maximum touch points supported. Defaults to one.
1017
1018    #[serde(skip_serializing_if = "Option::is_none")]
1019    pub maxTouchPoints: Option<i64>,
1020}
1021
1022impl SetTouchEmulationEnabledParams { pub const METHOD: &'static str = "Emulation.setTouchEmulationEnabled"; }
1023
1024impl crate::CdpCommand for SetTouchEmulationEnabledParams {
1025    const METHOD: &'static str = "Emulation.setTouchEmulationEnabled";
1026    type Response = crate::EmptyReturns;
1027}
1028
1029/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
1030/// the current virtual time policy.  Note this supersedes any previous time budget.
1031
1032#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1033#[serde(rename_all = "camelCase")]
1034pub struct SetVirtualTimePolicyParams {
1035
1036    pub policy: VirtualTimePolicy,
1037    /// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a
1038    /// virtualTimeBudgetExpired event is sent.
1039
1040    #[serde(skip_serializing_if = "Option::is_none")]
1041    pub budget: Option<f64>,
1042    /// If set this specifies the maximum number of tasks that can be run before virtual is forced
1043    /// forwards to prevent deadlock.
1044
1045    #[serde(skip_serializing_if = "Option::is_none")]
1046    pub maxVirtualTimeTaskStarvationCount: Option<u64>,
1047    /// If set, base::Time::Now will be overridden to initially return this value.
1048
1049    #[serde(skip_serializing_if = "Option::is_none")]
1050    pub initialVirtualTime: Option<crate::network::TimeSinceEpoch>,
1051}
1052
1053/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
1054/// the current virtual time policy.  Note this supersedes any previous time budget.
1055
1056#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1057#[serde(rename_all = "camelCase")]
1058pub struct SetVirtualTimePolicyReturns {
1059    /// Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
1060
1061    pub virtualTimeTicksBase: f64,
1062}
1063
1064impl SetVirtualTimePolicyParams { pub const METHOD: &'static str = "Emulation.setVirtualTimePolicy"; }
1065
1066impl crate::CdpCommand for SetVirtualTimePolicyParams {
1067    const METHOD: &'static str = "Emulation.setVirtualTimePolicy";
1068    type Response = SetVirtualTimePolicyReturns;
1069}
1070
1071/// Overrides default host system locale with the specified one.
1072
1073#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1074#[serde(rename_all = "camelCase")]
1075pub struct SetLocaleOverrideParams {
1076    /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and
1077    /// restores default host system locale.
1078
1079    #[serde(skip_serializing_if = "Option::is_none")]
1080    pub locale: Option<String>,
1081}
1082
1083impl SetLocaleOverrideParams { pub const METHOD: &'static str = "Emulation.setLocaleOverride"; }
1084
1085impl crate::CdpCommand for SetLocaleOverrideParams {
1086    const METHOD: &'static str = "Emulation.setLocaleOverride";
1087    type Response = crate::EmptyReturns;
1088}
1089
1090/// Overrides default host system timezone with the specified one.
1091
1092#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1093#[serde(rename_all = "camelCase")]
1094pub struct SetTimezoneOverrideParams {
1095    /// The timezone identifier. List of supported timezones:
1096    /// https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt
1097    /// If empty, disables the override and restores default host system timezone.
1098
1099    pub timezoneId: String,
1100}
1101
1102impl SetTimezoneOverrideParams { pub const METHOD: &'static str = "Emulation.setTimezoneOverride"; }
1103
1104impl crate::CdpCommand for SetTimezoneOverrideParams {
1105    const METHOD: &'static str = "Emulation.setTimezoneOverride";
1106    type Response = crate::EmptyReturns;
1107}
1108
1109/// Resizes the frame/viewport of the page. Note that this does not affect the frame's container
1110/// (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
1111/// on Android.
1112
1113#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1114#[serde(rename_all = "camelCase")]
1115pub struct SetVisibleSizeParams {
1116    /// Frame width (DIP).
1117
1118    pub width: u64,
1119    /// Frame height (DIP).
1120
1121    pub height: i64,
1122}
1123
1124impl SetVisibleSizeParams { pub const METHOD: &'static str = "Emulation.setVisibleSize"; }
1125
1126impl crate::CdpCommand for SetVisibleSizeParams {
1127    const METHOD: &'static str = "Emulation.setVisibleSize";
1128    type Response = crate::EmptyReturns;
1129}
1130
1131
1132#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1133#[serde(rename_all = "camelCase")]
1134pub struct SetDisabledImageTypesParams {
1135    /// Image types to disable.
1136
1137    pub imageTypes: Vec<DisabledImageType>,
1138}
1139
1140impl SetDisabledImageTypesParams { pub const METHOD: &'static str = "Emulation.setDisabledImageTypes"; }
1141
1142impl crate::CdpCommand for SetDisabledImageTypesParams {
1143    const METHOD: &'static str = "Emulation.setDisabledImageTypes";
1144    type Response = crate::EmptyReturns;
1145}
1146
1147/// Override the value of navigator.connection.saveData
1148
1149#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1150#[serde(rename_all = "camelCase")]
1151pub struct SetDataSaverOverrideParams {
1152    /// Override value. Omitting the parameter disables the override.
1153
1154    #[serde(skip_serializing_if = "Option::is_none")]
1155    pub dataSaverEnabled: Option<bool>,
1156}
1157
1158impl SetDataSaverOverrideParams { pub const METHOD: &'static str = "Emulation.setDataSaverOverride"; }
1159
1160impl crate::CdpCommand for SetDataSaverOverrideParams {
1161    const METHOD: &'static str = "Emulation.setDataSaverOverride";
1162    type Response = crate::EmptyReturns;
1163}
1164
1165
1166#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1167#[serde(rename_all = "camelCase")]
1168pub struct SetHardwareConcurrencyOverrideParams {
1169    /// Hardware concurrency to report
1170
1171    pub hardwareConcurrency: i64,
1172}
1173
1174impl SetHardwareConcurrencyOverrideParams { pub const METHOD: &'static str = "Emulation.setHardwareConcurrencyOverride"; }
1175
1176impl crate::CdpCommand for SetHardwareConcurrencyOverrideParams {
1177    const METHOD: &'static str = "Emulation.setHardwareConcurrencyOverride";
1178    type Response = crate::EmptyReturns;
1179}
1180
1181/// Allows overriding user agent with the given string.
1182/// 'userAgentMetadata' must be set for Client Hint headers to be sent.
1183
1184#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1185#[serde(rename_all = "camelCase")]
1186pub struct SetUserAgentOverrideParams {
1187    /// User agent to use.
1188
1189    pub userAgent: String,
1190    /// Browser language to emulate.
1191
1192    #[serde(skip_serializing_if = "Option::is_none")]
1193    pub acceptLanguage: Option<String>,
1194    /// The platform navigator.platform should return.
1195
1196    #[serde(skip_serializing_if = "Option::is_none")]
1197    pub platform: Option<String>,
1198    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
1199
1200    #[serde(skip_serializing_if = "Option::is_none")]
1201    pub userAgentMetadata: Option<UserAgentMetadata>,
1202}
1203
1204impl SetUserAgentOverrideParams { pub const METHOD: &'static str = "Emulation.setUserAgentOverride"; }
1205
1206impl crate::CdpCommand for SetUserAgentOverrideParams {
1207    const METHOD: &'static str = "Emulation.setUserAgentOverride";
1208    type Response = crate::EmptyReturns;
1209}
1210
1211/// Allows overriding the automation flag.
1212
1213#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1214#[serde(rename_all = "camelCase")]
1215pub struct SetAutomationOverrideParams {
1216    /// Whether the override should be enabled.
1217
1218    pub enabled: bool,
1219}
1220
1221impl SetAutomationOverrideParams { pub const METHOD: &'static str = "Emulation.setAutomationOverride"; }
1222
1223impl crate::CdpCommand for SetAutomationOverrideParams {
1224    const METHOD: &'static str = "Emulation.setAutomationOverride";
1225    type Response = crate::EmptyReturns;
1226}
1227
1228/// Allows overriding the difference between the small and large viewport sizes, which determine the
1229/// value of the 'svh' and 'lvh' unit, respectively. Only supported for top-level frames.
1230
1231#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1232#[serde(rename_all = "camelCase")]
1233pub struct SetSmallViewportHeightDifferenceOverrideParams {
1234    /// This will cause an element of size 100svh to be 'difference' pixels smaller than an element
1235    /// of size 100lvh.
1236
1237    pub difference: i64,
1238}
1239
1240impl SetSmallViewportHeightDifferenceOverrideParams { pub const METHOD: &'static str = "Emulation.setSmallViewportHeightDifferenceOverride"; }
1241
1242impl crate::CdpCommand for SetSmallViewportHeightDifferenceOverrideParams {
1243    const METHOD: &'static str = "Emulation.setSmallViewportHeightDifferenceOverride";
1244    type Response = crate::EmptyReturns;
1245}
1246
1247/// Returns device's screen configuration. In headful mode, the physical screens configuration is returned,
1248/// whereas in headless mode, a virtual headless screen configuration is provided instead.
1249
1250#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1251#[serde(rename_all = "camelCase")]
1252pub struct GetScreenInfosReturns {
1253
1254    pub screenInfos: Vec<ScreenInfo>,
1255}
1256
1257#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1258pub struct GetScreenInfosParams {}
1259
1260impl GetScreenInfosParams { pub const METHOD: &'static str = "Emulation.getScreenInfos"; }
1261
1262impl crate::CdpCommand for GetScreenInfosParams {
1263    const METHOD: &'static str = "Emulation.getScreenInfos";
1264    type Response = GetScreenInfosReturns;
1265}
1266
1267/// Add a new screen to the device. Only supported in headless mode.
1268
1269#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1270#[serde(rename_all = "camelCase")]
1271pub struct AddScreenParams {
1272    /// Offset of the left edge of the screen in pixels.
1273
1274    pub left: i64,
1275    /// Offset of the top edge of the screen in pixels.
1276
1277    pub top: i64,
1278    /// The width of the screen in pixels.
1279
1280    pub width: u64,
1281    /// The height of the screen in pixels.
1282
1283    pub height: i64,
1284    /// Specifies the screen's work area. Default is entire screen.
1285
1286    #[serde(skip_serializing_if = "Option::is_none")]
1287    pub workAreaInsets: Option<WorkAreaInsets>,
1288    /// Specifies the screen's device pixel ratio. Default is 1.
1289
1290    #[serde(skip_serializing_if = "Option::is_none")]
1291    pub devicePixelRatio: Option<f64>,
1292    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
1293
1294    #[serde(skip_serializing_if = "Option::is_none")]
1295    pub rotation: Option<i64>,
1296    /// Specifies the screen's color depth in bits. Default is 24.
1297
1298    #[serde(skip_serializing_if = "Option::is_none")]
1299    pub colorDepth: Option<i64>,
1300    /// Specifies the descriptive label for the screen. Default is none.
1301
1302    #[serde(skip_serializing_if = "Option::is_none")]
1303    pub label: Option<String>,
1304    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
1305
1306    #[serde(skip_serializing_if = "Option::is_none")]
1307    pub isInternal: Option<bool>,
1308}
1309
1310/// Add a new screen to the device. Only supported in headless mode.
1311
1312#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1313#[serde(rename_all = "camelCase")]
1314pub struct AddScreenReturns {
1315
1316    pub screenInfo: ScreenInfo,
1317}
1318
1319impl AddScreenParams { pub const METHOD: &'static str = "Emulation.addScreen"; }
1320
1321impl crate::CdpCommand for AddScreenParams {
1322    const METHOD: &'static str = "Emulation.addScreen";
1323    type Response = AddScreenReturns;
1324}
1325
1326/// Updates specified screen parameters. Only supported in headless mode.
1327
1328#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1329#[serde(rename_all = "camelCase")]
1330pub struct UpdateScreenParams {
1331    /// Target screen identifier.
1332
1333    pub screenId: ScreenId,
1334    /// Offset of the left edge of the screen in pixels.
1335
1336    #[serde(skip_serializing_if = "Option::is_none")]
1337    pub left: Option<i64>,
1338    /// Offset of the top edge of the screen in pixels.
1339
1340    #[serde(skip_serializing_if = "Option::is_none")]
1341    pub top: Option<i64>,
1342    /// The width of the screen in pixels.
1343
1344    #[serde(skip_serializing_if = "Option::is_none")]
1345    pub width: Option<u64>,
1346    /// The height of the screen in pixels.
1347
1348    #[serde(skip_serializing_if = "Option::is_none")]
1349    pub height: Option<i64>,
1350    /// Specifies the screen's work area.
1351
1352    #[serde(skip_serializing_if = "Option::is_none")]
1353    pub workAreaInsets: Option<WorkAreaInsets>,
1354    /// Specifies the screen's device pixel ratio.
1355
1356    #[serde(skip_serializing_if = "Option::is_none")]
1357    pub devicePixelRatio: Option<f64>,
1358    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
1359
1360    #[serde(skip_serializing_if = "Option::is_none")]
1361    pub rotation: Option<i64>,
1362    /// Specifies the screen's color depth in bits.
1363
1364    #[serde(skip_serializing_if = "Option::is_none")]
1365    pub colorDepth: Option<i64>,
1366    /// Specifies the descriptive label for the screen.
1367
1368    #[serde(skip_serializing_if = "Option::is_none")]
1369    pub label: Option<String>,
1370    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
1371
1372    #[serde(skip_serializing_if = "Option::is_none")]
1373    pub isInternal: Option<bool>,
1374}
1375
1376/// Updates specified screen parameters. Only supported in headless mode.
1377
1378#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1379#[serde(rename_all = "camelCase")]
1380pub struct UpdateScreenReturns {
1381
1382    pub screenInfo: ScreenInfo,
1383}
1384
1385impl UpdateScreenParams { pub const METHOD: &'static str = "Emulation.updateScreen"; }
1386
1387impl crate::CdpCommand for UpdateScreenParams {
1388    const METHOD: &'static str = "Emulation.updateScreen";
1389    type Response = UpdateScreenReturns;
1390}
1391
1392/// Remove screen from the device. Only supported in headless mode.
1393
1394#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1395#[serde(rename_all = "camelCase")]
1396pub struct RemoveScreenParams {
1397
1398    pub screenId: ScreenId,
1399}
1400
1401impl RemoveScreenParams { pub const METHOD: &'static str = "Emulation.removeScreen"; }
1402
1403impl crate::CdpCommand for RemoveScreenParams {
1404    const METHOD: &'static str = "Emulation.removeScreen";
1405    type Response = crate::EmptyReturns;
1406}
1407
1408/// Set primary screen. Only supported in headless mode.
1409/// Note that this changes the coordinate system origin to the top-left
1410/// of the new primary screen, updating the bounds and work areas
1411/// of all existing screens accordingly.
1412
1413#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1414#[serde(rename_all = "camelCase")]
1415pub struct SetPrimaryScreenParams {
1416
1417    pub screenId: ScreenId,
1418}
1419
1420impl SetPrimaryScreenParams { pub const METHOD: &'static str = "Emulation.setPrimaryScreen"; }
1421
1422impl crate::CdpCommand for SetPrimaryScreenParams {
1423    const METHOD: &'static str = "Emulation.setPrimaryScreen";
1424    type Response = crate::EmptyReturns;
1425}