net/
embedder.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use std::path::PathBuf;
6
7use base::id::WebViewId;
8use embedder_traits::{
9    AuthenticationResponse, EmbedderControlId, FilePickerRequest, WebResourceRequest,
10    WebResourceResponseMsg,
11};
12use servo_url::ServoUrl;
13use tokio::sync::mpsc::UnboundedSender as TokioSender;
14use tokio::sync::oneshot::Sender as TokioOneshotSender;
15
16/// Messages sent from the network threads to the embedder.
17pub enum NetToEmbedderMsg {
18    /// Open file dialog to select files. Set boolean flag to true allows to select multiple files.
19    SelectFiles(
20        EmbedderControlId,
21        FilePickerRequest,
22        TokioOneshotSender<Option<Vec<PathBuf>>>,
23    ),
24    WebResourceRequested(
25        Option<WebViewId>,
26        WebResourceRequest,
27        TokioSender<WebResourceResponseMsg>,
28    ),
29    /// Request authentication for a load or navigation from the embedder.
30    RequestAuthentication(
31        WebViewId,
32        ServoUrl,
33        bool, /* for proxy */
34        TokioOneshotSender<Option<AuthenticationResponse>>,
35    ),
36}