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