diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp index 6f0c3707e..8e2e72561 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp @@ -67,18 +67,35 @@ struct _WebKitAuthenticationRequestPrivate { static guint signals[LAST_SIGNAL] = { 0, }; -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_DEFAULT, ProtectionSpaceAuthenticationSchemeDefault); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC, ProtectionSpaceAuthenticationSchemeHTTPBasic); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_HTTP_DIGEST, ProtectionSpaceAuthenticationSchemeHTTPDigest); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_HTML_FORM, ProtectionSpaceAuthenticationSchemeHTMLForm); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_NTLM, ProtectionSpaceAuthenticationSchemeNTLM); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_NEGOTIATE, ProtectionSpaceAuthenticationSchemeNegotiate); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED, ProtectionSpaceAuthenticationSchemeClientCertificateRequested); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_SERVER_TRUST_EVALUATION_REQUESTED, ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN, ProtectionSpaceAuthenticationSchemeUnknown); - WEBKIT_DEFINE_TYPE(WebKitAuthenticationRequest, webkit_authentication_request, G_TYPE_OBJECT) +static inline WebKitAuthenticationScheme toWebKitAuthenticationScheme(WebCore::ProtectionSpaceAuthenticationScheme coreScheme) +{ + switch (coreScheme) { + case WebCore::ProtectionSpaceAuthenticationSchemeDefault: + return WEBKIT_AUTHENTICATION_SCHEME_DEFAULT; + case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic: + return WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC; + case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest: + return WEBKIT_AUTHENTICATION_SCHEME_HTTP_DIGEST; + case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm: + return WEBKIT_AUTHENTICATION_SCHEME_HTML_FORM; + case WebCore::ProtectionSpaceAuthenticationSchemeNTLM: + return WEBKIT_AUTHENTICATION_SCHEME_NTLM; + case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate: + return WEBKIT_AUTHENTICATION_SCHEME_NEGOTIATE; + case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested: + return WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED; + case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested: + return WEBKIT_AUTHENTICATION_SCHEME_SERVER_TRUST_EVALUATION_REQUESTED; + case WebCore::ProtectionSpaceAuthenticationSchemeUnknown: + return WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN; + default: + ASSERT_NOT_REACHED(); + return WEBKIT_AUTHENTICATION_SCHEME_DEFAULT; + } +} + static void webkitAuthenticationRequestDispose(GObject* object) { WebKitAuthenticationRequest* request = WEBKIT_AUTHENTICATION_REQUEST(object); @@ -144,7 +161,7 @@ gboolean webkit_authentication_request_can_save_credentials(WebKitAuthentication { g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), FALSE); -#if ENABLE(CREDENTIAL_STORAGE) +#if USE(LIBSECRET) return !request->priv->privateBrowsingEnabled; #else return FALSE; @@ -168,7 +185,7 @@ WebKitCredential* webkit_authentication_request_get_proposed_credential(WebKitAu { g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); - const WebCore::Credential& credential = request->priv->authenticationChallenge->proposedCredential()->core(); + const WebCore::Credential& credential = request->priv->authenticationChallenge->proposedCredential()->credential(); if (credential.isEmpty()) return 0; @@ -244,7 +261,7 @@ WebKitAuthenticationScheme webkit_authentication_request_get_scheme(WebKitAuthen { g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN); - return static_cast<WebKitAuthenticationScheme>(request->priv->authenticationChallenge->protectionSpace()->authenticationScheme()); + return toWebKitAuthenticationScheme(request->priv->authenticationChallenge->protectionSpace()->authenticationScheme()); } /** @@ -295,8 +312,11 @@ void webkit_authentication_request_authenticate(WebKitAuthenticationRequest* req { g_return_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request)); - RefPtr<WebCredential> webCredential = credential ? WebCredential::create(webkitCredentialGetCredential(credential)) : 0; - request->priv->authenticationChallenge->listener()->useCredential(webCredential.get()); + if (credential) + request->priv->authenticationChallenge->listener()->useCredential(WebCredential::create(webkitCredentialGetCredential(credential)).ptr()); + else + request->priv->authenticationChallenge->listener()->useCredential(nullptr); + request->priv->handledRequest = true; } |