#ifndef XSSAuditorDelegate_h
#define XSSAuditorDelegate_h
#include "platform/weborigin/KURL.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/Vector.h"
#include "wtf/text/TextPosition.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class Document;
class FormData;
class XSSInfo {
public:
static PassOwnPtr<XSSInfo> create(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader)
{
return adoptPtr(new XSSInfo(originalURL, didBlockEntirePage, didSendXSSProtectionHeader, didSendCSPHeader));
}
String buildConsoleError() const;
bool isSafeToSendToAnotherThread() const;
String m_originalURL;
bool m_didBlockEntirePage;
bool m_didSendXSSProtectionHeader;
bool m_didSendCSPHeader;
TextPosition m_textPosition;
private:
XSSInfo(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader)
: m_originalURL(originalURL.isolatedCopy())
, m_didBlockEntirePage(didBlockEntirePage)
, m_didSendXSSProtectionHeader(didSendXSSProtectionHeader)
, m_didSendCSPHeader(didSendCSPHeader)
{ }
};
class XSSAuditorDelegate {
WTF_MAKE_NONCOPYABLE(XSSAuditorDelegate);
public:
explicit XSSAuditorDelegate(Document*);
void didBlockScript(const XSSInfo&);
void setReportURL(const KURL& url) { m_reportURL = url; }
private:
PassRefPtr<FormData> generateViolationReport(const XSSInfo&);
Document* m_document;
bool m_didSendNotifications;
KURL m_reportURL;
};
typedef Vector<OwnPtr<XSSInfo> > XSSInfoStream;
}
#endif