| 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 ClassicScript_h | 5 #ifndef ClassicScript_h |
| 6 #define ClassicScript_h | 6 #define ClassicScript_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptSourceCode.h" | 8 #include "bindings/core/v8/ScriptSourceCode.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/dom/Script.h" | 10 #include "core/dom/Script.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class CORE_EXPORT ClassicScript final : public Script { | 14 class CORE_EXPORT ClassicScript final : public Script { |
| 15 public: | 15 public: |
| 16 static ClassicScript* Create(const ScriptSourceCode& script_source_code) { | 16 static ClassicScript* Create(const ScriptSourceCode& script_source_code) { |
| 17 return new ClassicScript(script_source_code); | 17 return new ClassicScript(script_source_code); |
| 18 } | 18 } |
| 19 | 19 |
| 20 DECLARE_TRACE(); | 20 DECLARE_TRACE(); |
| 21 DECLARE_TRACE_WRAPPERS(); | |
| 22 | 21 |
| 23 const ScriptSourceCode& GetScriptSourceCode() const { | 22 const ScriptSourceCode& GetScriptSourceCode() const { |
| 24 return script_source_code_; | 23 return script_source_code_; |
| 25 } | 24 } |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 explicit ClassicScript(const ScriptSourceCode& script_source_code) | 27 explicit ClassicScript(const ScriptSourceCode& script_source_code) |
| 29 : script_source_code_(script_source_code) {} | 28 : script_source_code_(script_source_code) {} |
| 30 | 29 |
| 31 ScriptType GetScriptType() const override { return ScriptType::kClassic; } | 30 ScriptType GetScriptType() const override { return ScriptType::kClassic; } |
| 32 bool IsEmpty() const override; | 31 bool IsEmpty() const override; |
| 33 bool CheckMIMETypeBeforeRunScript(Document* context_document, | 32 bool CheckMIMETypeBeforeRunScript(Document* context_document, |
| 34 const SecurityOrigin*) const override; | 33 const SecurityOrigin*) const override; |
| 35 void RunScript(LocalFrame*, const SecurityOrigin*) const override; | 34 void RunScript(LocalFrame*, const SecurityOrigin*) const override; |
| 36 String InlineSourceTextForCSP() const override { | 35 String InlineSourceTextForCSP() const override { |
| 37 return script_source_code_.Source(); | 36 return script_source_code_.Source(); |
| 38 } | 37 } |
| 39 | 38 |
| 40 const ScriptSourceCode script_source_code_; | 39 const ScriptSourceCode script_source_code_; |
| 41 }; | 40 }; |
| 42 | 41 |
| 43 } // namespace blink | 42 } // namespace blink |
| 44 | 43 |
| 45 #endif | 44 #endif |
| OLD | NEW |