OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef Modulator_h | 5 #ifndef Modulator_h |
6 #define Modulator_h | 6 #define Modulator_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
| 11 #include "platform/weborigin/ReferrerPolicy.h" |
| 12 #include "wtf/text/WTFString.h" |
11 | 13 |
12 namespace blink { | 14 namespace blink { |
13 | 15 |
14 class LocalFrame; | 16 class LocalFrame; |
| 17 class ScriptModule; |
| 18 |
| 19 // spec: "top-level module fetch flag" |
| 20 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch }; |
15 | 21 |
16 // A Modulator is an interface for "environment settings object" concept for | 22 // A Modulator is an interface for "environment settings object" concept for |
17 // module scripts. | 23 // module scripts. |
18 // https://html.spec.whatwg.org/#environment-settings-object | 24 // https://html.spec.whatwg.org/#environment-settings-object |
19 // | 25 // |
20 // A Modulator also serves as an entry point for various module spec algorithms. | 26 // A Modulator also serves as an entry point for various module spec algorithms. |
21 class CORE_EXPORT Modulator : public GarbageCollectedMixin { | 27 class CORE_EXPORT Modulator : public GarbageCollectedMixin { |
22 public: | 28 public: |
23 static Modulator* from(LocalFrame*); | 29 static Modulator* from(LocalFrame*); |
24 | 30 |
| 31 virtual ReferrerPolicy referrerPolicy() = 0; |
| 32 |
25 // https://html.spec.whatwg.org/#resolve-a-module-specifier | 33 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
26 static KURL resolveModuleSpecifier(const String& moduleRequest, | 34 static KURL resolveModuleSpecifier(const String& moduleRequest, |
27 const KURL& baseURL); | 35 const KURL& baseURL); |
| 36 |
| 37 // TODO(kouhei): script should be a ScriptSourceCode. |
| 38 virtual ScriptModule compileModule(const String& script, |
| 39 const String& urlStr) = 0; |
28 }; | 40 }; |
29 | 41 |
30 } // namespace blink | 42 } // namespace blink |
31 | 43 |
32 #endif | 44 #endif |
OLD | NEW |