mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
libservo: Add a delegate method for HTTP authentication (#35400)
Add a delegate method for HTTP authentication and a related `AuthenticationRequest` object that carries with it the URL as well as whether or not the authentication request is for a proxy or not. This is now separate from the prompt API because requesting authentication doesn't necessarily involve prompting -- this is an implementation detail of the embedder. In addition, the internal bits are cleaned up slightly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
118a813dba
commit
8486e585f5
9 changed files with 149 additions and 103 deletions
|
@ -116,16 +116,14 @@ pub enum PromptDefinition {
|
|||
OkCancel(String, IpcSender<PromptResult>),
|
||||
/// Ask the user to enter text.
|
||||
Input(String, String, IpcSender<Option<String>>),
|
||||
/// Ask user to enter their username and password
|
||||
Credentials(IpcSender<PromptCredentialsInput>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||
pub struct PromptCredentialsInput {
|
||||
pub struct AuthenticationResponse {
|
||||
/// Username for http request authentication
|
||||
pub username: Option<String>,
|
||||
pub username: String,
|
||||
/// Password for http request authentication
|
||||
pub password: Option<String>,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, PartialEq, Serialize)]
|
||||
|
@ -166,6 +164,13 @@ pub enum EmbedderMsg {
|
|||
ResizeTo(WebViewId, DeviceIntSize),
|
||||
/// Show dialog to user
|
||||
Prompt(WebViewId, PromptDefinition, PromptOrigin),
|
||||
/// Request authentication for a load or navigation from the embedder.
|
||||
RequestAuthentication(
|
||||
WebViewId,
|
||||
ServoUrl,
|
||||
bool, /* for proxy */
|
||||
IpcSender<Option<AuthenticationResponse>>,
|
||||
),
|
||||
/// Show a context menu to the user
|
||||
ShowContextMenu(
|
||||
WebViewId,
|
||||
|
@ -278,6 +283,7 @@ impl Debug for EmbedderMsg {
|
|||
EmbedderMsg::MoveTo(..) => write!(f, "MoveTo"),
|
||||
EmbedderMsg::ResizeTo(..) => write!(f, "ResizeTo"),
|
||||
EmbedderMsg::Prompt(..) => write!(f, "Prompt"),
|
||||
EmbedderMsg::RequestAuthentication(..) => write!(f, "RequestAuthentication"),
|
||||
EmbedderMsg::AllowUnload(..) => write!(f, "AllowUnload"),
|
||||
EmbedderMsg::AllowNavigationRequest(..) => write!(f, "AllowNavigationRequest"),
|
||||
EmbedderMsg::Keyboard(..) => write!(f, "Keyboard"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue