#ifndef ResourceError_h
#define ResourceError_h
#include "ResourceErrorBase.h"
#if USE(SOUP)
#include <wtf/glib/GRefPtr.h>
typedef struct _GTlsCertificate GTlsCertificate;
typedef struct _SoupRequest SoupRequest;
typedef struct _SoupMessage SoupMessage;
namespace WebCore {
class ResourceError : public ResourceErrorBase
{
public:
ResourceError(Type type = Type::Null)
: ResourceErrorBase(type)
, m_tlsErrors(0)
{
}
ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type = Type::General)
: ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type)
, m_tlsErrors(0)
{
}
static ResourceError httpError(SoupMessage*, GError*, SoupRequest*);
static ResourceError transportError(SoupRequest*, int statusCode, const String& reasonPhrase);
static ResourceError genericGError(GError*, SoupRequest*);
static ResourceError tlsError(SoupRequest*, unsigned tlsErrors, GTlsCertificate*);
static ResourceError timeoutError(const URL& failingURL);
static ResourceError authenticationError(SoupMessage*);
unsigned tlsErrors() const { return m_tlsErrors; }
void setTLSErrors(unsigned tlsErrors) { m_tlsErrors = tlsErrors; }
GTlsCertificate* certificate() const { return m_certificate.get(); }
void setCertificate(GTlsCertificate* certificate) { m_certificate = certificate; }
static bool platformCompare(const ResourceError& a, const ResourceError& b);
private:
friend class ResourceErrorBase;
void doPlatformIsolatedCopy(const ResourceError&);
unsigned m_tlsErrors;
GRefPtr<GTlsCertificate> m_certificate;
};
}
#endif
#endif // ResourceError_h_