1use serde::{Deserialize, Serialize};
11
12pub type BrowserContextId = String;
14
15pub type WindowId = i64;
17
18#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
22pub enum WindowState {
23 #[serde(rename = "normal")]
25 Normal,
26 #[serde(rename = "minimized")]
28 Minimized,
29 #[serde(rename = "maximized")]
31 Maximized,
32 #[serde(rename = "fullscreen")]
34 Fullscreen,
35 #[serde(untagged)]
39 Unrecognized(String),
40}
41
42#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
46pub struct Bounds {
47 #[serde(default, skip_serializing_if = "Option::is_none")]
49 pub left: Option<i64>,
50 #[serde(default, skip_serializing_if = "Option::is_none")]
52 pub top: Option<i64>,
53 #[serde(default, skip_serializing_if = "Option::is_none")]
55 pub width: Option<i64>,
56 #[serde(default, skip_serializing_if = "Option::is_none")]
58 pub height: Option<i64>,
59 #[serde(
61 rename = "windowState",
62 default,
63 skip_serializing_if = "Option::is_none"
64 )]
65 pub window_state: Option<WindowState>,
66}
67
68#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
70pub enum PermissionType {
71 #[serde(rename = "ar")]
73 Ar,
74 #[serde(rename = "audioCapture")]
76 AudioCapture,
77 #[serde(rename = "automaticFullscreen")]
79 AutomaticFullscreen,
80 #[serde(rename = "backgroundFetch")]
82 BackgroundFetch,
83 #[serde(rename = "backgroundSync")]
85 BackgroundSync,
86 #[serde(rename = "cameraPanTiltZoom")]
88 CameraPanTiltZoom,
89 #[serde(rename = "capturedSurfaceControl")]
91 CapturedSurfaceControl,
92 #[serde(rename = "clipboardReadWrite")]
94 ClipboardReadWrite,
95 #[serde(rename = "clipboardSanitizedWrite")]
97 ClipboardSanitizedWrite,
98 #[serde(rename = "displayCapture")]
100 DisplayCapture,
101 #[serde(rename = "durableStorage")]
103 DurableStorage,
104 #[serde(rename = "geolocation")]
106 Geolocation,
107 #[serde(rename = "handTracking")]
109 HandTracking,
110 #[serde(rename = "idleDetection")]
112 IdleDetection,
113 #[serde(rename = "keyboardLock")]
115 KeyboardLock,
116 #[serde(rename = "localFonts")]
118 LocalFonts,
119 #[serde(rename = "localNetwork")]
121 LocalNetwork,
122 #[serde(rename = "localNetworkAccess")]
124 LocalNetworkAccess,
125 #[serde(rename = "loopbackNetwork")]
127 LoopbackNetwork,
128 #[serde(rename = "midi")]
130 Midi,
131 #[serde(rename = "midiSysex")]
133 MidiSysex,
134 #[serde(rename = "nfc")]
136 Nfc,
137 #[serde(rename = "notifications")]
139 Notifications,
140 #[serde(rename = "paymentHandler")]
142 PaymentHandler,
143 #[serde(rename = "periodicBackgroundSync")]
145 PeriodicBackgroundSync,
146 #[serde(rename = "pointerLock")]
148 PointerLock,
149 #[serde(rename = "protectedMediaIdentifier")]
151 ProtectedMediaIdentifier,
152 #[serde(rename = "sensors")]
154 Sensors,
155 #[serde(rename = "smartCard")]
157 SmartCard,
158 #[serde(rename = "speakerSelection")]
160 SpeakerSelection,
161 #[serde(rename = "storageAccess")]
163 StorageAccess,
164 #[serde(rename = "videoCapture")]
166 VideoCapture,
167 #[serde(rename = "vr")]
169 Vr,
170 #[serde(rename = "wakeLockScreen")]
172 WakeLockScreen,
173 #[serde(rename = "wakeLockSystem")]
175 WakeLockSystem,
176 #[serde(rename = "webAppInstallation")]
178 WebAppInstallation,
179 #[serde(rename = "webPrinting")]
181 WebPrinting,
182 #[serde(rename = "windowManagement")]
184 WindowManagement,
185 #[serde(untagged)]
189 Unrecognized(String),
190}
191
192#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
194pub enum PermissionSetting {
195 #[serde(rename = "granted")]
197 Granted,
198 #[serde(rename = "denied")]
200 Denied,
201 #[serde(rename = "prompt")]
203 Prompt,
204 #[serde(untagged)]
208 Unrecognized(String),
209}
210
211#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
216pub struct PermissionDescriptor {
217 pub name: String,
221 #[serde(default, skip_serializing_if = "Option::is_none")]
223 pub sysex: Option<bool>,
224 #[serde(
227 rename = "userVisibleOnly",
228 default,
229 skip_serializing_if = "Option::is_none"
230 )]
231 pub user_visible_only: Option<bool>,
232 #[serde(
234 rename = "allowWithoutSanitization",
235 default,
236 skip_serializing_if = "Option::is_none"
237 )]
238 pub allow_without_sanitization: Option<bool>,
239 #[serde(
241 rename = "allowWithoutGesture",
242 default,
243 skip_serializing_if = "Option::is_none"
244 )]
245 pub allow_without_gesture: Option<bool>,
246 #[serde(
248 rename = "panTiltZoom",
249 default,
250 skip_serializing_if = "Option::is_none"
251 )]
252 pub pan_tilt_zoom: Option<bool>,
253}
254
255#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
259pub enum BrowserCommandId {
260 #[serde(rename = "openTabSearch")]
262 OpenTabSearch,
263 #[serde(rename = "closeTabSearch")]
265 CloseTabSearch,
266 #[serde(rename = "openGlic")]
268 OpenGlic,
269 #[serde(untagged)]
273 Unrecognized(String),
274}
275
276#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
280pub struct Bucket {
281 pub low: i64,
283 pub high: i64,
285 pub count: i64,
287}
288
289#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
293pub struct Histogram {
294 pub name: String,
296 pub sum: i64,
298 pub count: i64,
300 pub buckets: Vec<Bucket>,
302}
303
304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
310pub struct SetPermissionParams {
311 pub permission: PermissionDescriptor,
313 pub setting: PermissionSetting,
315 #[serde(default, skip_serializing_if = "Option::is_none")]
317 pub origin: Option<String>,
318 #[serde(
323 rename = "embeddedOrigin",
324 default,
325 skip_serializing_if = "Option::is_none"
326 )]
327 pub embedded_origin: Option<String>,
328 #[serde(
330 rename = "browserContextId",
331 default,
332 skip_serializing_if = "Option::is_none"
333 )]
334 pub browser_context_id: Option<BrowserContextId>,
335}
336
337impl crate::typed::Command for SetPermissionParams {
338 const METHOD: &'static str = "Browser.setPermission";
339 type Returns = crate::typed::NoReturns;
340}
341
342#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
351pub struct GrantPermissionsParams {
352 pub permissions: Vec<PermissionType>,
353 #[serde(default, skip_serializing_if = "Option::is_none")]
355 pub origin: Option<String>,
356 #[serde(
359 rename = "browserContextId",
360 default,
361 skip_serializing_if = "Option::is_none"
362 )]
363 pub browser_context_id: Option<BrowserContextId>,
364}
365
366impl crate::typed::Command for GrantPermissionsParams {
367 const METHOD: &'static str = "Browser.grantPermissions";
368 type Returns = crate::typed::NoReturns;
369}
370
371#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
375pub struct ResetPermissionsParams {
376 #[serde(
379 rename = "browserContextId",
380 default,
381 skip_serializing_if = "Option::is_none"
382 )]
383 pub browser_context_id: Option<BrowserContextId>,
384}
385
386impl crate::typed::Command for ResetPermissionsParams {
387 const METHOD: &'static str = "Browser.resetPermissions";
388 type Returns = crate::typed::NoReturns;
389}
390
391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
397pub struct SetDownloadBehaviorParams {
398 pub behavior: SetDownloadBehaviorBehavior,
402 #[serde(
405 rename = "browserContextId",
406 default,
407 skip_serializing_if = "Option::is_none"
408 )]
409 pub browser_context_id: Option<BrowserContextId>,
410 #[serde(
413 rename = "downloadPath",
414 default,
415 skip_serializing_if = "Option::is_none"
416 )]
417 pub download_path: Option<String>,
418 #[serde(
420 rename = "eventsEnabled",
421 default,
422 skip_serializing_if = "Option::is_none"
423 )]
424 pub events_enabled: Option<bool>,
425}
426
427#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
429pub enum SetDownloadBehaviorBehavior {
430 #[serde(rename = "deny")]
432 Deny,
433 #[serde(rename = "allow")]
435 Allow,
436 #[serde(rename = "allowAndName")]
438 AllowAndName,
439 #[serde(rename = "default")]
441 Default,
442 #[serde(untagged)]
446 Unrecognized(String),
447}
448
449impl crate::typed::Command for SetDownloadBehaviorParams {
450 const METHOD: &'static str = "Browser.setDownloadBehavior";
451 type Returns = crate::typed::NoReturns;
452}
453
454#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
460pub struct CancelDownloadParams {
461 pub guid: String,
463 #[serde(
466 rename = "browserContextId",
467 default,
468 skip_serializing_if = "Option::is_none"
469 )]
470 pub browser_context_id: Option<BrowserContextId>,
471}
472
473impl crate::typed::Command for CancelDownloadParams {
474 const METHOD: &'static str = "Browser.cancelDownload";
475 type Returns = crate::typed::NoReturns;
476}
477
478#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
482pub struct CloseParams {}
483
484impl crate::typed::Command for CloseParams {
485 const METHOD: &'static str = "Browser.close";
486 type Returns = crate::typed::NoReturns;
487}
488
489#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
495pub struct CrashParams {}
496
497impl crate::typed::Command for CrashParams {
498 const METHOD: &'static str = "Browser.crash";
499 type Returns = crate::typed::NoReturns;
500}
501
502#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
508pub struct CrashGpuProcessParams {}
509
510impl crate::typed::Command for CrashGpuProcessParams {
511 const METHOD: &'static str = "Browser.crashGpuProcess";
512 type Returns = crate::typed::NoReturns;
513}
514
515#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
519pub struct GetVersionParams {}
520
521#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
523pub struct GetVersionReturns {
524 #[serde(rename = "protocolVersion")]
526 pub protocol_version: String,
527 pub product: String,
529 pub revision: String,
531 #[serde(rename = "userAgent")]
533 pub user_agent: String,
534 #[serde(rename = "jsVersion")]
536 pub js_version: String,
537}
538
539impl crate::typed::Command for GetVersionParams {
540 const METHOD: &'static str = "Browser.getVersion";
541 type Returns = GetVersionReturns;
542}
543
544#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
551pub struct GetBrowserCommandLineParams {}
552
553#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
555pub struct GetBrowserCommandLineReturns {
556 pub arguments: Vec<String>,
558}
559
560impl crate::typed::Command for GetBrowserCommandLineParams {
561 const METHOD: &'static str = "Browser.getBrowserCommandLine";
562 type Returns = GetBrowserCommandLineReturns;
563}
564
565#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
574pub struct AddMockCameraParams {
575 #[serde(rename = "deviceId")]
580 pub device_id: String,
581}
582
583impl crate::typed::Command for AddMockCameraParams {
584 const METHOD: &'static str = "Browser.addMockCamera";
585 type Returns = crate::typed::NoReturns;
586}
587
588#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
594pub struct GetHistogramsParams {
595 #[serde(default, skip_serializing_if = "Option::is_none")]
599 pub query: Option<String>,
600 #[serde(default, skip_serializing_if = "Option::is_none")]
602 pub delta: Option<bool>,
603}
604
605#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
607pub struct GetHistogramsReturns {
608 pub histograms: Vec<Histogram>,
610}
611
612impl crate::typed::Command for GetHistogramsParams {
613 const METHOD: &'static str = "Browser.getHistograms";
614 type Returns = GetHistogramsReturns;
615}
616
617#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
623pub struct GetHistogramParams {
624 pub name: String,
626 #[serde(default, skip_serializing_if = "Option::is_none")]
628 pub delta: Option<bool>,
629}
630
631#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
633pub struct GetHistogramReturns {
634 pub histogram: Histogram,
636}
637
638impl crate::typed::Command for GetHistogramParams {
639 const METHOD: &'static str = "Browser.getHistogram";
640 type Returns = GetHistogramReturns;
641}
642
643#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
649pub struct GetWindowBoundsParams {
650 #[serde(rename = "windowId")]
652 pub window_id: WindowId,
653}
654
655#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
657pub struct GetWindowBoundsReturns {
658 pub bounds: Bounds,
661}
662
663impl crate::typed::Command for GetWindowBoundsParams {
664 const METHOD: &'static str = "Browser.getWindowBounds";
665 type Returns = GetWindowBoundsReturns;
666}
667
668#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
674pub struct GetWindowForTargetParams {
675 #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
678 pub target_id: Option<crate::protocol::target::TargetId>,
679}
680
681#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
683pub struct GetWindowForTargetReturns {
684 #[serde(rename = "windowId")]
686 pub window_id: WindowId,
687 pub bounds: Bounds,
690}
691
692impl crate::typed::Command for GetWindowForTargetParams {
693 const METHOD: &'static str = "Browser.getWindowForTarget";
694 type Returns = GetWindowForTargetReturns;
695}
696
697#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
703pub struct SetWindowBoundsParams {
704 #[serde(rename = "windowId")]
706 pub window_id: WindowId,
707 pub bounds: Bounds,
711}
712
713impl crate::typed::Command for SetWindowBoundsParams {
714 const METHOD: &'static str = "Browser.setWindowBounds";
715 type Returns = crate::typed::NoReturns;
716}
717
718#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
724pub struct SetContentsSizeParams {
725 #[serde(rename = "windowId")]
727 pub window_id: WindowId,
728 #[serde(default, skip_serializing_if = "Option::is_none")]
731 pub width: Option<i64>,
732 #[serde(default, skip_serializing_if = "Option::is_none")]
735 pub height: Option<i64>,
736}
737
738impl crate::typed::Command for SetContentsSizeParams {
739 const METHOD: &'static str = "Browser.setContentsSize";
740 type Returns = crate::typed::NoReturns;
741}
742
743#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
749pub struct SetDockTileParams {
750 #[serde(
751 rename = "badgeLabel",
752 default,
753 skip_serializing_if = "Option::is_none"
754 )]
755 pub badge_label: Option<String>,
756 #[serde(default, skip_serializing_if = "Option::is_none")]
758 pub image: Option<String>,
759}
760
761impl crate::typed::Command for SetDockTileParams {
762 const METHOD: &'static str = "Browser.setDockTile";
763 type Returns = crate::typed::NoReturns;
764}
765
766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
772pub struct ExecuteBrowserCommandParams {
773 #[serde(rename = "commandId")]
774 pub command_id: BrowserCommandId,
775}
776
777impl crate::typed::Command for ExecuteBrowserCommandParams {
778 const METHOD: &'static str = "Browser.executeBrowserCommand";
779 type Returns = crate::typed::NoReturns;
780}
781
782#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
787pub struct AddPrivacySandboxEnrollmentOverrideParams {
788 pub url: String,
789}
790
791impl crate::typed::Command for AddPrivacySandboxEnrollmentOverrideParams {
792 const METHOD: &'static str = "Browser.addPrivacySandboxEnrollmentOverride";
793 type Returns = crate::typed::NoReturns;
794}
795
796#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
803pub struct GetGlobalPrivacyControlParams {}
804
805#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
807pub struct GetGlobalPrivacyControlReturns {
808 pub gpc: bool,
809}
810
811impl crate::typed::Command for GetGlobalPrivacyControlParams {
812 const METHOD: &'static str = "Browser.getGlobalPrivacyControl";
813 type Returns = GetGlobalPrivacyControlReturns;
814}
815
816#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
823pub struct SetGlobalPrivacyControlParams {
824 pub gpc: bool,
825}
826
827#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
829pub struct SetGlobalPrivacyControlReturns {
830 pub gpc: bool,
831}
832
833impl crate::typed::Command for SetGlobalPrivacyControlParams {
834 const METHOD: &'static str = "Browser.setGlobalPrivacyControl";
835 type Returns = SetGlobalPrivacyControlReturns;
836}
837
838#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
844pub struct DownloadWillBeginEvent {
845 #[serde(rename = "frameId")]
847 pub frame_id: crate::protocol::page::FrameId,
848 pub guid: String,
850 pub url: String,
852 #[serde(rename = "suggestedFilename")]
855 pub suggested_filename: String,
856}
857
858impl crate::typed::Event for DownloadWillBeginEvent {
859 const METHOD: &'static str = "Browser.downloadWillBegin";
860}
861
862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
868pub struct DownloadProgressEvent {
869 pub guid: String,
871 #[serde(rename = "totalBytes")]
873 pub total_bytes: f64,
874 #[serde(rename = "receivedBytes")]
876 pub received_bytes: f64,
877 pub state: DownloadProgressState,
879 #[serde(rename = "filePath", default, skip_serializing_if = "Option::is_none")]
885 pub file_path: Option<String>,
886}
887
888#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
890pub enum DownloadProgressState {
891 #[serde(rename = "inProgress")]
893 InProgress,
894 #[serde(rename = "completed")]
896 Completed,
897 #[serde(rename = "canceled")]
899 Canceled,
900 #[serde(untagged)]
904 Unrecognized(String),
905}
906
907impl crate::typed::Event for DownloadProgressEvent {
908 const METHOD: &'static str = "Browser.downloadProgress";
909}