InspectorAuditResourcesObject.h [plain text]
#pragma once
#include "CachedFontClient.h"
#include "CachedImageClient.h"
#include "CachedRawResourceClient.h"
#include "CachedResourceClient.h"
#include "CachedSVGDocumentClient.h"
#include "CachedStyleSheetClient.h"
#include "ExceptionOr.h"
#include <JavaScriptCore/InspectorAuditAgent.h>
#include <wtf/Forward.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class CachedResource;
class Document;
class InspectorAuditResourcesObject : public RefCounted<InspectorAuditResourcesObject> {
public:
static Ref<InspectorAuditResourcesObject> create(Inspector::InspectorAuditAgent& auditAgent)
{
return adoptRef(*new InspectorAuditResourcesObject(auditAgent));
}
~InspectorAuditResourcesObject();
struct Resource {
String id;
String url;
String mimeType;
};
struct ResourceContent {
String data;
bool base64Encoded;
};
ExceptionOr<Vector<Resource>> getResources(Document&);
ExceptionOr<ResourceContent> getResourceContent(Document&, const String& id);
private:
explicit InspectorAuditResourcesObject(Inspector::InspectorAuditAgent&);
CachedResourceClient& clientForResource(const CachedResource&);
Inspector::InspectorAuditAgent& m_auditAgent;
class InspectorAuditCachedResourceClient : public CachedResourceClient { };
InspectorAuditCachedResourceClient m_cachedResourceClient;
class InspectorAuditCachedFontClient : public CachedFontClient { };
InspectorAuditCachedFontClient m_cachedFontClient;
class InspectorAuditCachedImageClient : public CachedImageClient { };
InspectorAuditCachedImageClient m_cachedImageClient;
class InspectorAuditCachedRawResourceClient : public CachedRawResourceClient { };
InspectorAuditCachedRawResourceClient m_cachedRawResourceClient;
class InspectorAuditCachedSVGDocumentClient : public CachedSVGDocumentClient { };
InspectorAuditCachedSVGDocumentClient m_cachedSVGDocumentClient;
class InspectorAuditCachedStyleSheetClient : public CachedStyleSheetClient { };
InspectorAuditCachedStyleSheetClient m_cachedStyleSheetClient;
HashMap<String, CachedResource*> m_resources;
};
}