Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: third_party/WebKit/Source/core/dom/ClassicScript.h

Issue 2780463002: Introduce blink::Script (Closed)
Patch Set: style Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/ClassicScript.h
diff --git a/third_party/WebKit/Source/core/dom/ClassicScript.h b/third_party/WebKit/Source/core/dom/ClassicScript.h
new file mode 100644
index 0000000000000000000000000000000000000000..a7cb01272b954d802710e94c731968e4d0bc4886
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ClassicScript.h
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ClassicScript_h
+#define ClassicScript_h
+
+#include "bindings/core/v8/ScriptSourceCode.h"
+#include "core/CoreExport.h"
+#include "core/dom/Script.h"
+
+namespace blink {
+
+class CORE_EXPORT ClassicScript final : public Script {
+ public:
+ static ClassicScript* create(const ScriptSourceCode& scriptSourceCode) {
+ return new ClassicScript(scriptSourceCode);
+ }
+
+ DEFINE_INLINE_TRACE() {
+ Script::trace(visitor);
+ visitor->trace(m_scriptSourceCode);
+ }
+
+ const ScriptSourceCode& scriptSourceCode() const {
+ return m_scriptSourceCode;
+ }
+
+ private:
+ explicit ClassicScript(const ScriptSourceCode& scriptSourceCode)
+ : m_scriptSourceCode(scriptSourceCode) {}
+
+ ScriptType scriptType() const override { return ScriptType::Classic; }
+ bool isEmpty() const override;
+ bool checkMIMETypeBeforeRunScript(Document* contextDocument,
+ const SecurityOrigin*) const override;
+ void runScript(LocalFrame*, const SecurityOrigin*) const override;
+ String inlineSourceTextForCSP() const override {
+ return m_scriptSourceCode.source();
+ }
+
+ const ScriptSourceCode m_scriptSourceCode;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698