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 ClassicScript_h |
| 6 #define ClassicScript_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptSourceCode.h" |
| 9 #include "core/CoreExport.h" |
| 10 #include "core/dom/Script.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class CORE_EXPORT ClassicScript final : public Script { |
| 15 public: |
| 16 static ClassicScript* create(const ScriptSourceCode& scriptSourceCode) { |
| 17 return new ClassicScript(scriptSourceCode); |
| 18 } |
| 19 |
| 20 DEFINE_INLINE_TRACE() { |
| 21 Script::trace(visitor); |
| 22 visitor->trace(m_scriptSourceCode); |
| 23 } |
| 24 |
| 25 const ScriptSourceCode& scriptSourceCode() const { |
| 26 return m_scriptSourceCode; |
| 27 } |
| 28 |
| 29 private: |
| 30 explicit ClassicScript(const ScriptSourceCode& scriptSourceCode) |
| 31 : m_scriptSourceCode(scriptSourceCode) {} |
| 32 |
| 33 ScriptType scriptType() const override { return ScriptType::Classic; } |
| 34 bool isEmpty() const override; |
| 35 bool checkMIMETypeBeforeRunScript(Document* contextDocument, |
| 36 const SecurityOrigin*) const override; |
| 37 void runScript(LocalFrame*, const SecurityOrigin*) const override; |
| 38 String inlineSourceTextForCSP() const override { |
| 39 return m_scriptSourceCode.source(); |
| 40 } |
| 41 |
| 42 const ScriptSourceCode m_scriptSourceCode; |
| 43 }; |
| 44 |
| 45 } // namespace blink |
| 46 |
| 47 #endif |
OLD | NEW |