#ifndef ResourceError_h
#define ResourceError_h
#include "platform/PlatformExport.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
PLATFORM_EXPORT extern const char errorDomainBlinkInternal[];
class PLATFORM_EXPORT ResourceError {
public:
static ResourceError cancelledError(const String& failingURL);
ResourceError()
: m_errorCode(0)
, m_isNull(true)
, m_isCancellation(false)
, m_isTimeout(false)
, m_staleCopyInCache(false)
{
}
ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription)
: m_domain(domain)
, m_errorCode(errorCode)
, m_failingURL(failingURL)
, m_localizedDescription(localizedDescription)
, m_isNull(false)
, m_isCancellation(false)
, m_isTimeout(false)
, m_staleCopyInCache(false)
{
}
ResourceError copy() const;
bool isNull() const { return m_isNull; }
const String& domain() const { return m_domain; }
int errorCode() const { return m_errorCode; }
const String& failingURL() const { return m_failingURL; }
const String& localizedDescription() const { return m_localizedDescription; }
void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellation; }
bool isCancellation() const { return m_isCancellation; }
void setIsTimeout(bool isTimeout) { m_isTimeout = isTimeout; }
bool isTimeout() const { return m_isTimeout; }
void setStaleCopyInCache(bool staleCopyInCache) { m_staleCopyInCache = staleCopyInCache; }
bool staleCopyInCache() const { return m_staleCopyInCache; }
static bool compare(const ResourceError&, const ResourceError&);
private:
String m_domain;
int m_errorCode;
String m_failingURL;
String m_localizedDescription;
bool m_isNull;
bool m_isCancellation;
bool m_isTimeout;
bool m_staleCopyInCache;
};
inline bool operator==(const ResourceError& a, const ResourceError& b) { return ResourceError::compare(a, b); }
inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); }
}
#endif