Skip to main content

rustenium_bidi_definitions/browsing_context/
events.rs

1use serde::{Deserialize, Serialize};
2#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3pub struct ContextCreatedParams {
4    #[serde(rename = "children")]
5    #[serde(skip_serializing_if = "Option::is_none")]
6    #[serde(default)]
7    pub children: Option<super::types::InfoList>,
8    #[serde(rename = "clientWindow")]
9    pub client_window: crate::browser::types::ClientWindow,
10    #[serde(rename = "context")]
11    pub context: super::types::BrowsingContext,
12    #[serde(rename = "originalOpener")]
13    #[serde(skip_serializing_if = "Option::is_none")]
14    #[serde(default)]
15    pub original_opener: Option<super::types::BrowsingContext>,
16    #[serde(rename = "url")]
17    pub url: String,
18    #[serde(rename = "userContext")]
19    pub user_context: crate::browser::types::UserContext,
20    #[serde(rename = "parent")]
21    #[serde(skip_serializing_if = "Option::is_none")]
22    #[serde(default)]
23    pub parent: Option<super::types::BrowsingContext>,
24}
25#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
26pub enum ContextCreatedMethod {
27    #[serde(rename = "browsingContext.contextCreated")]
28    ContextCreated,
29}
30#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
31pub struct ContextCreated {
32    pub method: ContextCreatedMethod,
33    pub params: ContextCreatedParams,
34}
35impl ContextCreated {
36    pub const IDENTIFIER: &'static str = "browsingContext.contextCreated";
37    pub const DOMAIN_DIRECTION: &'static str = "local";
38    pub fn identifier(&self) -> &'static str {
39        Self::IDENTIFIER
40    }
41}
42#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
43pub struct ContextDestroyedParams {
44    #[serde(rename = "children")]
45    #[serde(skip_serializing_if = "Option::is_none")]
46    #[serde(default)]
47    pub children: Option<super::types::InfoList>,
48    #[serde(rename = "clientWindow")]
49    pub client_window: crate::browser::types::ClientWindow,
50    #[serde(rename = "context")]
51    pub context: super::types::BrowsingContext,
52    #[serde(rename = "originalOpener")]
53    #[serde(skip_serializing_if = "Option::is_none")]
54    #[serde(default)]
55    pub original_opener: Option<super::types::BrowsingContext>,
56    #[serde(rename = "url")]
57    pub url: String,
58    #[serde(rename = "userContext")]
59    pub user_context: crate::browser::types::UserContext,
60    #[serde(rename = "parent")]
61    #[serde(skip_serializing_if = "Option::is_none")]
62    #[serde(default)]
63    pub parent: Option<super::types::BrowsingContext>,
64}
65#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
66pub enum ContextDestroyedMethod {
67    #[serde(rename = "browsingContext.contextDestroyed")]
68    ContextDestroyed,
69}
70#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
71pub struct ContextDestroyed {
72    pub method: ContextDestroyedMethod,
73    pub params: ContextDestroyedParams,
74}
75impl ContextDestroyed {
76    pub const IDENTIFIER: &'static str = "browsingContext.contextDestroyed";
77    pub const DOMAIN_DIRECTION: &'static str = "local";
78    pub fn identifier(&self) -> &'static str {
79        Self::IDENTIFIER
80    }
81}
82#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
83pub struct NavigationStartedParams {
84    #[serde(flatten)]
85    #[serde(default)]
86    pub base_navigation_info: super::types::BaseNavigationInfo,
87}
88#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
89pub enum NavigationStartedMethod {
90    #[serde(rename = "browsingContext.navigationStarted")]
91    NavigationStarted,
92}
93#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
94pub struct NavigationStarted {
95    pub method: NavigationStartedMethod,
96    pub params: NavigationStartedParams,
97}
98impl NavigationStarted {
99    pub const IDENTIFIER: &'static str = "browsingContext.navigationStarted";
100    pub const DOMAIN_DIRECTION: &'static str = "local";
101    pub fn identifier(&self) -> &'static str {
102        Self::IDENTIFIER
103    }
104}
105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
106pub struct FragmentNavigatedParams {
107    #[serde(flatten)]
108    #[serde(default)]
109    pub base_navigation_info: super::types::BaseNavigationInfo,
110}
111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
112pub enum FragmentNavigatedMethod {
113    #[serde(rename = "browsingContext.fragmentNavigated")]
114    FragmentNavigated,
115}
116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
117pub struct FragmentNavigated {
118    pub method: FragmentNavigatedMethod,
119    pub params: FragmentNavigatedParams,
120}
121impl FragmentNavigated {
122    pub const IDENTIFIER: &'static str = "browsingContext.fragmentNavigated";
123    pub const DOMAIN_DIRECTION: &'static str = "local";
124    pub fn identifier(&self) -> &'static str {
125        Self::IDENTIFIER
126    }
127}
128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
129pub struct HistoryUpdatedParams {
130    #[serde(rename = "context")]
131    pub context: super::types::BrowsingContext,
132    #[serde(rename = "timestamp")]
133    pub timestamp: u64,
134    #[serde(rename = "url")]
135    pub url: String,
136}
137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
138pub enum HistoryUpdatedMethod {
139    #[serde(rename = "browsingContext.historyUpdated")]
140    HistoryUpdated,
141}
142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
143pub struct HistoryUpdated {
144    pub method: HistoryUpdatedMethod,
145    pub params: HistoryUpdatedParams,
146}
147impl HistoryUpdated {
148    pub const IDENTIFIER: &'static str = "browsingContext.historyUpdated";
149    pub const DOMAIN_DIRECTION: &'static str = "local";
150    pub fn identifier(&self) -> &'static str {
151        Self::IDENTIFIER
152    }
153}
154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
155pub struct DomContentLoadedParams {
156    #[serde(flatten)]
157    #[serde(default)]
158    pub base_navigation_info: super::types::BaseNavigationInfo,
159}
160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
161pub enum DomContentLoadedMethod {
162    #[serde(rename = "browsingContext.domContentLoaded")]
163    DomContentLoaded,
164}
165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
166pub struct DomContentLoaded {
167    pub method: DomContentLoadedMethod,
168    pub params: DomContentLoadedParams,
169}
170impl DomContentLoaded {
171    pub const IDENTIFIER: &'static str = "browsingContext.domContentLoaded";
172    pub const DOMAIN_DIRECTION: &'static str = "local";
173    pub fn identifier(&self) -> &'static str {
174        Self::IDENTIFIER
175    }
176}
177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
178pub struct LoadParams {
179    #[serde(flatten)]
180    #[serde(default)]
181    pub base_navigation_info: super::types::BaseNavigationInfo,
182}
183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
184pub enum LoadMethod {
185    #[serde(rename = "browsingContext.load")]
186    Load,
187}
188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
189pub struct Load {
190    pub method: LoadMethod,
191    pub params: LoadParams,
192}
193impl Load {
194    pub const IDENTIFIER: &'static str = "browsingContext.load";
195    pub const DOMAIN_DIRECTION: &'static str = "local";
196    pub fn identifier(&self) -> &'static str {
197        Self::IDENTIFIER
198    }
199}
200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
201pub struct DownloadWillBeginParams {
202    #[serde(rename = "suggestedFilename")]
203    pub suggested_filename: String,
204    #[serde(flatten)]
205    #[serde(default)]
206    pub base_navigation_info: super::types::BaseNavigationInfo,
207}
208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
209pub enum DownloadWillBeginMethod {
210    #[serde(rename = "browsingContext.downloadWillBegin")]
211    DownloadWillBegin,
212}
213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
214pub struct DownloadWillBegin {
215    pub method: DownloadWillBeginMethod,
216    pub params: DownloadWillBeginParams,
217}
218impl DownloadWillBegin {
219    pub const IDENTIFIER: &'static str = "browsingContext.downloadWillBegin";
220    pub const DOMAIN_DIRECTION: &'static str = "local";
221    pub fn identifier(&self) -> &'static str {
222        Self::IDENTIFIER
223    }
224}
225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
226pub struct DownloadEndParams {
227    #[serde(flatten)]
228    #[serde(default)]
229    pub download_canceled_params_download_complete_params_union:
230        super::types::DownloadCanceledParamsDownloadCompleteParamsUnion,
231}
232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
233pub enum DownloadEndMethod {
234    #[serde(rename = "browsingContext.downloadEnd")]
235    DownloadEnd,
236}
237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
238pub struct DownloadEnd {
239    pub method: DownloadEndMethod,
240    pub params: DownloadEndParams,
241}
242impl DownloadEnd {
243    pub const IDENTIFIER: &'static str = "browsingContext.downloadEnd";
244    pub const DOMAIN_DIRECTION: &'static str = "local";
245    pub fn identifier(&self) -> &'static str {
246        Self::IDENTIFIER
247    }
248}
249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
250pub struct NavigationAbortedParams {
251    #[serde(flatten)]
252    #[serde(default)]
253    pub base_navigation_info: super::types::BaseNavigationInfo,
254}
255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
256pub enum NavigationAbortedMethod {
257    #[serde(rename = "browsingContext.navigationAborted")]
258    NavigationAborted,
259}
260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
261pub struct NavigationAborted {
262    pub method: NavigationAbortedMethod,
263    pub params: NavigationAbortedParams,
264}
265impl NavigationAborted {
266    pub const IDENTIFIER: &'static str = "browsingContext.navigationAborted";
267    pub const DOMAIN_DIRECTION: &'static str = "local";
268    pub fn identifier(&self) -> &'static str {
269        Self::IDENTIFIER
270    }
271}
272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
273pub struct NavigationCommittedParams {
274    #[serde(flatten)]
275    #[serde(default)]
276    pub base_navigation_info: super::types::BaseNavigationInfo,
277}
278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
279pub enum NavigationCommittedMethod {
280    #[serde(rename = "browsingContext.navigationCommitted")]
281    NavigationCommitted,
282}
283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
284pub struct NavigationCommitted {
285    pub method: NavigationCommittedMethod,
286    pub params: NavigationCommittedParams,
287}
288impl NavigationCommitted {
289    pub const IDENTIFIER: &'static str = "browsingContext.navigationCommitted";
290    pub const DOMAIN_DIRECTION: &'static str = "local";
291    pub fn identifier(&self) -> &'static str {
292        Self::IDENTIFIER
293    }
294}
295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
296pub struct NavigationFailedParams {
297    #[serde(flatten)]
298    #[serde(default)]
299    pub base_navigation_info: super::types::BaseNavigationInfo,
300}
301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
302pub enum NavigationFailedMethod {
303    #[serde(rename = "browsingContext.navigationFailed")]
304    NavigationFailed,
305}
306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
307pub struct NavigationFailed {
308    pub method: NavigationFailedMethod,
309    pub params: NavigationFailedParams,
310}
311impl NavigationFailed {
312    pub const IDENTIFIER: &'static str = "browsingContext.navigationFailed";
313    pub const DOMAIN_DIRECTION: &'static str = "local";
314    pub fn identifier(&self) -> &'static str {
315        Self::IDENTIFIER
316    }
317}
318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
319pub struct UserPromptClosedParams {
320    #[serde(rename = "context")]
321    pub context: super::types::BrowsingContext,
322    #[serde(rename = "accepted")]
323    pub accepted: bool,
324    #[serde(rename = "type")]
325    pub r#type: super::types::UserPromptType,
326    #[serde(rename = "userText")]
327    #[serde(skip_serializing_if = "Option::is_none")]
328    #[serde(default)]
329    pub user_text: Option<String>,
330}
331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
332pub enum UserPromptClosedMethod {
333    #[serde(rename = "browsingContext.userPromptClosed")]
334    UserPromptClosed,
335}
336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
337pub struct UserPromptClosed {
338    pub method: UserPromptClosedMethod,
339    pub params: UserPromptClosedParams,
340}
341impl UserPromptClosed {
342    pub const IDENTIFIER: &'static str = "browsingContext.userPromptClosed";
343    pub const DOMAIN_DIRECTION: &'static str = "local";
344    pub fn identifier(&self) -> &'static str {
345        Self::IDENTIFIER
346    }
347}
348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
349pub struct UserPromptOpenedParams {
350    #[serde(rename = "context")]
351    pub context: super::types::BrowsingContext,
352    #[serde(rename = "handler")]
353    pub handler: crate::session::types::UserPromptHandlerType,
354    #[serde(rename = "message")]
355    pub message: String,
356    #[serde(rename = "type")]
357    pub r#type: super::types::UserPromptType,
358    #[serde(rename = "defaultValue")]
359    #[serde(skip_serializing_if = "Option::is_none")]
360    #[serde(default)]
361    pub default_value: Option<String>,
362}
363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
364pub enum UserPromptOpenedMethod {
365    #[serde(rename = "browsingContext.userPromptOpened")]
366    UserPromptOpened,
367}
368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
369pub struct UserPromptOpened {
370    pub method: UserPromptOpenedMethod,
371    pub params: UserPromptOpenedParams,
372}
373impl UserPromptOpened {
374    pub const IDENTIFIER: &'static str = "browsingContext.userPromptOpened";
375    pub const DOMAIN_DIRECTION: &'static str = "local";
376    pub fn identifier(&self) -> &'static str {
377        Self::IDENTIFIER
378    }
379}
380group_enum ! (BrowsingContextEvent { ContextCreated (ContextCreated) , ContextDestroyed (ContextDestroyed) , NavigationStarted (NavigationStarted) , FragmentNavigated (FragmentNavigated) , HistoryUpdated (HistoryUpdated) , DomContentLoaded (DomContentLoaded) , Load (Load) , DownloadWillBegin (DownloadWillBegin) , DownloadEnd (DownloadEnd) , NavigationAborted (NavigationAborted) , NavigationCommitted (NavigationCommitted) , NavigationFailed (NavigationFailed) , UserPromptClosed (UserPromptClosed) , UserPromptOpened (UserPromptOpened) } + identifiable);