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& script_source_code) { |
| 17 return new ClassicScript(script_source_code); |
| 18 } |
| 19 |
| 20 DECLARE_TRACE(); |
| 21 DECLARE_TRACE_WRAPPERS(); |
| 22 |
| 23 const ScriptSourceCode& GetScriptSourceCode() const { |
| 24 return script_source_code_; |
| 25 } |
| 26 |
| 27 private: |
| 28 explicit ClassicScript(const ScriptSourceCode& script_source_code) |
| 29 : script_source_code_(script_source_code) {} |
| 30 |
| 31 ScriptType GetScriptType() const override { return ScriptType::kClassic; } |
| 32 bool IsEmpty() const override; |
| 33 bool CheckMIMETypeBeforeRunScript(Document* context_document, |
| 34 const SecurityOrigin*) const override; |
| 35 void RunScript(LocalFrame*, const SecurityOrigin*) const override; |
| 36 String InlineSourceTextForCSP() const override { |
| 37 return script_source_code_.Source(); |
| 38 } |
| 39 |
| 40 const ScriptSourceCode script_source_code_; |
| 41 }; |
| 42 |
| 43 } // namespace blink |
| 44 |
| 45 #endif |
OLD | NEW |