OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ModuleScriptFetcher_h |
| 6 #define ModuleScriptFetcher_h |
| 7 |
| 8 #include "core/dom/Modulator.h" |
| 9 #include "core/loader/modulescript/ModuleScriptCreationParams.h" |
| 10 #include "core/loader/resource/ScriptResource.h" |
| 11 #include "platform/loader/fetch/FetchParameters.h" |
| 12 #include "platform/loader/fetch/ResourceFetcher.h" |
| 13 #include "platform/loader/fetch/ResourceOwner.h" |
| 14 #include "platform/weborigin/SecurityOrigin.h" |
| 15 #include "platform/wtf/Optional.h" |
| 16 |
| 17 namespace blink { |
| 18 |
| 19 class ModuleScriptLoader; |
| 20 |
| 21 class CORE_EXPORT ModuleScriptFetcher |
| 22 : public GarbageCollectedFinalized<ModuleScriptFetcher>, |
| 23 public ResourceOwner<ScriptResource> { |
| 24 USING_GARBAGE_COLLECTED_MIXIN(ModuleScriptFetcher); |
| 25 |
| 26 public: |
| 27 ModuleScriptFetcher(FetchParameters, ResourceFetcher*, Modulator*); |
| 28 |
| 29 void Fetch(ModuleScriptLoader*); |
| 30 |
| 31 // Implements ScriptResourceClient |
| 32 void NotifyFinished(Resource*) final; |
| 33 String DebugName() const final { return "ModuleScriptFetcher"; } |
| 34 |
| 35 DECLARE_TRACE(); |
| 36 |
| 37 protected: |
| 38 // 'virtual' for custom fetch. |
| 39 virtual void FetchInternal(); |
| 40 virtual void Finalize(WTF::Optional<ModuleScriptCreationParams>); |
| 41 |
| 42 KURL GetRequestUrl() const { return fetch_params_.Url(); } |
| 43 |
| 44 private: |
| 45 FetchParameters fetch_params_; |
| 46 Member<ResourceFetcher> fetcher_; |
| 47 Member<Modulator> modulator_; |
| 48 Member<ModuleScriptLoader> loader_; |
| 49 bool was_fetched_ = false; |
| 50 }; |
| 51 |
| 52 } // namespace blink |
| 53 |
| 54 #endif // ModuleScriptFetcher_h |
OLD | NEW |