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
use cursor_icon::CursorIcon;
use cbf::data::dialog::DialogType;
use cbf::data::drag::DragOperation;
use crate::data::{
choice_menu::ChromeChoiceMenu,
context_menu::ChromeContextMenu,
custom_scheme::ChromeCustomSchemeRequest,
download::{ChromeDownloadCompletion, ChromeDownloadProgress, ChromeDownloadSnapshot},
drag::ChromeDragStartRequest,
extension::ChromeExtensionInfo,
find::ChromeFindRect,
ids::{PopupId, TabId},
ime::ChromeImeBoundsUpdate,
ipc::{TabIpcErrorCode, TabIpcMessageType, TabIpcPayload},
lifecycle::ChromeBeforeUnloadReason,
navigation::{ChromeNavigationEntryId, ChromeNavigationHistorySnapshot, ChromeNavigationKind},
prompt_ui::{PromptUiCloseReason, PromptUiId, PromptUiKind, PromptUiResolution},
surface::SurfaceHandle,
tab_open::{TabOpenHint, TabOpenResult},
};
/// Low-level IPC events emitted by the Chromium bridge.
#[derive(Debug, Clone, PartialEq)]
pub enum IpcEvent {
/// The rendering surface handle for a page was updated.
///
/// **Note**: This event does not map to `BrowserEvent` because surface handles
/// are a Chrome-specific rendering implementation detail. Applications needing
/// this information should subscribe to the raw `ChromeEvent` stream.
SurfaceHandleUpdated {
profile_id: String,
browsing_context_id: TabId,
handle: SurfaceHandle,
},
/// An extension action popup lifecycle started.
ExtensionPopupOpened {
profile_id: String,
browsing_context_id: TabId,
popup_id: u64,
extension_id: String,
title: String,
},
/// The rendering surface handle for an extension popup was updated.
ExtensionPopupSurfaceHandleUpdated {
profile_id: String,
browsing_context_id: TabId,
popup_id: u64,
handle: SurfaceHandle,
},
/// The effective popup size changed after Chromium-side clamping.
ExtensionPopupPreferredSizeChanged {
profile_id: String,
browsing_context_id: TabId,
popup_id: u64,
width: u32,
height: u32,
},
/// A context menu was requested for an extension popup.
ExtensionPopupContextMenuRequested {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
menu: ChromeContextMenu,
},
/// A host-owned choice menu was requested for an extension popup.
ExtensionPopupChoiceMenuRequested {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
request_id: u64,
menu: ChromeChoiceMenu,
},
/// The cursor appearance changed for an extension popup.
ExtensionPopupCursorChanged {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
cursor_type: CursorIcon,
},
/// The title changed for an extension popup.
ExtensionPopupTitleUpdated {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
title: String,
},
/// A JavaScript dialog was requested for an extension popup.
ExtensionPopupJavaScriptDialogRequested {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
request_id: u64,
r#type: DialogType,
message: String,
default_prompt_text: Option<String>,
reason: ChromeBeforeUnloadReason,
},
/// The extension popup requested to close.
ExtensionPopupCloseRequested {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
},
/// The extension popup renderer exited or crashed.
ExtensionPopupRenderProcessGone {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
crashed: bool,
},
/// An extension action popup closed.
ExtensionPopupClosed {
profile_id: String,
browsing_context_id: TabId,
popup_id: u64,
},
/// A new tab was created by the backend.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::Created`.
TabCreated {
profile_id: String,
browsing_context_id: TabId,
request_id: u64,
},
/// DevTools was opened for a page.
///
/// **Note**: This event does not map to `BrowserEvent` because DevTools is
/// currently exposed via the Chrome-specific raw event stream only.
DevToolsOpened {
profile_id: String,
browsing_context_id: TabId,
inspected_browsing_context_id: TabId,
},
/// IME bounds information changed.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::ImeBoundsUpdated`.
ImeBoundsUpdated {
profile_id: String,
browsing_context_id: TabId,
update: ChromeImeBoundsUpdate,
},
/// IME bounds information changed for an extension popup.
///
/// Maps to `BrowserEvent::TransientBrowsingContext` with
/// `TransientBrowsingContextEvent::ImeBoundsUpdated`.
ExtensionPopupImeBoundsUpdated {
profile_id: String,
browsing_context_id: TabId,
popup_id: PopupId,
update: ChromeImeBoundsUpdate,
},
/// The backend requested a context menu.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::ContextMenuRequested`.
ContextMenuRequested {
profile_id: String,
browsing_context_id: TabId,
menu: ChromeContextMenu,
},
/// The backend requested a host-owned choice menu.
ChoiceMenuRequested {
profile_id: String,
browsing_context_id: TabId,
request_id: u64,
menu: ChromeChoiceMenu,
},
/// Host-mediated open request for tab.
///
/// Maps to `BrowserEvent::BrowsingContextOpenRequested`.
TabOpenRequested {
profile_id: String,
request_id: u64,
source_tab_id: Option<TabId>,
target_url: String,
open_hint: TabOpenHint,
user_gesture: bool,
},
/// Result for host-mediated open request.
///
/// Maps to `BrowserEvent::BrowsingContextOpenResolved`.
TabOpenResolved {
profile_id: String,
request_id: u64,
result: TabOpenResult,
},
/// Navigation state changed for a page.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::NavigationStateChanged`.
NavigationStateChanged {
profile_id: String,
browsing_context_id: TabId,
url: String,
can_go_back: bool,
can_go_forward: bool,
is_loading: bool,
current_entry_id: ChromeNavigationEntryId,
current_index: usize,
navigation_kind: ChromeNavigationKind,
},
/// Navigation history snapshot for a page.
///
/// Maps to `BrowserEvent::BrowsingContext` with
/// `BrowsingContextEvent::NavigationHistorySnapshot`.
NavigationHistorySnapshot {
profile_id: String,
browsing_context_id: TabId,
snapshot: ChromeNavigationHistorySnapshot,
},
/// Cursor appearance changed for a page.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::CursorChanged`.
CursorChanged {
profile_id: String,
browsing_context_id: TabId,
cursor_type: CursorIcon,
},
/// The page title changed for a page.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::TitleUpdated`.
TitleUpdated {
profile_id: String,
browsing_context_id: TabId,
title: String,
},
/// The page favicon URL changed for a page.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::FaviconUrlUpdated`.
FaviconUrlUpdated {
profile_id: String,
browsing_context_id: TabId,
url: String,
},
/// A beforeunload dialog was requested.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::JavaScriptDialogRequested`
/// with `DialogType::BeforeUnload`.
BeforeUnloadDialogRequested {
profile_id: String,
browsing_context_id: TabId,
request_id: u64,
reason: ChromeBeforeUnloadReason,
},
/// A JavaScript dialog was requested for a tab.
JavaScriptDialogRequested {
profile_id: String,
browsing_context_id: TabId,
request_id: u64,
r#type: DialogType,
message: String,
default_prompt_text: Option<String>,
reason: ChromeBeforeUnloadReason,
},
/// A tab closed event was observed.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::Closed`.
TabClosed {
profile_id: String,
browsing_context_id: TabId,
},
/// A resize acknowledgement was received for a page.
///
/// **Note**: This event does not map to `BrowserEvent` because it is an internal
/// acknowledgement with no semantic value for browser-generic consumers.
TabResizeAcknowledged {
profile_id: String,
browsing_context_id: TabId,
},
/// The DOM HTML was read for a page.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::DomHtmlRead`.
TabDomHtmlRead {
profile_id: String,
browsing_context_id: TabId,
request_id: u64,
html: String,
},
/// Find-in-page result for a tab.
///
/// **Note**: This event does not map to `BrowserEvent` because it carries
/// Chromium-specific selection geometry and partial-update semantics.
FindReply {
profile_id: String,
browsing_context_id: TabId,
request_id: u64,
number_of_matches: u32,
active_match_ordinal: i32,
selection_rect: ChromeFindRect,
final_update: bool,
},
/// Browsing context IPC message from page to host.
TabIpcMessageReceived {
profile_id: String,
browsing_context_id: TabId,
channel: String,
message_type: TabIpcMessageType,
request_id: u64,
payload: TabIpcPayload,
content_type: Option<String>,
error_code: Option<TabIpcErrorCode>,
},
/// Host-owned drag start request from renderer.
///
/// Maps to `BrowserEvent::BrowsingContext` with `BrowsingContextEvent::DragStartRequested`.
DragStartRequested {
profile_id: String,
browsing_context_id: TabId,
request: ChromeDragStartRequest,
},
/// Negotiated operation for the active external drag changed.
ExternalDragOperationChanged {
profile_id: String,
browsing_context_id: TabId,
operation: DragOperation,
},
/// Shutdown is blocked by a browsing context that requested confirmation.
///
/// Maps to `BrowserEvent::ShutdownBlocked`.
ShutdownBlocked {
request_id: u64,
dirty_browsing_context_id: TabId,
},
/// Shutdown has started.
///
/// Maps to `BrowserEvent::ShutdownProceeding`.
ShutdownProceeding { request_id: u64 },
/// Shutdown was cancelled.
///
/// Maps to `BrowserEvent::ShutdownCancelled`.
ShutdownCancelled { request_id: u64 },
/// A close transaction is blocked by a browsing context that requested confirmation.
CloseBrowsingContextsTransactionBlocked {
profile_id: String,
request_id: u64,
dirty_browsing_context_id: TabId,
},
/// A close transaction completed non-destructive checks.
CloseBrowsingContextsTransactionReady { profile_id: String, request_id: u64 },
/// A close transaction started closing prepared tabs.
CloseBrowsingContextsTransactionProceeding { profile_id: String, request_id: u64 },
/// A close transaction was cancelled before commit.
CloseBrowsingContextsTransactionCancelled { profile_id: String, request_id: u64 },
/// A close transaction finished closing all prepared tabs.
CloseBrowsingContextsTransactionCompleted { profile_id: String, request_id: u64 },
/// Installed extensions were listed for a profile.
///
/// Maps to `BrowserEvent::ExtensionsListed`.
ExtensionsListed {
profile_id: String,
extensions: Vec<ChromeExtensionInfo>,
},
/// Prompt UI open was requested and host must choose flow.
PromptUiOpenRequested {
profile_id: String,
source_tab_id: Option<TabId>,
request_id: u64,
kind: PromptUiKind,
},
/// Prompt UI request was resolved.
PromptUiResolved {
profile_id: String,
source_tab_id: Option<TabId>,
request_id: u64,
resolution: PromptUiResolution,
},
/// A registered custom scheme request requires a host response.
CustomSchemeRequestReceived { request: ChromeCustomSchemeRequest },
/// Non-fatal extension runtime warning.
///
/// Maps to `BrowsingContextEvent::ExtensionRuntimeWarning`.
ExtensionRuntimeWarning {
profile_id: String,
browsing_context_id: TabId,
detail: String,
},
/// Backend-managed prompt UI surface was opened.
PromptUiOpened {
profile_id: String,
source_tab_id: Option<TabId>,
prompt_ui_id: PromptUiId,
kind: PromptUiKind,
title: Option<String>,
modal: bool,
},
/// Backend-managed prompt UI surface was closed.
PromptUiClosed {
profile_id: String,
source_tab_id: Option<TabId>,
prompt_ui_id: PromptUiId,
kind: PromptUiKind,
reason: PromptUiCloseReason,
},
/// Download lifecycle became visible to the host.
DownloadCreated {
profile_id: String,
download: ChromeDownloadSnapshot,
},
/// Download state changed.
DownloadUpdated {
profile_id: String,
download: ChromeDownloadProgress,
},
/// Download reached a terminal state.
DownloadCompleted {
profile_id: String,
download: ChromeDownloadCompletion,
},
}