diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/loader/resource/text_resource.h')
-rw-r--r-- | chromium/third_party/blink/renderer/core/loader/resource/text_resource.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/chromium/third_party/blink/renderer/core/loader/resource/text_resource.h b/chromium/third_party/blink/renderer/core/loader/resource/text_resource.h index 6016e3ab40b..214e246c21f 100644 --- a/chromium/third_party/blink/renderer/core/loader/resource/text_resource.h +++ b/chromium/third_party/blink/renderer/core/loader/resource/text_resource.h @@ -10,11 +10,23 @@ #include "third_party/blink/renderer/core/html/parser/text_resource_decoder.h" #include "third_party/blink/renderer/platform/loader/fetch/resource.h" #include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { +class ResourceFetcher; + class CORE_EXPORT TextResource : public Resource { public: + static TextResource* FetchSVGDocument(FetchParameters&, + ResourceFetcher*, + ResourceClient*); + TextResource(const ResourceRequest&, + ResourceType, + const ResourceLoaderOptions&, + const TextResourceDecoderOptions&); + ~TextResource() override; + // Returns the decoded data in text form. The data has to be available at // call time. String DecodedText() const; @@ -23,19 +35,25 @@ class CORE_EXPORT TextResource : public Resource { void SetEncodingForTest(const String& encoding) { SetEncoding(encoding); } - protected: - TextResource(const ResourceRequest&, - ResourceType, - const ResourceLoaderOptions&, - const TextResourceDecoderOptions&); - ~TextResource() override; + bool HasData() const { return Data(); } + protected: void SetEncoding(const String&) override; private: std::unique_ptr<TextResourceDecoder> decoder_; }; +template <> +struct DowncastTraits<TextResource> { + static bool AllowFrom(const Resource& resource) { + return resource.GetType() == ResourceType::kCSSStyleSheet || + resource.GetType() == ResourceType::kScript || + resource.GetType() == ResourceType::kXSLStyleSheet || + resource.GetType() == ResourceType::kSVGDocument; + } +}; + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_RESOURCE_TEXT_RESOURCE_H_ |