Index: third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetcher.h |
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetcher.h b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2749bc4c7a7409fab083d28a4432cc29ed0bcc8a |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetcher.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ModuleScriptFetcher_h |
+#define ModuleScriptFetcher_h |
+ |
+#include "core/dom/Modulator.h" |
+#include "core/loader/modulescript/ModuleScriptCreationParams.h" |
+#include "core/loader/resource/ScriptResource.h" |
+#include "platform/loader/fetch/FetchParameters.h" |
+#include "platform/loader/fetch/ResourceFetcher.h" |
+#include "platform/loader/fetch/ResourceOwner.h" |
+#include "platform/weborigin/SecurityOrigin.h" |
+#include "platform/wtf/Optional.h" |
+ |
+namespace blink { |
+ |
+class ModuleScriptLoader; |
+ |
+class CORE_EXPORT ModuleScriptFetcher |
+ : public GarbageCollectedFinalized<ModuleScriptFetcher>, |
+ public ResourceOwner<ScriptResource> { |
+ USING_GARBAGE_COLLECTED_MIXIN(ModuleScriptFetcher); |
+ |
+ public: |
+ ModuleScriptFetcher(FetchParameters, ResourceFetcher*, Modulator*); |
+ |
+ void Fetch(ModuleScriptLoader*); |
+ |
+ // Implements ScriptResourceClient |
+ void NotifyFinished(Resource*) final; |
+ String DebugName() const final { return "ModuleScriptFetcher"; } |
+ |
+ DECLARE_TRACE(); |
+ |
+ protected: |
+ // 'virtual' for custom fetch. |
+ virtual void FetchInternal(); |
+ virtual void Finalize(WTF::Optional<ModuleScriptCreationParams>); |
+ |
+ KURL GetRequestUrl() const { return fetch_params_.Url(); } |
+ |
+ private: |
+ FetchParameters fetch_params_; |
+ Member<ResourceFetcher> fetcher_; |
+ Member<Modulator> modulator_; |
+ Member<ModuleScriptLoader> loader_; |
+ bool was_fetched_ = false; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // ModuleScriptFetcher_h |