| 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 SecurityOrigin; |
| 18 class ScriptModule; |
| 19 |
| 20 // spec: "top-level module fetch flag" |
| 21 // https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-to
p-level |
| 22 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch }; |
| 15 | 23 |
| 16 // A Modulator is an interface for "environment settings object" concept for | 24 // A Modulator is an interface for "environment settings object" concept for |
| 17 // module scripts. | 25 // module scripts. |
| 18 // https://html.spec.whatwg.org/#environment-settings-object | 26 // https://html.spec.whatwg.org/#environment-settings-object |
| 19 // | 27 // |
| 20 // A Modulator also serves as an entry point for various module spec algorithms. | 28 // A Modulator also serves as an entry point for various module spec algorithms. |
| 21 class CORE_EXPORT Modulator : public GarbageCollectedMixin { | 29 class CORE_EXPORT Modulator : public GarbageCollectedMixin { |
| 22 public: | 30 public: |
| 23 static Modulator* from(LocalFrame*); | 31 static Modulator* from(LocalFrame*); |
| 24 | 32 |
| 33 virtual ReferrerPolicy referrerPolicy() = 0; |
| 34 virtual SecurityOrigin* securityOrigin() = 0; |
| 35 |
| 25 // https://html.spec.whatwg.org/#resolve-a-module-specifier | 36 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
| 26 static KURL resolveModuleSpecifier(const String& moduleRequest, | 37 static KURL resolveModuleSpecifier(const String& moduleRequest, |
| 27 const KURL& baseURL); | 38 const KURL& baseURL); |
| 39 |
| 40 // TODO(kouhei): script should be a ScriptSourceCode. |
| 41 virtual ScriptModule compileModule(const String& script, |
| 42 const String& urlStr) = 0; |
| 28 }; | 43 }; |
| 29 | 44 |
| 30 } // namespace blink | 45 } // namespace blink |
| 31 | 46 |
| 32 #endif | 47 #endif |
| OLD | NEW |