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 cookie::Cookie;
8use embedder_traits::{
9    AuthenticationResponse, EmbedderControlId, FilePickerRequest, WebResourceRequest,
10    WebResourceResponseMsg,
11};
12use net_traits::CookieOperationId;
13use servo_base::id::WebViewId;
14use servo_url::ServoUrl;
15use tokio::sync::mpsc::UnboundedSender as TokioSender;
16use tokio::sync::oneshot::Sender as TokioOneshotSender;
17
18/// Messages sent from the network threads to the embedder.
19pub enum NetToEmbedderMsg {
20    /// Open file dialog to select files. Set boolean flag to true allows to select multiple files.
21    SelectFiles(
22        EmbedderControlId,
23        FilePickerRequest,
24        TokioOneshotSender<Option<Vec<PathBuf>>>,
25    ),
26    WebResourceRequested(
27        Option<WebViewId>,
28        WebResourceRequest,
29        TokioSender<WebResourceResponseMsg>,
30    ),
31    /// Request authentication for a load or navigation from the embedder.
32    RequestAuthentication(
33        WebViewId,
34        ServoUrl,
35        bool, /* for proxy */
36        TokioOneshotSender<Option<AuthenticationResponse>>,
37    ),
38    /// Response to a [`CoreResourceMsg::EmbedderGetCookiesForUrl`] request.
39    EmbedderGetCookiesForUrlResponse(CookieOperationId, Vec<Cookie<'static>>),
40    /// Response to a [`CoreResourceMsg::EmbedderSetCookieForUrl`] request.
41    EmbedderSetCookieForUrlResponse(CookieOperationId),
42}