#ifndef CSSStyleSheetResource_h
#define CSSStyleSheetResource_h
#include "core/fetch/ResourcePtr.h"
#include "core/fetch/StyleSheetResource.h"
#include "heap/Handle.h"
namespace WebCore {
class CSSParserContext;
class ResourceClient;
class StyleSheetContents;
class TextResourceDecoder;
class CSSStyleSheetResource FINAL : public StyleSheetResource {
public:
CSSStyleSheetResource(const ResourceRequest&, const String& charset);
virtual ~CSSStyleSheetResource();
const String sheetText(bool enforceMIMEType = true, bool* hasValidMIMEType = 0) const;
virtual void didAddClient(ResourceClient*) OVERRIDE;
virtual void setEncoding(const String&) OVERRIDE;
virtual String encoding() const OVERRIDE;
PassRefPtrWillBeRawPtr<StyleSheetContents> restoreParsedStyleSheet(const CSSParserContext&);
void saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>);
protected:
virtual bool isSafeToUnlock() const OVERRIDE;
virtual void destroyDecodedDataIfPossible() OVERRIDE;
private:
bool canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const;
virtual void checkNotify() OVERRIDE;
OwnPtr<TextResourceDecoder> m_decoder;
String m_decodedSheetText;
RefPtrWillBePersistent<StyleSheetContents> m_parsedStyleSheetCache;
};
DEFINE_RESOURCE_TYPE_CASTS(CSSStyleSheet);
}
#endif