1use crate::data::download::{
4 ChromeDownloadId, ChromeDownloadPromptReason, ChromeDownloadPromptResult,
5};
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum PromptUiPermissionType {
10 Geolocation,
11 Notifications,
12 AudioCapture,
13 VideoCapture,
14 Unknown,
15}
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
19pub struct PromptUiId(u64);
20
21impl PromptUiId {
22 pub const fn new(value: u64) -> Self {
23 Self(value)
24 }
25
26 pub const fn get(self) -> u64 {
27 self.0
28 }
29}
30
31#[derive(Debug, Clone, PartialEq, Eq)]
33pub enum PromptUiKind {
34 PermissionPrompt {
35 permission: PromptUiPermissionType,
36 permission_key: Option<String>,
37 },
38 DownloadPrompt {
39 download_id: ChromeDownloadId,
40 file_name: String,
41 total_bytes: Option<u64>,
42 suggested_path: Option<String>,
43 reason: ChromeDownloadPromptReason,
44 },
45 ExtensionInstallPrompt {
46 extension_id: String,
47 extension_name: String,
48 permission_names: Vec<String>,
49 },
50 ExtensionUninstallPrompt {
51 extension_id: String,
52 extension_name: String,
53 triggering_extension_name: Option<String>,
54 can_report_abuse: bool,
55 },
56 PrintPreviewDialog,
57 Unknown,
58}
59
60#[derive(Debug, Clone, PartialEq, Eq)]
62pub enum PromptUiResponse {
63 PermissionPrompt {
64 allow: bool,
65 },
66 DownloadPrompt {
67 allow: bool,
68 destination_path: Option<String>,
69 },
70 ExtensionInstallPrompt {
71 proceed: bool,
72 },
73 ExtensionUninstallPrompt {
74 proceed: bool,
75 report_abuse: bool,
76 },
77 PrintPreviewDialog {
78 proceed: bool,
79 },
80 Unknown,
81}
82
83#[derive(Debug, Clone, Copy, PartialEq, Eq)]
85pub enum PromptUiExtensionInstallResult {
86 Accepted,
87 AcceptedWithWithheldPermissions,
88 UserCanceled,
89 Aborted,
90}
91
92#[derive(Debug, Clone, Copy, PartialEq, Eq)]
94pub enum PromptUiExtensionUninstallResult {
95 Accepted,
96 UserCanceled,
97 Aborted,
98 Failed,
99}
100
101#[derive(Debug, Clone, Copy, PartialEq, Eq)]
103pub enum PromptUiResolutionResult {
104 Allowed,
105 Denied,
106 Aborted,
107 Unknown,
108}
109
110#[derive(Debug, Clone, Copy, PartialEq, Eq)]
112pub enum PromptUiDialogResult {
113 Proceeded,
114 Canceled,
115 Aborted,
116 Unknown,
117}
118
119#[derive(Debug, Clone, PartialEq, Eq)]
121pub enum PromptUiResolution {
122 PermissionPrompt {
123 permission: PromptUiPermissionType,
124 permission_key: Option<String>,
125 result: PromptUiResolutionResult,
126 },
127 DownloadPrompt {
128 download_id: ChromeDownloadId,
129 destination_path: Option<String>,
130 result: ChromeDownloadPromptResult,
131 },
132 ExtensionInstallPrompt {
133 extension_id: String,
134 result: PromptUiExtensionInstallResult,
135 detail: Option<String>,
136 },
137 ExtensionUninstallPrompt {
138 extension_id: String,
139 result: PromptUiExtensionUninstallResult,
140 detail: Option<String>,
141 report_abuse: bool,
142 },
143 PrintPreviewDialog {
144 result: PromptUiDialogResult,
145 },
146 Unknown,
147}
148
149#[derive(Debug, Clone, Copy, PartialEq, Eq)]
151pub enum PromptUiCloseReason {
152 UserCanceled,
153 HostForced,
154 SystemDismissed,
155 Unknown,
156}