1use serde::{Deserialize, Serialize};
2#[doc = "Set permission settings for given embedding and embedded origins.\n[setPermission](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setPermission)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct SetPermissionParams {
5 #[doc = "Descriptor of permission to override."]
6 #[serde(rename = "permission")]
7 pub permission: super::types::PermissionDescriptor,
8 #[doc = "Setting of the permission."]
9 #[serde(rename = "setting")]
10 pub setting: super::types::PermissionSetting,
11 #[doc = "Embedding origin the permission applies to, all origins if not specified."]
12 #[serde(rename = "origin")]
13 #[serde(skip_serializing_if = "Option::is_none")]
14 #[serde(default)]
15 pub origin: Option<String>,
16 #[doc = "Embedded origin the permission applies to. It is ignored unless the embedding origin is\npresent and valid. If the embedding origin is provided but the embedded origin isn't, the\nembedding origin is used as the embedded origin."]
17 #[serde(rename = "embeddedOrigin")]
18 #[serde(skip_serializing_if = "Option::is_none")]
19 #[serde(default)]
20 pub embedded_origin: Option<String>,
21 #[doc = "Context to override. When omitted, default browser context is used."]
22 #[serde(rename = "browserContextId")]
23 #[serde(skip_serializing_if = "Option::is_none")]
24 #[serde(default)]
25 pub browser_context_id: Option<Box<super::types::BrowserContextId>>,
26}
27impl SetPermissionParams {
28 pub fn new(
29 permission: impl Into<super::types::PermissionDescriptor>,
30 setting: impl Into<super::types::PermissionSetting>,
31 ) -> Self {
32 Self {
33 permission: permission.into(),
34 setting: setting.into(),
35 origin: None,
36 embedded_origin: None,
37 browser_context_id: None,
38 }
39 }
40}
41#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
42pub enum SetPermissionMethod {
43 #[serde(rename = "Browser.setPermission")]
44 SetPermission,
45}
46#[doc = "Set permission settings for given embedding and embedded origins.\n[setPermission](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setPermission)"]
47#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
48pub struct SetPermission {
49 pub method: SetPermissionMethod,
50 pub params: SetPermissionParams,
51}
52impl SetPermission {
53 pub const IDENTIFIER: &'static str = "Browser.setPermission";
54 pub fn identifier(&self) -> &'static str {
55 Self::IDENTIFIER
56 }
57}
58impl crate::CommandResult for SetPermission {
59 type Result = super::results::SetPermissionResult;
60}
61#[doc = "Reset all permission management for all origins.\n[resetPermissions](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-resetPermissions)"]
62#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
63pub struct ResetPermissionsParams {
64 #[doc = "BrowserContext to reset permissions. When omitted, default browser context is used."]
65 #[serde(rename = "browserContextId")]
66 #[serde(skip_serializing_if = "Option::is_none")]
67 #[serde(default)]
68 pub browser_context_id: Option<Box<super::types::BrowserContextId>>,
69}
70#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
71pub enum ResetPermissionsMethod {
72 #[serde(rename = "Browser.resetPermissions")]
73 ResetPermissions,
74}
75#[doc = "Reset all permission management for all origins.\n[resetPermissions](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-resetPermissions)"]
76#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77pub struct ResetPermissions {
78 pub method: ResetPermissionsMethod,
79 pub params: ResetPermissionsParams,
80}
81impl ResetPermissions {
82 pub const IDENTIFIER: &'static str = "Browser.resetPermissions";
83 pub fn identifier(&self) -> &'static str {
84 Self::IDENTIFIER
85 }
86}
87impl crate::CommandResult for ResetPermissions {
88 type Result = super::results::ResetPermissionsResult;
89}
90#[doc = "Set the behavior when downloading a file.\n[setDownloadBehavior](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setDownloadBehavior)"]
91#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
92pub struct SetDownloadBehaviorParams {
93 #[doc = "Whether to allow all or deny all download requests, or use default Chrome behavior if\navailable (otherwise deny). |allowAndName| allows download and names files according to\ntheir download guids."]
94 #[serde(rename = "behavior")]
95 pub behavior: SetDownloadBehaviorBehavior,
96 #[doc = "BrowserContext to set download behavior. When omitted, default browser context is used."]
97 #[serde(rename = "browserContextId")]
98 #[serde(skip_serializing_if = "Option::is_none")]
99 #[serde(default)]
100 pub browser_context_id: Option<Box<super::types::BrowserContextId>>,
101 #[doc = "The default path to save downloaded files to. This is required if behavior is set to 'allow'\nor 'allowAndName'."]
102 #[serde(rename = "downloadPath")]
103 #[serde(skip_serializing_if = "Option::is_none")]
104 #[serde(default)]
105 pub download_path: Option<String>,
106 #[doc = "Whether to emit download events (defaults to false)."]
107 #[serde(rename = "eventsEnabled")]
108 #[serde(skip_serializing_if = "Option::is_none")]
109 #[serde(default)]
110 pub events_enabled: Option<bool>,
111}
112#[doc = "Whether to allow all or deny all download requests, or use default Chrome behavior if\navailable (otherwise deny). |allowAndName| allows download and names files according to\ntheir download guids."]
113#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
114pub enum SetDownloadBehaviorBehavior {
115 #[serde(rename = "deny")]
116 Deny,
117 #[serde(rename = "allow")]
118 Allow,
119 #[serde(rename = "allowAndName")]
120 AllowAndName,
121 #[serde(rename = "default")]
122 Default,
123}
124impl SetDownloadBehaviorParams {
125 pub fn new(behavior: impl Into<SetDownloadBehaviorBehavior>) -> Self {
126 Self {
127 behavior: behavior.into(),
128 browser_context_id: None,
129 download_path: None,
130 events_enabled: None,
131 }
132 }
133}
134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
135pub enum SetDownloadBehaviorMethod {
136 #[serde(rename = "Browser.setDownloadBehavior")]
137 SetDownloadBehavior,
138}
139#[doc = "Set the behavior when downloading a file.\n[setDownloadBehavior](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setDownloadBehavior)"]
140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
141pub struct SetDownloadBehavior {
142 pub method: SetDownloadBehaviorMethod,
143 pub params: SetDownloadBehaviorParams,
144}
145impl SetDownloadBehavior {
146 pub const IDENTIFIER: &'static str = "Browser.setDownloadBehavior";
147 pub fn identifier(&self) -> &'static str {
148 Self::IDENTIFIER
149 }
150}
151impl crate::CommandResult for SetDownloadBehavior {
152 type Result = super::results::SetDownloadBehaviorResult;
153}
154#[doc = "Cancel a download if in progress\n[cancelDownload](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-cancelDownload)"]
155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
156pub struct CancelDownloadParams {
157 #[doc = "Global unique identifier of the download."]
158 #[serde(rename = "guid")]
159 pub guid: String,
160 #[doc = "BrowserContext to perform the action in. When omitted, default browser context is used."]
161 #[serde(rename = "browserContextId")]
162 #[serde(skip_serializing_if = "Option::is_none")]
163 #[serde(default)]
164 pub browser_context_id: Option<Box<super::types::BrowserContextId>>,
165}
166impl CancelDownloadParams {
167 pub fn new(guid: impl Into<String>) -> Self {
168 Self {
169 guid: guid.into(),
170 browser_context_id: None,
171 }
172 }
173}
174impl<T: Into<String>> From<T> for CancelDownloadParams {
175 fn from(url: T) -> Self {
176 CancelDownloadParams::new(url)
177 }
178}
179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
180pub enum CancelDownloadMethod {
181 #[serde(rename = "Browser.cancelDownload")]
182 CancelDownload,
183}
184#[doc = "Cancel a download if in progress\n[cancelDownload](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-cancelDownload)"]
185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
186pub struct CancelDownload {
187 pub method: CancelDownloadMethod,
188 pub params: CancelDownloadParams,
189}
190impl CancelDownload {
191 pub const IDENTIFIER: &'static str = "Browser.cancelDownload";
192 pub fn identifier(&self) -> &'static str {
193 Self::IDENTIFIER
194 }
195}
196impl crate::CommandResult for CancelDownload {
197 type Result = super::results::CancelDownloadResult;
198}
199#[doc = "Close browser gracefully.\n[close](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-close)"]
200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
201pub struct CloseParams {}
202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
203pub enum CloseMethod {
204 #[serde(rename = "Browser.close")]
205 Close,
206}
207#[doc = "Close browser gracefully.\n[close](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-close)"]
208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
209pub struct Close {
210 pub method: CloseMethod,
211 pub params: CloseParams,
212}
213impl Close {
214 pub const IDENTIFIER: &'static str = "Browser.close";
215 pub fn identifier(&self) -> &'static str {
216 Self::IDENTIFIER
217 }
218}
219impl crate::CommandResult for Close {
220 type Result = super::results::CloseResult;
221}
222#[doc = "Crashes browser on the main thread.\n[crash](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-crash)"]
223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
224pub struct CrashParams {}
225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
226pub enum CrashMethod {
227 #[serde(rename = "Browser.crash")]
228 Crash,
229}
230#[doc = "Crashes browser on the main thread.\n[crash](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-crash)"]
231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
232pub struct Crash {
233 pub method: CrashMethod,
234 pub params: CrashParams,
235}
236impl Crash {
237 pub const IDENTIFIER: &'static str = "Browser.crash";
238 pub fn identifier(&self) -> &'static str {
239 Self::IDENTIFIER
240 }
241}
242impl crate::CommandResult for Crash {
243 type Result = super::results::CrashResult;
244}
245#[doc = "Crashes GPU process.\n[crashGpuProcess](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-crashGpuProcess)"]
246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
247pub struct CrashGpuProcessParams {}
248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
249pub enum CrashGpuProcessMethod {
250 #[serde(rename = "Browser.crashGpuProcess")]
251 CrashGpuProcess,
252}
253#[doc = "Crashes GPU process.\n[crashGpuProcess](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-crashGpuProcess)"]
254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
255pub struct CrashGpuProcess {
256 pub method: CrashGpuProcessMethod,
257 pub params: CrashGpuProcessParams,
258}
259impl CrashGpuProcess {
260 pub const IDENTIFIER: &'static str = "Browser.crashGpuProcess";
261 pub fn identifier(&self) -> &'static str {
262 Self::IDENTIFIER
263 }
264}
265impl crate::CommandResult for CrashGpuProcess {
266 type Result = super::results::CrashGpuProcessResult;
267}
268#[doc = "Returns version information.\n[getVersion](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getVersion)"]
269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
270pub struct GetVersionParams {}
271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
272pub enum GetVersionMethod {
273 #[serde(rename = "Browser.getVersion")]
274 GetVersion,
275}
276#[doc = "Returns version information.\n[getVersion](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getVersion)"]
277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
278pub struct GetVersion {
279 pub method: GetVersionMethod,
280 pub params: GetVersionParams,
281}
282impl GetVersion {
283 pub const IDENTIFIER: &'static str = "Browser.getVersion";
284 pub fn identifier(&self) -> &'static str {
285 Self::IDENTIFIER
286 }
287}
288impl crate::CommandResult for GetVersion {
289 type Result = super::results::GetVersionResult;
290}
291#[doc = "Returns the command line switches for the browser process if, and only if\n--enable-automation is on the commandline.\n[getBrowserCommandLine](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getBrowserCommandLine)"]
292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
293pub struct GetBrowserCommandLineParams {}
294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
295pub enum GetBrowserCommandLineMethod {
296 #[serde(rename = "Browser.getBrowserCommandLine")]
297 GetBrowserCommandLine,
298}
299#[doc = "Returns the command line switches for the browser process if, and only if\n--enable-automation is on the commandline.\n[getBrowserCommandLine](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getBrowserCommandLine)"]
300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
301pub struct GetBrowserCommandLine {
302 pub method: GetBrowserCommandLineMethod,
303 pub params: GetBrowserCommandLineParams,
304}
305impl GetBrowserCommandLine {
306 pub const IDENTIFIER: &'static str = "Browser.getBrowserCommandLine";
307 pub fn identifier(&self) -> &'static str {
308 Self::IDENTIFIER
309 }
310}
311impl crate::CommandResult for GetBrowserCommandLine {
312 type Result = super::results::GetBrowserCommandLineResult;
313}
314#[doc = "Get Chrome histograms.\n[getHistograms](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getHistograms)"]
315#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
316pub struct GetHistogramsParams {
317 #[doc = "Requested substring in name. Only histograms which have query as a\nsubstring in their name are extracted. An empty or absent query returns\nall histograms."]
318 #[serde(rename = "query")]
319 #[serde(skip_serializing_if = "Option::is_none")]
320 #[serde(default)]
321 pub query: Option<String>,
322 #[doc = "If true, retrieve delta since last delta call."]
323 #[serde(rename = "delta")]
324 #[serde(skip_serializing_if = "Option::is_none")]
325 #[serde(default)]
326 pub delta: Option<bool>,
327}
328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
329pub enum GetHistogramsMethod {
330 #[serde(rename = "Browser.getHistograms")]
331 GetHistograms,
332}
333#[doc = "Get Chrome histograms.\n[getHistograms](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getHistograms)"]
334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
335pub struct GetHistograms {
336 pub method: GetHistogramsMethod,
337 pub params: GetHistogramsParams,
338}
339impl GetHistograms {
340 pub const IDENTIFIER: &'static str = "Browser.getHistograms";
341 pub fn identifier(&self) -> &'static str {
342 Self::IDENTIFIER
343 }
344}
345impl crate::CommandResult for GetHistograms {
346 type Result = super::results::GetHistogramsResult;
347}
348#[doc = "Get a Chrome histogram by name.\n[getHistogram](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getHistogram)"]
349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
350pub struct GetHistogramParams {
351 #[doc = "Requested histogram name."]
352 #[serde(rename = "name")]
353 pub name: String,
354 #[doc = "If true, retrieve delta since last delta call."]
355 #[serde(rename = "delta")]
356 #[serde(skip_serializing_if = "Option::is_none")]
357 #[serde(default)]
358 pub delta: Option<bool>,
359}
360impl GetHistogramParams {
361 pub fn new(name: impl Into<String>) -> Self {
362 Self {
363 name: name.into(),
364 delta: None,
365 }
366 }
367}
368impl<T: Into<String>> From<T> for GetHistogramParams {
369 fn from(url: T) -> Self {
370 GetHistogramParams::new(url)
371 }
372}
373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
374pub enum GetHistogramMethod {
375 #[serde(rename = "Browser.getHistogram")]
376 GetHistogram,
377}
378#[doc = "Get a Chrome histogram by name.\n[getHistogram](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getHistogram)"]
379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
380pub struct GetHistogram {
381 pub method: GetHistogramMethod,
382 pub params: GetHistogramParams,
383}
384impl GetHistogram {
385 pub const IDENTIFIER: &'static str = "Browser.getHistogram";
386 pub fn identifier(&self) -> &'static str {
387 Self::IDENTIFIER
388 }
389}
390impl crate::CommandResult for GetHistogram {
391 type Result = super::results::GetHistogramResult;
392}
393#[doc = "Get position and size of the browser window.\n[getWindowBounds](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getWindowBounds)"]
394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
395pub struct GetWindowBoundsParams {
396 #[doc = "Browser window id."]
397 #[serde(rename = "windowId")]
398 pub window_id: super::types::WindowId,
399}
400impl GetWindowBoundsParams {
401 pub fn new(window_id: impl Into<super::types::WindowId>) -> Self {
402 Self {
403 window_id: window_id.into(),
404 }
405 }
406}
407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
408pub enum GetWindowBoundsMethod {
409 #[serde(rename = "Browser.getWindowBounds")]
410 GetWindowBounds,
411}
412#[doc = "Get position and size of the browser window.\n[getWindowBounds](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getWindowBounds)"]
413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
414pub struct GetWindowBounds {
415 pub method: GetWindowBoundsMethod,
416 pub params: GetWindowBoundsParams,
417}
418impl GetWindowBounds {
419 pub const IDENTIFIER: &'static str = "Browser.getWindowBounds";
420 pub fn identifier(&self) -> &'static str {
421 Self::IDENTIFIER
422 }
423}
424impl crate::CommandResult for GetWindowBounds {
425 type Result = super::results::GetWindowBoundsResult;
426}
427#[doc = "Get the browser window that contains the devtools target.\n[getWindowForTarget](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getWindowForTarget)"]
428#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
429pub struct GetWindowForTargetParams {
430 #[doc = "Devtools agent host id. If called as a part of the session, associated targetId is used."]
431 #[serde(rename = "targetId")]
432 #[serde(skip_serializing_if = "Option::is_none")]
433 #[serde(default)]
434 pub target_id: Option<crate::browser_protocol::target::types::TargetId>,
435}
436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
437pub enum GetWindowForTargetMethod {
438 #[serde(rename = "Browser.getWindowForTarget")]
439 GetWindowForTarget,
440}
441#[doc = "Get the browser window that contains the devtools target.\n[getWindowForTarget](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getWindowForTarget)"]
442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
443pub struct GetWindowForTarget {
444 pub method: GetWindowForTargetMethod,
445 pub params: GetWindowForTargetParams,
446}
447impl GetWindowForTarget {
448 pub const IDENTIFIER: &'static str = "Browser.getWindowForTarget";
449 pub fn identifier(&self) -> &'static str {
450 Self::IDENTIFIER
451 }
452}
453impl crate::CommandResult for GetWindowForTarget {
454 type Result = super::results::GetWindowForTargetResult;
455}
456#[doc = "Set position and/or size of the browser window.\n[setWindowBounds](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setWindowBounds)"]
457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
458pub struct SetWindowBoundsParams {
459 #[doc = "Browser window id."]
460 #[serde(rename = "windowId")]
461 pub window_id: super::types::WindowId,
462 #[doc = "New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined\nwith 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged."]
463 #[serde(rename = "bounds")]
464 pub bounds: super::types::Bounds,
465}
466impl SetWindowBoundsParams {
467 pub fn new(
468 window_id: impl Into<super::types::WindowId>,
469 bounds: impl Into<super::types::Bounds>,
470 ) -> Self {
471 Self {
472 window_id: window_id.into(),
473 bounds: bounds.into(),
474 }
475 }
476}
477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
478pub enum SetWindowBoundsMethod {
479 #[serde(rename = "Browser.setWindowBounds")]
480 SetWindowBounds,
481}
482#[doc = "Set position and/or size of the browser window.\n[setWindowBounds](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setWindowBounds)"]
483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
484pub struct SetWindowBounds {
485 pub method: SetWindowBoundsMethod,
486 pub params: SetWindowBoundsParams,
487}
488impl SetWindowBounds {
489 pub const IDENTIFIER: &'static str = "Browser.setWindowBounds";
490 pub fn identifier(&self) -> &'static str {
491 Self::IDENTIFIER
492 }
493}
494impl crate::CommandResult for SetWindowBounds {
495 type Result = super::results::SetWindowBoundsResult;
496}
497#[doc = "Set size of the browser contents resizing browser window as necessary.\n[setContentsSize](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setContentsSize)"]
498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
499pub struct SetContentsSizeParams {
500 #[doc = "Browser window id."]
501 #[serde(rename = "windowId")]
502 pub window_id: super::types::WindowId,
503 #[doc = "The window contents width in DIP. Assumes current width if omitted.\nMust be specified if 'height' is omitted."]
504 #[serde(rename = "width")]
505 #[serde(skip_serializing_if = "Option::is_none")]
506 #[serde(default)]
507 pub width: Option<i64>,
508 #[doc = "The window contents height in DIP. Assumes current height if omitted.\nMust be specified if 'width' is omitted."]
509 #[serde(rename = "height")]
510 #[serde(skip_serializing_if = "Option::is_none")]
511 #[serde(default)]
512 pub height: Option<i64>,
513}
514impl SetContentsSizeParams {
515 pub fn new(window_id: impl Into<super::types::WindowId>) -> Self {
516 Self {
517 window_id: window_id.into(),
518 width: None,
519 height: None,
520 }
521 }
522}
523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
524pub enum SetContentsSizeMethod {
525 #[serde(rename = "Browser.setContentsSize")]
526 SetContentsSize,
527}
528#[doc = "Set size of the browser contents resizing browser window as necessary.\n[setContentsSize](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setContentsSize)"]
529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
530pub struct SetContentsSize {
531 pub method: SetContentsSizeMethod,
532 pub params: SetContentsSizeParams,
533}
534impl SetContentsSize {
535 pub const IDENTIFIER: &'static str = "Browser.setContentsSize";
536 pub fn identifier(&self) -> &'static str {
537 Self::IDENTIFIER
538 }
539}
540impl crate::CommandResult for SetContentsSize {
541 type Result = super::results::SetContentsSizeResult;
542}
543#[doc = "Set dock tile details, platform-specific.\n[setDockTile](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setDockTile)"]
544#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
545pub struct SetDockTileParams {
546 #[serde(rename = "badgeLabel")]
547 #[serde(skip_serializing_if = "Option::is_none")]
548 #[serde(default)]
549 pub badge_label: Option<String>,
550 #[doc = "Png encoded image."]
551 #[serde(rename = "image")]
552 #[serde(skip_serializing_if = "Option::is_none")]
553 #[serde(default)]
554 pub image: Option<crate::Binary>,
555}
556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
557pub enum SetDockTileMethod {
558 #[serde(rename = "Browser.setDockTile")]
559 SetDockTile,
560}
561#[doc = "Set dock tile details, platform-specific.\n[setDockTile](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setDockTile)"]
562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
563pub struct SetDockTile {
564 pub method: SetDockTileMethod,
565 pub params: SetDockTileParams,
566}
567impl SetDockTile {
568 pub const IDENTIFIER: &'static str = "Browser.setDockTile";
569 pub fn identifier(&self) -> &'static str {
570 Self::IDENTIFIER
571 }
572}
573impl crate::CommandResult for SetDockTile {
574 type Result = super::results::SetDockTileResult;
575}
576#[doc = "Invoke custom browser commands used by telemetry.\n[executeBrowserCommand](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-executeBrowserCommand)"]
577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
578pub struct ExecuteBrowserCommandParams {
579 #[serde(rename = "commandId")]
580 pub command_id: super::types::BrowserCommandId,
581}
582impl ExecuteBrowserCommandParams {
583 pub fn new(command_id: impl Into<super::types::BrowserCommandId>) -> Self {
584 Self {
585 command_id: command_id.into(),
586 }
587 }
588}
589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
590pub enum ExecuteBrowserCommandMethod {
591 #[serde(rename = "Browser.executeBrowserCommand")]
592 ExecuteBrowserCommand,
593}
594#[doc = "Invoke custom browser commands used by telemetry.\n[executeBrowserCommand](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-executeBrowserCommand)"]
595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
596pub struct ExecuteBrowserCommand {
597 pub method: ExecuteBrowserCommandMethod,
598 pub params: ExecuteBrowserCommandParams,
599}
600impl ExecuteBrowserCommand {
601 pub const IDENTIFIER: &'static str = "Browser.executeBrowserCommand";
602 pub fn identifier(&self) -> &'static str {
603 Self::IDENTIFIER
604 }
605}
606impl crate::CommandResult for ExecuteBrowserCommand {
607 type Result = super::results::ExecuteBrowserCommandResult;
608}
609#[doc = "Allows a site to use privacy sandbox features that require enrollment\nwithout the site actually being enrolled. Only supported on page targets.\n[addPrivacySandboxEnrollmentOverride](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-addPrivacySandboxEnrollmentOverride)"]
610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
611pub struct AddPrivacySandboxEnrollmentOverrideParams {
612 #[serde(rename = "url")]
613 pub url: String,
614}
615impl AddPrivacySandboxEnrollmentOverrideParams {
616 pub fn new(url: impl Into<String>) -> Self {
617 Self { url: url.into() }
618 }
619}
620impl<T: Into<String>> From<T> for AddPrivacySandboxEnrollmentOverrideParams {
621 fn from(url: T) -> Self {
622 AddPrivacySandboxEnrollmentOverrideParams::new(url)
623 }
624}
625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
626pub enum AddPrivacySandboxEnrollmentOverrideMethod {
627 #[serde(rename = "Browser.addPrivacySandboxEnrollmentOverride")]
628 AddPrivacySandboxEnrollmentOverride,
629}
630#[doc = "Allows a site to use privacy sandbox features that require enrollment\nwithout the site actually being enrolled. Only supported on page targets.\n[addPrivacySandboxEnrollmentOverride](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-addPrivacySandboxEnrollmentOverride)"]
631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
632pub struct AddPrivacySandboxEnrollmentOverride {
633 pub method: AddPrivacySandboxEnrollmentOverrideMethod,
634 pub params: AddPrivacySandboxEnrollmentOverrideParams,
635}
636impl AddPrivacySandboxEnrollmentOverride {
637 pub const IDENTIFIER: &'static str = "Browser.addPrivacySandboxEnrollmentOverride";
638 pub fn identifier(&self) -> &'static str {
639 Self::IDENTIFIER
640 }
641}
642impl crate::CommandResult for AddPrivacySandboxEnrollmentOverride {
643 type Result = super::results::AddPrivacySandboxEnrollmentOverrideResult;
644}
645#[doc = "Configures encryption keys used with a given privacy sandbox API to talk\nto a trusted coordinator. Since this is intended for test automation only,\ncoordinatorOrigin must be a .test domain. No existing coordinator\nconfiguration for the origin may exist.\n[addPrivacySandboxCoordinatorKeyConfig](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-addPrivacySandboxCoordinatorKeyConfig)"]
646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
647pub struct AddPrivacySandboxCoordinatorKeyConfigParams {
648 #[serde(rename = "api")]
649 pub api: super::types::PrivacySandboxApi,
650 #[serde(rename = "coordinatorOrigin")]
651 pub coordinator_origin: String,
652 #[serde(rename = "keyConfig")]
653 pub key_config: String,
654 #[doc = "BrowserContext to perform the action in. When omitted, default browser\ncontext is used."]
655 #[serde(rename = "browserContextId")]
656 #[serde(skip_serializing_if = "Option::is_none")]
657 #[serde(default)]
658 pub browser_context_id: Option<Box<super::types::BrowserContextId>>,
659}
660impl AddPrivacySandboxCoordinatorKeyConfigParams {
661 pub fn new(
662 api: impl Into<super::types::PrivacySandboxApi>,
663 coordinator_origin: impl Into<String>,
664 key_config: impl Into<String>,
665 ) -> Self {
666 Self {
667 api: api.into(),
668 coordinator_origin: coordinator_origin.into(),
669 key_config: key_config.into(),
670 browser_context_id: None,
671 }
672 }
673}
674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
675pub enum AddPrivacySandboxCoordinatorKeyConfigMethod {
676 #[serde(rename = "Browser.addPrivacySandboxCoordinatorKeyConfig")]
677 AddPrivacySandboxCoordinatorKeyConfig,
678}
679#[doc = "Configures encryption keys used with a given privacy sandbox API to talk\nto a trusted coordinator. Since this is intended for test automation only,\ncoordinatorOrigin must be a .test domain. No existing coordinator\nconfiguration for the origin may exist.\n[addPrivacySandboxCoordinatorKeyConfig](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-addPrivacySandboxCoordinatorKeyConfig)"]
680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
681pub struct AddPrivacySandboxCoordinatorKeyConfig {
682 pub method: AddPrivacySandboxCoordinatorKeyConfigMethod,
683 pub params: AddPrivacySandboxCoordinatorKeyConfigParams,
684}
685impl AddPrivacySandboxCoordinatorKeyConfig {
686 pub const IDENTIFIER: &'static str = "Browser.addPrivacySandboxCoordinatorKeyConfig";
687 pub fn identifier(&self) -> &'static str {
688 Self::IDENTIFIER
689 }
690}
691impl crate::CommandResult for AddPrivacySandboxCoordinatorKeyConfig {
692 type Result = super::results::AddPrivacySandboxCoordinatorKeyConfigResult;
693}
694group_enum ! (BrowserCommands { SetPermission (SetPermission) , ResetPermissions (ResetPermissions) , SetDownloadBehavior (SetDownloadBehavior) , CancelDownload (CancelDownload) , Close (Close) , Crash (Crash) , CrashGpuProcess (CrashGpuProcess) , GetVersion (GetVersion) , GetBrowserCommandLine (GetBrowserCommandLine) , GetHistograms (GetHistograms) , GetHistogram (GetHistogram) , GetWindowBounds (GetWindowBounds) , GetWindowForTarget (GetWindowForTarget) , SetWindowBounds (SetWindowBounds) , SetContentsSize (SetContentsSize) , SetDockTile (SetDockTile) , ExecuteBrowserCommand (ExecuteBrowserCommand) , AddPrivacySandboxEnrollmentOverride (AddPrivacySandboxEnrollmentOverride) , AddPrivacySandboxCoordinatorKeyConfig (AddPrivacySandboxCoordinatorKeyConfig) } + identifiable);