use serde::{Deserialize, Serialize};
#[doc = "Upsert. Currently, it is only emitted when a rule set added.\n[ruleSetUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-ruleSetUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RuleSetUpdatedParams {
#[serde(rename = "ruleSet")]
pub rule_set: super::types::RuleSet,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RuleSetUpdatedMethod {
#[serde(rename = "Preload.ruleSetUpdated")]
RuleSetUpdated,
}
#[doc = "Upsert. Currently, it is only emitted when a rule set added.\n[ruleSetUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-ruleSetUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RuleSetUpdated {
pub method: RuleSetUpdatedMethod,
pub params: RuleSetUpdatedParams,
}
impl RuleSetUpdated {
pub const IDENTIFIER: &'static str = "Preload.ruleSetUpdated";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RuleSetRemovedParams {
#[serde(rename = "id")]
pub id: super::types::RuleSetId,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RuleSetRemovedMethod {
#[serde(rename = "Preload.ruleSetRemoved")]
RuleSetRemoved,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RuleSetRemoved {
pub method: RuleSetRemovedMethod,
pub params: RuleSetRemovedParams,
}
impl RuleSetRemoved {
pub const IDENTIFIER: &'static str = "Preload.ruleSetRemoved";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
#[doc = "Fired when a preload enabled state is updated.\n[preloadEnabledStateUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-preloadEnabledStateUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PreloadEnabledStateUpdatedParams {
#[serde(rename = "disabledByPreference")]
pub disabled_by_preference: bool,
#[serde(rename = "disabledByDataSaver")]
pub disabled_by_data_saver: bool,
#[serde(rename = "disabledByBatterySaver")]
pub disabled_by_battery_saver: bool,
#[serde(rename = "disabledByHoldbackPrefetchSpeculationRules")]
pub disabled_by_holdback_prefetch_speculation_rules: bool,
#[serde(rename = "disabledByHoldbackPrerenderSpeculationRules")]
pub disabled_by_holdback_prerender_speculation_rules: bool,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum PreloadEnabledStateUpdatedMethod {
#[serde(rename = "Preload.preloadEnabledStateUpdated")]
PreloadEnabledStateUpdated,
}
#[doc = "Fired when a preload enabled state is updated.\n[preloadEnabledStateUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-preloadEnabledStateUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PreloadEnabledStateUpdated {
pub method: PreloadEnabledStateUpdatedMethod,
pub params: PreloadEnabledStateUpdatedParams,
}
impl PreloadEnabledStateUpdated {
pub const IDENTIFIER: &'static str = "Preload.preloadEnabledStateUpdated";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
#[doc = "Fired when a prefetch attempt is updated.\n[prefetchStatusUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-prefetchStatusUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PrefetchStatusUpdatedParams {
#[serde(rename = "key")]
pub key: super::types::PreloadingAttemptKey,
#[serde(rename = "pipelineId")]
pub pipeline_id: super::types::PreloadPipelineId,
#[doc = "The frame id of the frame initiating prefetch."]
#[serde(rename = "initiatingFrameId")]
pub initiating_frame_id: crate::browser_protocol::page::types::FrameId,
#[serde(rename = "prefetchUrl")]
pub prefetch_url: String,
#[serde(rename = "status")]
pub status: super::types::PreloadingStatus,
#[serde(rename = "prefetchStatus")]
pub prefetch_status: super::types::PrefetchStatus,
#[serde(rename = "requestId")]
pub request_id: crate::browser_protocol::network::types::RequestId,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum PrefetchStatusUpdatedMethod {
#[serde(rename = "Preload.prefetchStatusUpdated")]
PrefetchStatusUpdated,
}
#[doc = "Fired when a prefetch attempt is updated.\n[prefetchStatusUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-prefetchStatusUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PrefetchStatusUpdated {
pub method: PrefetchStatusUpdatedMethod,
pub params: PrefetchStatusUpdatedParams,
}
impl PrefetchStatusUpdated {
pub const IDENTIFIER: &'static str = "Preload.prefetchStatusUpdated";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
#[doc = "Fired when a prerender attempt is updated.\n[prerenderStatusUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-prerenderStatusUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PrerenderStatusUpdatedParams {
#[serde(rename = "key")]
pub key: super::types::PreloadingAttemptKey,
#[serde(rename = "pipelineId")]
pub pipeline_id: super::types::PreloadPipelineId,
#[serde(rename = "status")]
pub status: super::types::PreloadingStatus,
#[serde(rename = "prerenderStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub prerender_status: Option<super::types::PrerenderFinalStatus>,
#[doc = "This is used to give users more information about the name of Mojo interface\nthat is incompatible with prerender and has caused the cancellation of the attempt."]
#[serde(rename = "disallowedMojoInterface")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub disallowed_mojo_interface: Option<String>,
#[serde(rename = "mismatchedHeaders")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub mismatched_headers: Option<Vec<super::types::PrerenderMismatchedHeaders>>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum PrerenderStatusUpdatedMethod {
#[serde(rename = "Preload.prerenderStatusUpdated")]
PrerenderStatusUpdated,
}
#[doc = "Fired when a prerender attempt is updated.\n[prerenderStatusUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-prerenderStatusUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PrerenderStatusUpdated {
pub method: PrerenderStatusUpdatedMethod,
pub params: PrerenderStatusUpdatedParams,
}
impl PrerenderStatusUpdated {
pub const IDENTIFIER: &'static str = "Preload.prerenderStatusUpdated";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
#[doc = "Send a list of sources for all preloading attempts in a document.\n[preloadingAttemptSourcesUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-preloadingAttemptSourcesUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PreloadingAttemptSourcesUpdatedParams {
#[serde(rename = "loaderId")]
pub loader_id: crate::browser_protocol::network::types::LoaderId,
#[serde(rename = "preloadingAttemptSources")]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub preloading_attempt_sources: Vec<super::types::PreloadingAttemptSource>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum PreloadingAttemptSourcesUpdatedMethod {
#[serde(rename = "Preload.preloadingAttemptSourcesUpdated")]
PreloadingAttemptSourcesUpdated,
}
#[doc = "Send a list of sources for all preloading attempts in a document.\n[preloadingAttemptSourcesUpdated](https://chromedevtools.github.io/devtools-protocol/tot/Preload/#event-preloadingAttemptSourcesUpdated)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PreloadingAttemptSourcesUpdated {
pub method: PreloadingAttemptSourcesUpdatedMethod,
pub params: PreloadingAttemptSourcesUpdatedParams,
}
impl PreloadingAttemptSourcesUpdated {
pub const IDENTIFIER: &'static str = "Preload.preloadingAttemptSourcesUpdated";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
group_enum ! (PreloadEvents { RuleSetUpdated (RuleSetUpdated) , RuleSetRemoved (RuleSetRemoved) , PreloadEnabledStateUpdated (PreloadEnabledStateUpdated) , PrefetchStatusUpdated (PrefetchStatusUpdated) , PrerenderStatusUpdated (PrerenderStatusUpdated) , PreloadingAttemptSourcesUpdated (PreloadingAttemptSourcesUpdated) } + identifiable);