| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> | 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> |
| 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 6 | 6 |
| 7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
| 8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
| 9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
| 10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
| 11 | 11 |
| 12 This library is distributed in the hope that it will be useful, | 12 This library is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 Library General Public License for more details. | 15 Library General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU Library General Public License | 17 You should have received a copy of the GNU Library General Public License |
| 18 along with this library; see the file COPYING.LIB. If not, write to | 18 along with this library; see the file COPYING.LIB. If not, write to |
| 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 Boston, MA 02110-1301, USA. | 20 Boston, MA 02110-1301, USA. |
| 21 | 21 |
| 22 This class provides all functionality needed for loading images, style | 22 This class provides all functionality needed for loading images, style |
| 23 sheets and html pages from the web. It has a memory cache for these objects. | 23 sheets and html pages from the web. It has a memory cache for these objects. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef ScriptResource_h | 26 #ifndef ScriptResource_h |
| 27 #define ScriptResource_h | 27 #define ScriptResource_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/loader/resource/ScriptResourceData.h" |
| 30 #include "core/loader/resource/TextResource.h" | 31 #include "core/loader/resource/TextResource.h" |
| 31 #include "platform/loader/fetch/AccessControlStatus.h" | |
| 32 #include "platform/loader/fetch/IntegrityMetadata.h" | 32 #include "platform/loader/fetch/IntegrityMetadata.h" |
| 33 #include "platform/loader/fetch/ResourceClient.h" | 33 #include "platform/loader/fetch/ResourceClient.h" |
| 34 #include "platform/loader/fetch/ResourceLoaderOptions.h" | 34 #include "platform/loader/fetch/ResourceLoaderOptions.h" |
| 35 #include "platform/loader/fetch/TextResourceDecoderOptions.h" | 35 #include "platform/loader/fetch/TextResourceDecoderOptions.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class FetchParameters; | 39 class FetchParameters; |
| 40 class KURL; | 40 class KURL; |
| 41 class ResourceFetcher; | 41 class ResourceFetcher; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 63 ResourceRequest request(url); | 63 ResourceRequest request(url); |
| 64 request.SetFetchCredentialsMode(WebURLRequest::kFetchCredentialsModeOmit); | 64 request.SetFetchCredentialsMode(WebURLRequest::kFetchCredentialsModeOmit); |
| 65 ResourceLoaderOptions options; | 65 ResourceLoaderOptions options; |
| 66 TextResourceDecoderOptions decoder_options( | 66 TextResourceDecoderOptions decoder_options( |
| 67 TextResourceDecoderOptions::kPlainTextContent, encoding); | 67 TextResourceDecoderOptions::kPlainTextContent, encoding); |
| 68 return new ScriptResource(request, options, decoder_options); | 68 return new ScriptResource(request, options, decoder_options); |
| 69 } | 69 } |
| 70 | 70 |
| 71 ~ScriptResource() override; | 71 ~ScriptResource() override; |
| 72 | 72 |
| 73 DECLARE_VIRTUAL_TRACE(); |
| 74 |
| 75 const ScriptResourceData* ResourceData(); |
| 76 |
| 77 void AppendData(const char*, size_t) override; |
| 78 |
| 79 private: |
| 73 void DidAddClient(ResourceClient*) override; | 80 void DidAddClient(ResourceClient*) override; |
| 74 void AppendData(const char*, size_t) override; | |
| 75 | 81 |
| 76 void OnMemoryDump(WebMemoryDumpLevelOfDetail, | 82 void OnMemoryDump(WebMemoryDumpLevelOfDetail, |
| 77 WebProcessMemoryDump*) const override; | 83 WebProcessMemoryDump*) const override; |
| 78 | 84 |
| 79 void DestroyDecodedDataForFailedRevalidation() override; | 85 void DestroyDecodedDataForFailedRevalidation() override; |
| 80 | 86 |
| 81 const String& SourceText(); | |
| 82 | |
| 83 static bool MimeTypeAllowedByNosniff(const ResourceResponse&); | |
| 84 | |
| 85 AccessControlStatus CalculateAccessControlStatus() const; | |
| 86 | |
| 87 private: | |
| 88 class ScriptResourceFactory : public ResourceFactory { | 87 class ScriptResourceFactory : public ResourceFactory { |
| 89 public: | 88 public: |
| 90 ScriptResourceFactory() | 89 ScriptResourceFactory() |
| 91 : ResourceFactory(Resource::kScript, | 90 : ResourceFactory(Resource::kScript, |
| 92 TextResourceDecoderOptions::kPlainTextContent) {} | 91 TextResourceDecoderOptions::kPlainTextContent) {} |
| 93 | 92 |
| 94 Resource* Create( | 93 Resource* Create( |
| 95 const ResourceRequest& request, | 94 const ResourceRequest& request, |
| 96 const ResourceLoaderOptions& options, | 95 const ResourceLoaderOptions& options, |
| 97 const TextResourceDecoderOptions& decoder_options) const override { | 96 const TextResourceDecoderOptions& decoder_options) const override { |
| 98 return new ScriptResource(request, options, decoder_options); | 97 return new ScriptResource(request, options, decoder_options); |
| 99 } | 98 } |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 ScriptResource(const ResourceRequest&, | 101 ScriptResource(const ResourceRequest&, |
| 103 const ResourceLoaderOptions&, | 102 const ResourceLoaderOptions&, |
| 104 const TextResourceDecoderOptions&); | 103 const TextResourceDecoderOptions&); |
| 105 | 104 |
| 106 AtomicString source_text_; | 105 Member<ScriptResourceData> script_data_; |
| 107 }; | 106 }; |
| 108 | 107 |
| 109 DEFINE_RESOURCE_TYPE_CASTS(Script); | 108 DEFINE_RESOURCE_TYPE_CASTS(Script); |
| 110 | 109 |
| 111 } // namespace blink | 110 } // namespace blink |
| 112 | 111 |
| 113 #endif | 112 #endif |
| OLD | NEW |