#ifndef HTMLImportChild_h
#define HTMLImportChild_h
#include "core/fetch/RawResource.h"
#include "core/fetch/ResourceOwner.h"
#include "core/html/imports/HTMLImport.h"
#include "platform/weborigin/KURL.h"
#include "wtf/Vector.h"
namespace WebCore {
class CustomElementMicrotaskImportStep;
class HTMLImportLoader;
class HTMLImportChildClient;
class HTMLLinkElement;
class HTMLImportChild FINAL : public HTMLImport, public ResourceOwner<RawResource> {
public:
HTMLImportChild(Document&, const KURL&, SyncMode);
virtual ~HTMLImportChild();
HTMLLinkElement* link() const;
Document* importedDocument() const;
const KURL& url() const { return m_url; }
void wasAlreadyLoaded();
void startLoading(const ResourcePtr<RawResource>&);
void importDestroyed();
virtual bool isChild() const OVERRIDE { return true; }
virtual HTMLImportRoot* root() OVERRIDE;
virtual Document* document() const OVERRIDE;
virtual void wasDetachedFromDocument() OVERRIDE;
virtual void didFinishParsing() OVERRIDE;
virtual void didRemoveAllPendingStylesheet() OVERRIDE;
virtual bool isDone() const OVERRIDE;
virtual bool hasLoader() const OVERRIDE;
virtual bool ownsLoader() const OVERRIDE;
virtual CustomElementMicrotaskImportStep* customElementMicrotaskStep() const OVERRIDE FINAL { return m_customElementMicrotaskStep; }
virtual void stateDidChange() OVERRIDE;
#if !defined(NDEBUG)
virtual void showThis() OVERRIDE;
#endif
void setClient(HTMLImportChildClient*);
void clearClient();
bool loaderHasError() const;
void didFinishLoading();
private:
virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE { }
virtual void dataReceived(Resource*, const char*, int) OVERRIDE { }
virtual void notifyFinished(Resource*) OVERRIDE { }
void didFinish();
void createLoader();
void shareLoader(HTMLImportChild*);
void ensureLoader();
Document& m_master;
KURL m_url;
CustomElementMicrotaskImportStep* m_customElementMicrotaskStep;
RefPtr<HTMLImportLoader> m_loader;
HTMLImportChildClient* m_client;
};
inline HTMLImportChild* toHTMLImportChild(HTMLImport* import)
{
ASSERT(!import || import->isChild());
return static_cast<HTMLImportChild*>(import);
}
}
#endif