cdp_protocol/
headless_experimental.rs1#![allow(dead_code)]
3#[allow(unused_imports)]
4use super::types::*;
5#[allow(unused_imports)]
6use derive_builder::Builder;
7#[allow(unused_imports)]
8use serde::{Deserialize, Serialize};
9#[allow(unused_imports)]
10use serde_json::Value as Json;
11#[allow(deprecated)]
12#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
13pub enum ScreenshotParamsFormat {
14 #[serde(rename = "jpeg")]
15 Jpeg,
16 #[serde(rename = "png")]
17 Png,
18 #[serde(rename = "webp")]
19 Webp,
20}
21#[allow(deprecated)]
22#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
23#[builder(setter(into, strip_option))]
24#[serde(rename_all = "camelCase")]
25#[doc = "Encoding options for a screenshot."]
26pub struct ScreenshotParams {
27 #[builder(default)]
28 #[serde(skip_serializing_if = "Option::is_none")]
29 #[doc = "Image compression format (defaults to png)."]
30 pub format: Option<ScreenshotParamsFormat>,
31 #[builder(default)]
32 #[serde(skip_serializing_if = "Option::is_none")]
33 #[serde(default)]
34 #[doc = "Compression quality from range \\[0..100\\] (jpeg and webp only)."]
35 pub quality: Option<JsUInt>,
36 #[builder(default)]
37 #[serde(skip_serializing_if = "Option::is_none")]
38 #[serde(default)]
39 #[doc = "Optimize image encoding for speed, not for resulting size (defaults to false)"]
40 pub optimize_for_speed: Option<bool>,
41}
42#[allow(deprecated)]
43#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
44#[builder(setter(into, strip_option))]
45#[serde(rename_all = "camelCase")]
46#[doc = "Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a\n screenshot from the resulting frame. Requires that the target was created with enabled\n BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also\n <https://goo.gle/chrome-headless-rendering> for more background."]
47pub struct BeginFrame {
48 #[builder(default)]
49 #[serde(skip_serializing_if = "Option::is_none")]
50 #[serde(default)]
51 #[doc = "Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set,\n the current time will be used."]
52 pub frame_time_ticks: Option<JsFloat>,
53 #[builder(default)]
54 #[serde(skip_serializing_if = "Option::is_none")]
55 #[serde(default)]
56 #[doc = "The interval between BeginFrames that is reported to the compositor, in milliseconds.\n Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds."]
57 pub interval: Option<JsFloat>,
58 #[builder(default)]
59 #[serde(skip_serializing_if = "Option::is_none")]
60 #[serde(default)]
61 #[doc = "Whether updates should not be committed and drawn onto the display. False by default. If\n true, only side effects of the BeginFrame will be run, such as layout and animations, but\n any visual updates may not be visible on the display or in screenshots."]
62 pub no_display_updates: Option<bool>,
63 #[builder(default)]
64 #[serde(skip_serializing_if = "Option::is_none")]
65 #[doc = "If set, a screenshot of the frame will be captured and returned in the response. Otherwise,\n no screenshot will be captured. Note that capturing a screenshot can fail, for example,\n during renderer initialization. In such a case, no screenshot data will be returned."]
66 pub screenshot: Option<ScreenshotParams>,
67}
68#[allow(deprecated)]
69#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
70pub struct Disable(pub Option<Json>);
71#[allow(deprecated)]
72#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
73pub struct Enable(pub Option<Json>);
74#[allow(deprecated)]
75#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
76#[serde(rename_all = "camelCase")]
77#[doc = "Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a\n screenshot from the resulting frame. Requires that the target was created with enabled\n BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also\n <https://goo.gle/chrome-headless-rendering> for more background."]
78pub struct BeginFrameReturnObject {
79 #[serde(default)]
80 #[doc = "Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the\n display. Reported for diagnostic uses, may be removed in the future."]
81 pub has_damage: bool,
82 #[builder(default)]
83 #[serde(skip_serializing_if = "Option::is_none")]
84 #[doc = "Base64-encoded image data of the screenshot, if one was requested and successfully taken."]
85 pub screenshot_data: Option<String>,
86}
87#[allow(deprecated)]
88#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
89#[doc = "Disables headless events for the target."]
90#[deprecated]
91pub struct DisableReturnObject(pub Option<Json>);
92#[allow(deprecated)]
93#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
94#[doc = "Enables headless events for the target."]
95#[deprecated]
96pub struct EnableReturnObject(pub Option<Json>);
97#[allow(deprecated)]
98impl Method for BeginFrame {
99 const NAME: &'static str = "HeadlessExperimental.beginFrame";
100 type ReturnObject = BeginFrameReturnObject;
101}
102#[allow(deprecated)]
103impl Method for Disable {
104 const NAME: &'static str = "HeadlessExperimental.disable";
105 type ReturnObject = DisableReturnObject;
106}
107#[allow(deprecated)]
108impl Method for Enable {
109 const NAME: &'static str = "HeadlessExperimental.enable";
110 type ReturnObject = EnableReturnObject;
111}
112#[allow(dead_code)]
113pub mod events {
114 #[allow(unused_imports)]
115 use super::super::types::*;
116 #[allow(unused_imports)]
117 use derive_builder::Builder;
118 #[allow(unused_imports)]
119 use serde::{Deserialize, Serialize};
120 #[allow(unused_imports)]
121 use serde_json::Value as Json;
122}