diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-06 14:44:00 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-06 14:44:00 +0100 |
commit | 40736c5763bf61337c8c14e16d8587db021a87d4 (patch) | |
tree | b17a9c00042ad89cb1308e2484491799aa14e9f8 /Source/WebKit2/UIProcess/Authentication | |
download | qtwebkit-40736c5763bf61337c8c14e16d8587db021a87d4.tar.gz |
Imported WebKit commit 2ea9d364d0f6efa8fa64acf19f451504c59be0e4 (http://svn.webkit.org/repository/webkit/trunk@104285)
Diffstat (limited to 'Source/WebKit2/UIProcess/Authentication')
8 files changed, 575 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp new file mode 100644 index 000000000..7f4e958ed --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "AuthenticationChallengeProxy.h" + +#include "AuthenticationDecisionListener.h" +#include "AuthenticationManagerMessages.h" +#include "WebCertificateInfo.h" +#include "WebCoreArgumentCoders.h" +#include "WebCredential.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" +#include "WebProtectionSpace.h" + +namespace WebKit { + +AuthenticationChallengeProxy::AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebProcessProxy* process) + : m_coreAuthenticationChallenge(authenticationChallenge) + , m_challengeID(challengeID) + , m_process(process) +{ + ASSERT(m_challengeID); + m_listener = AuthenticationDecisionListener::create(this); +} + +AuthenticationChallengeProxy::~AuthenticationChallengeProxy() +{ + // If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet, + // we cancel it here so the WebProcess isn't waiting for an answer forever. + if (m_challengeID) + m_process->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0); + + if (m_listener) + m_listener->detachChallenge(); +} + +void AuthenticationChallengeProxy::useCredential(WebCredential* credential) +{ + if (!m_challengeID) + return; + + if (!credential) + m_process->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(m_challengeID), 0); + else { + WebCertificateInfo* certificateInfo = credential->certificateInfo(); + PlatformCertificateInfo platformInfo = certificateInfo ? certificateInfo->platformCertificateInfo() : PlatformCertificateInfo(); + m_process->send(Messages::AuthenticationManager::UseCredentialForChallenge(m_challengeID, credential->core(), platformInfo), 0); + } + + m_challengeID = 0; +} + +void AuthenticationChallengeProxy::cancel() +{ + if (!m_challengeID) + return; + + m_process->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0); + + m_challengeID = 0; +} + +WebCredential* AuthenticationChallengeProxy::proposedCredential() const +{ + if (!m_webCredential) + m_webCredential = WebCredential::create(m_coreAuthenticationChallenge.proposedCredential()); + + return m_webCredential.get(); +} + +WebProtectionSpace* AuthenticationChallengeProxy::protectionSpace() const +{ + if (!m_webProtectionSpace) + m_webProtectionSpace = WebProtectionSpace::create(m_coreAuthenticationChallenge.protectionSpace()); + + return m_webProtectionSpace.get(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h new file mode 100644 index 000000000..a429ac510 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AuthenticationChallengeProxy_h +#define AuthenticationChallengeProxy_h + +#include "APIObject.h" +#include <WebCore/AuthenticationChallenge.h> +#include <wtf/PassRefPtr.h> + +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + +namespace WebKit { + +class AuthenticationDecisionListener; +class WebCredential; +class WebProcessProxy; +class WebProtectionSpace; + +class AuthenticationChallengeProxy : public APIObject { +public: + static const Type APIType = TypeAuthenticationChallenge; + + static PassRefPtr<AuthenticationChallengeProxy> create(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebProcessProxy* process) + { + return adoptRef(new AuthenticationChallengeProxy(authenticationChallenge, challengeID, process)); + } + + ~AuthenticationChallengeProxy(); + + void useCredential(WebCredential*); + void cancel(); + + AuthenticationDecisionListener* listener() const { return m_listener.get(); } + WebCredential* proposedCredential() const; + WebProtectionSpace* protectionSpace() const; + int previousFailureCount() const { return m_coreAuthenticationChallenge.previousFailureCount(); } + +private: + AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, WebProcessProxy*); + + virtual Type type() const { return APIType; } + + WebCore::AuthenticationChallenge m_coreAuthenticationChallenge; + uint64_t m_challengeID; + RefPtr<WebProcessProxy> m_process; + RefPtr<AuthenticationDecisionListener> m_listener; + mutable RefPtr<WebCredential> m_webCredential; + mutable RefPtr<WebProtectionSpace> m_webProtectionSpace; +}; + +} // namespace WebKit + +#endif // WebAuthenticationChallengeProxy_h diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp new file mode 100644 index 000000000..00cd8748c --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "AuthenticationDecisionListener.h" + +#include "AuthenticationChallengeProxy.h" +#include "AuthenticationManagerMessages.h" +#include "WebCertificateInfo.h" +#include "WebCredential.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +namespace WebKit { + +AuthenticationDecisionListener::AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge) + : m_challengeProxy(authenticationChallenge) +{ +} + +void AuthenticationDecisionListener::useCredential(WebCredential* credential) +{ + if (m_challengeProxy) + m_challengeProxy->useCredential(credential); +} + +void AuthenticationDecisionListener::cancel() +{ + if (m_challengeProxy) + m_challengeProxy->cancel(); +} + +void AuthenticationDecisionListener::detachChallenge() +{ + m_challengeProxy = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h new file mode 100644 index 000000000..00af84965 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AuthenticationDecisionListener_h +#define AuthenticationDecisionListener_h + +#include "APIObject.h" + +#include <wtf/RefPtr.h> + +namespace WebKit { + +class AuthenticationChallengeProxy; +class WebCredential; + +class AuthenticationDecisionListener : public APIObject { +public: + static const Type APIType = TypeAuthenticationDecisionListener; + + static PassRefPtr<AuthenticationDecisionListener> create(AuthenticationChallengeProxy* authenticationChallenge) + { + return adoptRef(new AuthenticationDecisionListener(authenticationChallenge)); + } + + void useCredential(WebCredential*); + void cancel(); + + void detachChallenge(); + +private: + AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge); + + virtual Type type() const { return APIType; } + + AuthenticationChallengeProxy* m_challengeProxy; +}; + +} // namespace WebKit + +#endif // WebAuthenticationDecisionListener_h diff --git a/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp new file mode 100644 index 000000000..6d70c5fbc --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebCredential.h" + +#include "WebCertificateInfo.h" + +namespace WebKit { + +WebCredential::WebCredential(const WebCore::Credential& credential) + : m_coreCredential(credential) +{ +} + +WebCredential::WebCredential(WebCertificateInfo* certificateInfo) + : m_certificateInfo(certificateInfo) +{ +} + +WebCertificateInfo* WebCredential::certificateInfo() +{ + return m_certificateInfo.get(); +} + +const WebCore::Credential& WebCredential::core() +{ + return m_coreCredential; +} + +const String& WebCredential::user() const +{ + return m_coreCredential.user(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/WebCredential.h b/Source/WebKit2/UIProcess/Authentication/WebCredential.h new file mode 100644 index 000000000..b07a8a6ec --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebCredential.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCredential_h +#define WebCredential_h + +#include "APIObject.h" +#include "WebString.h" + +#include <WebCore/Credential.h> +#include <wtf/PassRefPtr.h> + + +namespace WebKit { + +class WebCertificateInfo; + +class WebCredential : public APIObject { +public: + static const Type APIType = TypeCredential; + + static PassRefPtr<WebCredential> create(const WebCore::Credential& credential) + { + return adoptRef(new WebCredential(credential)); + } + + static PassRefPtr<WebCredential> create(WebString* username, WebString* password, WebCore::CredentialPersistence persistence) + { + return adoptRef(new WebCredential(WebCore::Credential(username->string(), password->string(), persistence))); + } + + static PassRefPtr<WebCredential> create(WebCertificateInfo* certificateInfo) + { + return adoptRef(new WebCredential(certificateInfo)); + } + + WebCertificateInfo* certificateInfo(); + + const WebCore::Credential& core(); + + const String& user() const; + +private: + WebCredential(const WebCore::Credential&); + WebCredential(WebCertificateInfo*); + + virtual Type type() const { return APIType; } + + WebCore::Credential m_coreCredential; + RefPtr<WebCertificateInfo> m_certificateInfo; +}; + +} // namespace WebKit + +#endif // WebCredential_h diff --git a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp new file mode 100644 index 000000000..3d38e2242 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebProtectionSpace.h" + +#include <WebCore/SharedBuffer.h> + +namespace WebKit { + +WebProtectionSpace::WebProtectionSpace(const WebCore::ProtectionSpace& coreProtectionSpace) + : m_coreProtectionSpace(coreProtectionSpace) +{ +} + +const String& WebProtectionSpace::host() const +{ + return m_coreProtectionSpace.host(); +} + +int WebProtectionSpace::port() const +{ + return m_coreProtectionSpace.port(); +} + +const String& WebProtectionSpace::realm() const +{ + return m_coreProtectionSpace.realm(); +} + +bool WebProtectionSpace::isProxy() const +{ + return m_coreProtectionSpace.isProxy(); +} + +WebCore::ProtectionSpaceServerType WebProtectionSpace::serverType() const +{ + return m_coreProtectionSpace.serverType(); +} + +bool WebProtectionSpace::receivesCredentialSecurely() const +{ + return m_coreProtectionSpace.receivesCredentialSecurely(); +} + +WebCore::ProtectionSpaceAuthenticationScheme WebProtectionSpace::authenticationScheme() const +{ + return m_coreProtectionSpace.authenticationScheme(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h new file mode 100644 index 000000000..604236a62 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebProtectionSpace_h +#define WebProtectionSpace_h + +#include "APIObject.h" +#include <WebCore/ProtectionSpace.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebProtectionSpace : public APIObject { +public: + static const Type APIType = TypeProtectionSpace; + + static PassRefPtr<WebProtectionSpace> create(const WebCore::ProtectionSpace& protectionSpace) + { + return adoptRef(new WebProtectionSpace(protectionSpace)); + } + + const String& protocol() const; + const String& host() const; + int port() const; + const String& realm() const; + bool isProxy() const; + WebCore::ProtectionSpaceServerType serverType() const; + bool receivesCredentialSecurely() const; + WebCore::ProtectionSpaceAuthenticationScheme authenticationScheme() const; + +private: + WebProtectionSpace(const WebCore::ProtectionSpace&); + + virtual Type type() const { return APIType; } + + WebCore::ProtectionSpace m_coreProtectionSpace; +}; + +} // namespace WebKit + +#endif // WebProtectionSpace_h |