Rewild Your Web
web
browser
dweb
1--- original
2+++ modified
3@@ -16,7 +16,7 @@
4 use url::Url;
5 use uuid::Uuid;
6
7-use crate::{InputMethodType, RgbColor};
8+use crate::{AllowOrDeny, InputMethodType, PermissionFeature, RgbColor};
9 #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
10 pub struct EmbedderControlId {
11 pub webview_id: WebViewId,
12@@ -24,7 +24,7 @@
13 pub index: Epoch,
14 }
15
16-#[derive(Debug, Deserialize, Serialize)]
17+#[derive(Clone, Debug, Deserialize, Serialize)]
18 pub enum EmbedderControlRequest {
19 /// Indicates that the user has activated a `<select>` element.
20 SelectElement(Vec<SelectElementOptionOrOptgroup>, Option<usize>),
21@@ -37,6 +37,8 @@
22 InputMethod(InputMethodRequest),
23 /// Indicates that the the user has triggered the display of a context menu.
24 ContextMenu(ContextMenuRequest),
25+ /// Indicates that a permission prompt should be shown to the user.
26+ PermissionPrompt(PermissionPromptRequest),
27 }
28
29 #[derive(Clone, Debug, Deserialize, Serialize)]
30@@ -61,7 +63,7 @@
31
32 /// Request to present a context menu to the user. This is triggered by things like
33 /// right-clicking on web content.
34-#[derive(Debug, Deserialize, Serialize)]
35+#[derive(Clone, Debug, Deserialize, Serialize)]
36 pub struct ContextMenuRequest {
37 pub element_info: ContextMenuElementInformation,
38 pub items: Vec<ContextMenuItem>,
39@@ -130,7 +132,7 @@
40 /// Request to present an IME to the user when an editable element is focused. If `type` is
41 /// [`InputMethodType::Text`], then the `text` parameter specifies the pre-existing text content and
42 /// `insertion_point` the zero-based index into the string of the insertion point.
43-#[derive(Debug, Deserialize, Serialize)]
44+#[derive(Clone, Debug, Deserialize, Serialize)]
45 pub struct InputMethodRequest {
46 pub input_method_type: InputMethodType,
47 pub text: String,
48@@ -143,7 +145,7 @@
49 #[derive(Clone, Debug, Deserialize, Serialize)]
50 pub struct FilterPattern(pub String);
51
52-#[derive(Debug, Deserialize, Serialize)]
53+#[derive(Clone, Debug, Deserialize, Serialize)]
54 pub struct FilePickerRequest {
55 pub origin: ImmutableOrigin,
56 pub current_paths: Vec<PathBuf>,
57@@ -152,6 +154,16 @@
58 pub accept_current_paths_for_testing: bool,
59 }
60
61+/// Request to show a permission prompt to the user. The response should be sent
62+/// via the included sender.
63+#[derive(Clone, Debug, Deserialize, Serialize)]
64+pub struct PermissionPromptRequest {
65+ /// The permission feature being requested.
66+ pub feature: PermissionFeature,
67+ /// A sender to use to respond to the permission request.
68+ pub response_sender: GenericSender<AllowOrDeny>,
69+}
70+
71 #[derive(Debug, Deserialize, Serialize)]
72 pub enum EmbedderControlResponse {
73 SelectElement(Option<usize>),
74@@ -158,6 +170,7 @@
75 ColorPicker(Option<RgbColor>),
76 FilePicker(Option<Vec<SelectedFile>>),
77 ContextMenu(Option<ContextMenuAction>),
78+ PermissionPrompt(AllowOrDeny),
79 }
80
81 /// Response to file selection request
82@@ -171,7 +184,7 @@
83 pub type_string: String,
84 }
85
86-#[derive(Deserialize, Serialize)]
87+#[derive(Clone, Debug, Deserialize, Serialize)]
88 pub enum SimpleDialogRequest {
89 Alert {
90 id: EmbedderControlId,