InspectorApplicationCacheAgent.h [plain text]
#pragma once
#include "ApplicationCacheHost.h"
#include "InspectorWebAgentBase.h"
#include <inspector/InspectorBackendDispatchers.h>
#include <inspector/InspectorFrontendDispatchers.h>
#include <wtf/Noncopyable.h>
namespace Inspector {
class ApplicationCacheFrontendDispatcher;
class InspectorObject;
class InspectorValue;
}
namespace WebCore {
class Frame;
class InspectorPageAgent;
class Page;
typedef String ErrorString;
class InspectorApplicationCacheAgent final : public InspectorAgentBase, public Inspector::ApplicationCacheBackendDispatcherHandler {
WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
public:
InspectorApplicationCacheAgent(WebAgentContext&, InspectorPageAgent*);
virtual ~InspectorApplicationCacheAgent() { }
void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
void updateApplicationCacheStatus(Frame*);
void networkStateChanged();
void enable(ErrorString&) override;
void getFramesWithManifests(ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::ApplicationCache::FrameWithManifest>>& result) override;
void getManifestForFrame(ErrorString&, const String& frameId, String* manifestURL) override;
void getApplicationCacheForFrame(ErrorString&, const String& frameId, RefPtr<Inspector::Protocol::ApplicationCache::ApplicationCache>&) override;
private:
Ref<Inspector::Protocol::ApplicationCache::ApplicationCache> buildObjectForApplicationCache(const Vector<ApplicationCacheHost::ResourceInfo>&, const ApplicationCacheHost::CacheInfo&);
Ref<Inspector::Protocol::Array<Inspector::Protocol::ApplicationCache::ApplicationCacheResource>> buildArrayForApplicationCacheResources(const Vector<ApplicationCacheHost::ResourceInfo>&);
Ref<Inspector::Protocol::ApplicationCache::ApplicationCacheResource> buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo&);
DocumentLoader* assertFrameWithDocumentLoader(ErrorString&, const String& frameId);
std::unique_ptr<Inspector::ApplicationCacheFrontendDispatcher> m_frontendDispatcher;
RefPtr<Inspector::ApplicationCacheBackendDispatcher> m_backendDispatcher;
InspectorPageAgent* m_pageAgent { nullptr };
};
}