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

Side by Side 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698