/
command.go
583 lines (501 loc) · 24 KB
/
command.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
// Code generated by cdpgen. DO NOT EDIT.
package emulation
import (
"github.com/mafredri/cdp/protocol/dom"
"github.com/mafredri/cdp/protocol/network"
"github.com/mafredri/cdp/protocol/page"
)
// CanEmulateReply represents the return values for CanEmulate in the Emulation domain.
type CanEmulateReply struct {
Result bool `json:"result"` // True if emulation is supported.
}
// SetFocusEmulationEnabledArgs represents the arguments for SetFocusEmulationEnabled in the Emulation domain.
type SetFocusEmulationEnabledArgs struct {
Enabled bool `json:"enabled"` // Whether to enable to disable focus emulation.
}
// NewSetFocusEmulationEnabledArgs initializes SetFocusEmulationEnabledArgs with the required arguments.
func NewSetFocusEmulationEnabledArgs(enabled bool) *SetFocusEmulationEnabledArgs {
args := new(SetFocusEmulationEnabledArgs)
args.Enabled = enabled
return args
}
// SetAutoDarkModeOverrideArgs represents the arguments for SetAutoDarkModeOverride in the Emulation domain.
type SetAutoDarkModeOverrideArgs struct {
Enabled *bool `json:"enabled,omitempty"` // Whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared.
}
// NewSetAutoDarkModeOverrideArgs initializes SetAutoDarkModeOverrideArgs with the required arguments.
func NewSetAutoDarkModeOverrideArgs() *SetAutoDarkModeOverrideArgs {
args := new(SetAutoDarkModeOverrideArgs)
return args
}
// SetEnabled sets the Enabled optional argument. Whether to enable or
// disable automatic dark mode. If not specified, any existing override
// will be cleared.
func (a *SetAutoDarkModeOverrideArgs) SetEnabled(enabled bool) *SetAutoDarkModeOverrideArgs {
a.Enabled = &enabled
return a
}
// SetCPUThrottlingRateArgs represents the arguments for SetCPUThrottlingRate in the Emulation domain.
type SetCPUThrottlingRateArgs struct {
Rate float64 `json:"rate"` // Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
}
// NewSetCPUThrottlingRateArgs initializes SetCPUThrottlingRateArgs with the required arguments.
func NewSetCPUThrottlingRateArgs(rate float64) *SetCPUThrottlingRateArgs {
args := new(SetCPUThrottlingRateArgs)
args.Rate = rate
return args
}
// SetDefaultBackgroundColorOverrideArgs represents the arguments for SetDefaultBackgroundColorOverride in the Emulation domain.
type SetDefaultBackgroundColorOverrideArgs struct {
Color *dom.RGBA `json:"color,omitempty"` // RGBA of the default background color. If not specified, any existing override will be cleared.
}
// NewSetDefaultBackgroundColorOverrideArgs initializes SetDefaultBackgroundColorOverrideArgs with the required arguments.
func NewSetDefaultBackgroundColorOverrideArgs() *SetDefaultBackgroundColorOverrideArgs {
args := new(SetDefaultBackgroundColorOverrideArgs)
return args
}
// SetColor sets the Color optional argument. RGBA of the default
// background color. If not specified, any existing override will be
// cleared.
func (a *SetDefaultBackgroundColorOverrideArgs) SetColor(color dom.RGBA) *SetDefaultBackgroundColorOverrideArgs {
a.Color = &color
return a
}
// SetDeviceMetricsOverrideArgs represents the arguments for SetDeviceMetricsOverride in the Emulation domain.
type SetDeviceMetricsOverrideArgs struct {
Width int `json:"width"` // Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
Height int `json:"height"` // Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
DeviceScaleFactor float64 `json:"deviceScaleFactor"` // Overriding device scale factor value. 0 disables the override.
Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
// Scale Scale to apply to resulting view image.
//
// Note: This property is experimental.
Scale *float64 `json:"scale,omitempty"`
// ScreenWidth Overriding screen width value in pixels (minimum 0,
// maximum 10000000).
//
// Note: This property is experimental.
ScreenWidth *int `json:"screenWidth,omitempty"`
// ScreenHeight Overriding screen height value in pixels (minimum 0,
// maximum 10000000).
//
// Note: This property is experimental.
ScreenHeight *int `json:"screenHeight,omitempty"`
// PositionX Overriding view X position on screen in pixels (minimum
// 0, maximum 10000000).
//
// Note: This property is experimental.
PositionX *int `json:"positionX,omitempty"`
// PositionY Overriding view Y position on screen in pixels (minimum
// 0, maximum 10000000).
//
// Note: This property is experimental.
PositionY *int `json:"positionY,omitempty"`
// DontSetVisibleSize Do not set visible view size, rely upon explicit
// setVisibleSize call.
//
// Note: This property is experimental.
DontSetVisibleSize *bool `json:"dontSetVisibleSize,omitempty"`
ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override.
// Viewport If set, the visible area of the page will be overridden to
// this viewport. This viewport change is not observed by the page,
// e.g. viewport-relative elements do not change positions.
//
// Note: This property is experimental.
Viewport *page.Viewport `json:"viewport,omitempty"`
// DisplayFeature If set, the display feature of a multi-segment
// screen. If not set, multi-segment support is turned-off.
//
// Note: This property is experimental.
DisplayFeature *DisplayFeature `json:"displayFeature,omitempty"`
}
// NewSetDeviceMetricsOverrideArgs initializes SetDeviceMetricsOverrideArgs with the required arguments.
func NewSetDeviceMetricsOverrideArgs(width int, height int, deviceScaleFactor float64, mobile bool) *SetDeviceMetricsOverrideArgs {
args := new(SetDeviceMetricsOverrideArgs)
args.Width = width
args.Height = height
args.DeviceScaleFactor = deviceScaleFactor
args.Mobile = mobile
return args
}
// SetScale sets the Scale optional argument. Scale to apply to
// resulting view image.
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetScale(scale float64) *SetDeviceMetricsOverrideArgs {
a.Scale = &scale
return a
}
// SetScreenWidth sets the ScreenWidth optional argument. Overriding
// screen width value in pixels (minimum 0, maximum 10000000).
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetScreenWidth(screenWidth int) *SetDeviceMetricsOverrideArgs {
a.ScreenWidth = &screenWidth
return a
}
// SetScreenHeight sets the ScreenHeight optional argument. Overriding
// screen height value in pixels (minimum 0, maximum 10000000).
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetScreenHeight(screenHeight int) *SetDeviceMetricsOverrideArgs {
a.ScreenHeight = &screenHeight
return a
}
// SetPositionX sets the PositionX optional argument. Overriding view
// X position on screen in pixels (minimum 0, maximum 10000000).
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetPositionX(positionX int) *SetDeviceMetricsOverrideArgs {
a.PositionX = &positionX
return a
}
// SetPositionY sets the PositionY optional argument. Overriding view
// Y position on screen in pixels (minimum 0, maximum 10000000).
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetPositionY(positionY int) *SetDeviceMetricsOverrideArgs {
a.PositionY = &positionY
return a
}
// SetDontSetVisibleSize sets the DontSetVisibleSize optional argument.
// Do not set visible view size, rely upon explicit setVisibleSize
// call.
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideArgs {
a.DontSetVisibleSize = &dontSetVisibleSize
return a
}
// SetScreenOrientation sets the ScreenOrientation optional argument.
// Screen orientation override.
func (a *SetDeviceMetricsOverrideArgs) SetScreenOrientation(screenOrientation ScreenOrientation) *SetDeviceMetricsOverrideArgs {
a.ScreenOrientation = &screenOrientation
return a
}
// SetViewport sets the Viewport optional argument. If set, the
// visible area of the page will be overridden to this viewport. This
// viewport change is not observed by the page, e.g. viewport-relative
// elements do not change positions.
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetViewport(viewport page.Viewport) *SetDeviceMetricsOverrideArgs {
a.Viewport = &viewport
return a
}
// SetDisplayFeature sets the DisplayFeature optional argument. If
// set, the display feature of a multi-segment screen. If not set,
// multi-segment support is turned-off.
//
// Note: This property is experimental.
func (a *SetDeviceMetricsOverrideArgs) SetDisplayFeature(displayFeature DisplayFeature) *SetDeviceMetricsOverrideArgs {
a.DisplayFeature = &displayFeature
return a
}
// SetScrollbarsHiddenArgs represents the arguments for SetScrollbarsHidden in the Emulation domain.
type SetScrollbarsHiddenArgs struct {
Hidden bool `json:"hidden"` // Whether scrollbars should be always hidden.
}
// NewSetScrollbarsHiddenArgs initializes SetScrollbarsHiddenArgs with the required arguments.
func NewSetScrollbarsHiddenArgs(hidden bool) *SetScrollbarsHiddenArgs {
args := new(SetScrollbarsHiddenArgs)
args.Hidden = hidden
return args
}
// SetDocumentCookieDisabledArgs represents the arguments for SetDocumentCookieDisabled in the Emulation domain.
type SetDocumentCookieDisabledArgs struct {
Disabled bool `json:"disabled"` // Whether document.coookie API should be disabled.
}
// NewSetDocumentCookieDisabledArgs initializes SetDocumentCookieDisabledArgs with the required arguments.
func NewSetDocumentCookieDisabledArgs(disabled bool) *SetDocumentCookieDisabledArgs {
args := new(SetDocumentCookieDisabledArgs)
args.Disabled = disabled
return args
}
// SetEmitTouchEventsForMouseArgs represents the arguments for SetEmitTouchEventsForMouse in the Emulation domain.
type SetEmitTouchEventsForMouseArgs struct {
Enabled bool `json:"enabled"` // Whether touch emulation based on mouse input should be enabled.
// Configuration Touch/gesture events configuration. Default: current
// platform.
//
// Values: "mobile", "desktop".
Configuration *string `json:"configuration,omitempty"`
}
// NewSetEmitTouchEventsForMouseArgs initializes SetEmitTouchEventsForMouseArgs with the required arguments.
func NewSetEmitTouchEventsForMouseArgs(enabled bool) *SetEmitTouchEventsForMouseArgs {
args := new(SetEmitTouchEventsForMouseArgs)
args.Enabled = enabled
return args
}
// SetConfiguration sets the Configuration optional argument.
// Touch/gesture events configuration. Default: current platform.
//
// Values: "mobile", "desktop".
func (a *SetEmitTouchEventsForMouseArgs) SetConfiguration(configuration string) *SetEmitTouchEventsForMouseArgs {
a.Configuration = &configuration
return a
}
// SetEmulatedMediaArgs represents the arguments for SetEmulatedMedia in the Emulation domain.
type SetEmulatedMediaArgs struct {
Media *string `json:"media,omitempty"` // Media type to emulate. Empty string disables the override.
Features []MediaFeature `json:"features,omitempty"` // Media features to emulate.
}
// NewSetEmulatedMediaArgs initializes SetEmulatedMediaArgs with the required arguments.
func NewSetEmulatedMediaArgs() *SetEmulatedMediaArgs {
args := new(SetEmulatedMediaArgs)
return args
}
// SetMedia sets the Media optional argument. Media type to emulate.
// Empty string disables the override.
func (a *SetEmulatedMediaArgs) SetMedia(media string) *SetEmulatedMediaArgs {
a.Media = &media
return a
}
// SetFeatures sets the Features optional argument. Media features to
// emulate.
func (a *SetEmulatedMediaArgs) SetFeatures(features []MediaFeature) *SetEmulatedMediaArgs {
a.Features = features
return a
}
// SetEmulatedVisionDeficiencyArgs represents the arguments for SetEmulatedVisionDeficiency in the Emulation domain.
type SetEmulatedVisionDeficiencyArgs struct {
// Type Vision deficiency to emulate.
//
// Values: "none", "achromatopsia", "blurredVision", "deuteranopia", "protanopia", "tritanopia".
Type string `json:"type"`
}
// NewSetEmulatedVisionDeficiencyArgs initializes SetEmulatedVisionDeficiencyArgs with the required arguments.
func NewSetEmulatedVisionDeficiencyArgs(typ string) *SetEmulatedVisionDeficiencyArgs {
args := new(SetEmulatedVisionDeficiencyArgs)
args.Type = typ
return args
}
// SetGeolocationOverrideArgs represents the arguments for SetGeolocationOverride in the Emulation domain.
type SetGeolocationOverrideArgs struct {
Latitude *float64 `json:"latitude,omitempty"` // Mock latitude
Longitude *float64 `json:"longitude,omitempty"` // Mock longitude
Accuracy *float64 `json:"accuracy,omitempty"` // Mock accuracy
}
// NewSetGeolocationOverrideArgs initializes SetGeolocationOverrideArgs with the required arguments.
func NewSetGeolocationOverrideArgs() *SetGeolocationOverrideArgs {
args := new(SetGeolocationOverrideArgs)
return args
}
// SetLatitude sets the Latitude optional argument. Mock latitude
func (a *SetGeolocationOverrideArgs) SetLatitude(latitude float64) *SetGeolocationOverrideArgs {
a.Latitude = &latitude
return a
}
// SetLongitude sets the Longitude optional argument. Mock longitude
func (a *SetGeolocationOverrideArgs) SetLongitude(longitude float64) *SetGeolocationOverrideArgs {
a.Longitude = &longitude
return a
}
// SetAccuracy sets the Accuracy optional argument. Mock accuracy
func (a *SetGeolocationOverrideArgs) SetAccuracy(accuracy float64) *SetGeolocationOverrideArgs {
a.Accuracy = &accuracy
return a
}
// SetIdleOverrideArgs represents the arguments for SetIdleOverride in the Emulation domain.
type SetIdleOverrideArgs struct {
IsUserActive bool `json:"isUserActive"` // Mock isUserActive
IsScreenUnlocked bool `json:"isScreenUnlocked"` // Mock isScreenUnlocked
}
// NewSetIdleOverrideArgs initializes SetIdleOverrideArgs with the required arguments.
func NewSetIdleOverrideArgs(isUserActive bool, isScreenUnlocked bool) *SetIdleOverrideArgs {
args := new(SetIdleOverrideArgs)
args.IsUserActive = isUserActive
args.IsScreenUnlocked = isScreenUnlocked
return args
}
// SetNavigatorOverridesArgs represents the arguments for SetNavigatorOverrides in the Emulation domain.
type SetNavigatorOverridesArgs struct {
Platform string `json:"platform"` // The platform navigator.platform should return.
}
// NewSetNavigatorOverridesArgs initializes SetNavigatorOverridesArgs with the required arguments.
func NewSetNavigatorOverridesArgs(platform string) *SetNavigatorOverridesArgs {
args := new(SetNavigatorOverridesArgs)
args.Platform = platform
return args
}
// SetPageScaleFactorArgs represents the arguments for SetPageScaleFactor in the Emulation domain.
type SetPageScaleFactorArgs struct {
PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor.
}
// NewSetPageScaleFactorArgs initializes SetPageScaleFactorArgs with the required arguments.
func NewSetPageScaleFactorArgs(pageScaleFactor float64) *SetPageScaleFactorArgs {
args := new(SetPageScaleFactorArgs)
args.PageScaleFactor = pageScaleFactor
return args
}
// SetScriptExecutionDisabledArgs represents the arguments for SetScriptExecutionDisabled in the Emulation domain.
type SetScriptExecutionDisabledArgs struct {
Value bool `json:"value"` // Whether script execution should be disabled in the page.
}
// NewSetScriptExecutionDisabledArgs initializes SetScriptExecutionDisabledArgs with the required arguments.
func NewSetScriptExecutionDisabledArgs(value bool) *SetScriptExecutionDisabledArgs {
args := new(SetScriptExecutionDisabledArgs)
args.Value = value
return args
}
// SetTouchEmulationEnabledArgs represents the arguments for SetTouchEmulationEnabled in the Emulation domain.
type SetTouchEmulationEnabledArgs struct {
Enabled bool `json:"enabled"` // Whether the touch event emulation should be enabled.
MaxTouchPoints *int `json:"maxTouchPoints,omitempty"` // Maximum touch points supported. Defaults to one.
}
// NewSetTouchEmulationEnabledArgs initializes SetTouchEmulationEnabledArgs with the required arguments.
func NewSetTouchEmulationEnabledArgs(enabled bool) *SetTouchEmulationEnabledArgs {
args := new(SetTouchEmulationEnabledArgs)
args.Enabled = enabled
return args
}
// SetMaxTouchPoints sets the MaxTouchPoints optional argument.
// Maximum touch points supported. Defaults to one.
func (a *SetTouchEmulationEnabledArgs) SetMaxTouchPoints(maxTouchPoints int) *SetTouchEmulationEnabledArgs {
a.MaxTouchPoints = &maxTouchPoints
return a
}
// SetVirtualTimePolicyArgs represents the arguments for SetVirtualTimePolicy in the Emulation domain.
type SetVirtualTimePolicyArgs struct {
Policy VirtualTimePolicy `json:"policy"` // No description.
Budget *float64 `json:"budget,omitempty"` // If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
MaxVirtualTimeTaskStarvationCount *int `json:"maxVirtualTimeTaskStarvationCount,omitempty"` // If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
InitialVirtualTime network.TimeSinceEpoch `json:"initialVirtualTime,omitempty"` // If set, base::Time::Now will be overridden to initially return this value.
}
// NewSetVirtualTimePolicyArgs initializes SetVirtualTimePolicyArgs with the required arguments.
func NewSetVirtualTimePolicyArgs(policy VirtualTimePolicy) *SetVirtualTimePolicyArgs {
args := new(SetVirtualTimePolicyArgs)
args.Policy = policy
return args
}
// SetBudget sets the Budget optional argument. If set, after this
// many virtual milliseconds have elapsed virtual time will be paused
// and a virtualTimeBudgetExpired event is sent.
func (a *SetVirtualTimePolicyArgs) SetBudget(budget float64) *SetVirtualTimePolicyArgs {
a.Budget = &budget
return a
}
// SetMaxVirtualTimeTaskStarvationCount sets the MaxVirtualTimeTaskStarvationCount optional argument.
// If set this specifies the maximum number of tasks that can be run
// before virtual is forced forwards to prevent deadlock.
func (a *SetVirtualTimePolicyArgs) SetMaxVirtualTimeTaskStarvationCount(maxVirtualTimeTaskStarvationCount int) *SetVirtualTimePolicyArgs {
a.MaxVirtualTimeTaskStarvationCount = &maxVirtualTimeTaskStarvationCount
return a
}
// SetInitialVirtualTime sets the InitialVirtualTime optional argument.
// If set, base::Time::Now will be overridden to initially return this
// value.
func (a *SetVirtualTimePolicyArgs) SetInitialVirtualTime(initialVirtualTime network.TimeSinceEpoch) *SetVirtualTimePolicyArgs {
a.InitialVirtualTime = initialVirtualTime
return a
}
// SetVirtualTimePolicyReply represents the return values for SetVirtualTimePolicy in the Emulation domain.
type SetVirtualTimePolicyReply struct {
VirtualTimeTicksBase float64 `json:"virtualTimeTicksBase"` // Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
}
// SetLocaleOverrideArgs represents the arguments for SetLocaleOverride in the Emulation domain.
type SetLocaleOverrideArgs struct {
Locale *string `json:"locale,omitempty"` // ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
}
// NewSetLocaleOverrideArgs initializes SetLocaleOverrideArgs with the required arguments.
func NewSetLocaleOverrideArgs() *SetLocaleOverrideArgs {
args := new(SetLocaleOverrideArgs)
return args
}
// SetLocale sets the Locale optional argument. ICU style C locale
// (e.g. "en_US"). If not specified or empty, disables the override and
// restores default host system locale.
func (a *SetLocaleOverrideArgs) SetLocale(locale string) *SetLocaleOverrideArgs {
a.Locale = &locale
return a
}
// SetTimezoneOverrideArgs represents the arguments for SetTimezoneOverride in the Emulation domain.
type SetTimezoneOverrideArgs struct {
TimezoneID string `json:"timezoneId"` // The timezone identifier. If empty, disables the override and restores default host system timezone.
}
// NewSetTimezoneOverrideArgs initializes SetTimezoneOverrideArgs with the required arguments.
func NewSetTimezoneOverrideArgs(timezoneID string) *SetTimezoneOverrideArgs {
args := new(SetTimezoneOverrideArgs)
args.TimezoneID = timezoneID
return args
}
// SetVisibleSizeArgs represents the arguments for SetVisibleSize in the Emulation domain.
type SetVisibleSizeArgs struct {
Width int `json:"width"` // Frame width (DIP).
Height int `json:"height"` // Frame height (DIP).
}
// NewSetVisibleSizeArgs initializes SetVisibleSizeArgs with the required arguments.
func NewSetVisibleSizeArgs(width int, height int) *SetVisibleSizeArgs {
args := new(SetVisibleSizeArgs)
args.Width = width
args.Height = height
return args
}
// SetDisabledImageTypesArgs represents the arguments for SetDisabledImageTypes in the Emulation domain.
type SetDisabledImageTypesArgs struct {
ImageTypes []DisabledImageType `json:"imageTypes"` // Image types to disable.
}
// NewSetDisabledImageTypesArgs initializes SetDisabledImageTypesArgs with the required arguments.
func NewSetDisabledImageTypesArgs(imageTypes []DisabledImageType) *SetDisabledImageTypesArgs {
args := new(SetDisabledImageTypesArgs)
args.ImageTypes = imageTypes
return args
}
// SetHardwareConcurrencyOverrideArgs represents the arguments for SetHardwareConcurrencyOverride in the Emulation domain.
type SetHardwareConcurrencyOverrideArgs struct {
HardwareConcurrency int `json:"hardwareConcurrency"` // Hardware concurrency to report
}
// NewSetHardwareConcurrencyOverrideArgs initializes SetHardwareConcurrencyOverrideArgs with the required arguments.
func NewSetHardwareConcurrencyOverrideArgs(hardwareConcurrency int) *SetHardwareConcurrencyOverrideArgs {
args := new(SetHardwareConcurrencyOverrideArgs)
args.HardwareConcurrency = hardwareConcurrency
return args
}
// SetUserAgentOverrideArgs represents the arguments for SetUserAgentOverride in the Emulation domain.
type SetUserAgentOverrideArgs struct {
UserAgent string `json:"userAgent"` // User agent to use.
AcceptLanguage *string `json:"acceptLanguage,omitempty"` // Browser langugage to emulate.
Platform *string `json:"platform,omitempty"` // The platform navigator.platform should return.
// UserAgentMetadata To be sent in Sec-CH-UA-* headers and returned in
// navigator.userAgentData
//
// Note: This property is experimental.
UserAgentMetadata *UserAgentMetadata `json:"userAgentMetadata,omitempty"`
}
// NewSetUserAgentOverrideArgs initializes SetUserAgentOverrideArgs with the required arguments.
func NewSetUserAgentOverrideArgs(userAgent string) *SetUserAgentOverrideArgs {
args := new(SetUserAgentOverrideArgs)
args.UserAgent = userAgent
return args
}
// SetAcceptLanguage sets the AcceptLanguage optional argument.
// Browser langugage to emulate.
func (a *SetUserAgentOverrideArgs) SetAcceptLanguage(acceptLanguage string) *SetUserAgentOverrideArgs {
a.AcceptLanguage = &acceptLanguage
return a
}
// SetPlatform sets the Platform optional argument. The platform
// navigator.platform should return.
func (a *SetUserAgentOverrideArgs) SetPlatform(platform string) *SetUserAgentOverrideArgs {
a.Platform = &platform
return a
}
// SetUserAgentMetadata sets the UserAgentMetadata optional argument.
// To be sent in Sec-CH-UA-* headers and returned in
// navigator.userAgentData
//
// Note: This property is experimental.
func (a *SetUserAgentOverrideArgs) SetUserAgentMetadata(userAgentMetadata UserAgentMetadata) *SetUserAgentOverrideArgs {
a.UserAgentMetadata = &userAgentMetadata
return a
}
// SetAutomationOverrideArgs represents the arguments for SetAutomationOverride in the Emulation domain.
type SetAutomationOverrideArgs struct {
Enabled bool `json:"enabled"` // Whether the override should be enabled.
}
// NewSetAutomationOverrideArgs initializes SetAutomationOverrideArgs with the required arguments.
func NewSetAutomationOverrideArgs(enabled bool) *SetAutomationOverrideArgs {
args := new(SetAutomationOverrideArgs)
args.Enabled = enabled
return args
}