AuthenticationChallenge.cpp [plain text]
#include "config.h"
#include "AuthenticationChallenge.h"
#include "ResourceHandle.h"
namespace WebCore {
AuthenticationChallenge::AuthenticationChallenge()
: m_isNull(true)
, m_previousFailureCount(0)
{
}
AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential,
unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error)
: m_isNull(false)
, m_protectionSpace(protectionSpace)
, m_proposedCredential(proposedCredential)
, m_previousFailureCount(previousFailureCount)
, m_failureResponse(response)
, m_error(error)
{
}
unsigned AuthenticationChallenge::previousFailureCount() const
{
return m_previousFailureCount;
}
const Credential& AuthenticationChallenge::proposedCredential() const
{
return m_proposedCredential;
}
const ProtectionSpace& AuthenticationChallenge::protectionSpace() const
{
return m_protectionSpace;
}
const ResourceResponse& AuthenticationChallenge::failureResponse() const
{
return m_failureResponse;
}
const ResourceError& AuthenticationChallenge::error() const
{
return m_error;
}
bool AuthenticationChallenge::isNull() const
{
return m_isNull;
}
void AuthenticationChallenge::nullify()
{
m_isNull = true;
}
bool operator==(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
{
if (a.isNull() != b.isNull())
return false;
if (a.isNull())
return true;
#if PLATFORM(MAC)
if (a.sender() != b.sender())
return false;
if (a.nsURLAuthenticationChallenge() != b.nsURLAuthenticationChallenge())
return false;
#elif USE(CFNETWORK)
if (a.sourceHandle() != b.sourceHandle())
return false;
if (a.cfURLAuthChallengeRef() != b.cfURLAuthChallengeRef())
return false;
#endif
if (a.protectionSpace() != b.protectionSpace())
return false;
if (a.proposedCredential() != b.proposedCredential())
return false;
if (a.previousFailureCount() != b.previousFailureCount())
return false;
if (a.failureResponse() != b.failureResponse())
return false;
if (a.error() != b.error())
return false;
return true;
}
bool operator!=(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
{
return !(a == b);
}
}