OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ScriptCustomElementDefinition_h | 5 #ifndef ScriptCustomElementDefinition_h |
6 #define ScriptCustomElementDefinition_h | 6 #define ScriptCustomElementDefinition_h |
7 | 7 |
8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
11 #include "core/dom/custom/CustomElementDefinition.h" | 11 #include "core/dom/custom/CustomElementDefinition.h" |
12 #include "v8.h" | 12 #include "v8.h" |
| 13 #include "wtf/HashSet.h" |
13 #include "wtf/Noncopyable.h" | 14 #include "wtf/Noncopyable.h" |
14 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
| 16 #include "wtf/text/AtomicString.h" |
| 17 #include "wtf/text/AtomicStringHash.h" |
15 | 18 |
16 namespace blink { | 19 namespace blink { |
17 | 20 |
18 class CustomElementDescriptor; | 21 class CustomElementDescriptor; |
19 class CustomElementsRegistry; | 22 class CustomElementsRegistry; |
20 | 23 |
21 class CORE_EXPORT ScriptCustomElementDefinition final : | 24 class CORE_EXPORT ScriptCustomElementDefinition final : |
22 public CustomElementDefinition { | 25 public CustomElementDefinition { |
23 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition); | 26 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition); |
24 public: | 27 public: |
25 static ScriptCustomElementDefinition* forConstructor( | 28 static ScriptCustomElementDefinition* forConstructor( |
26 ScriptState*, | 29 ScriptState*, |
27 CustomElementsRegistry*, | 30 CustomElementsRegistry*, |
28 const v8::Local<v8::Value>& constructor); | 31 const v8::Local<v8::Value>& constructor); |
29 | 32 |
30 static ScriptCustomElementDefinition* create( | 33 static ScriptCustomElementDefinition* create( |
31 ScriptState*, | 34 ScriptState*, |
32 CustomElementsRegistry*, | 35 CustomElementsRegistry*, |
33 const CustomElementDescriptor&, | 36 const CustomElementDescriptor&, |
34 const v8::Local<v8::Object>& constructor, | 37 const v8::Local<v8::Object>& constructor, |
35 const v8::Local<v8::Object>& prototype); | 38 const v8::Local<v8::Object>& prototype, |
| 39 const v8::Local<v8::Object>& connectedCallback, |
| 40 const v8::Local<v8::Object>& disconnectedCallback, |
| 41 const v8::Local<v8::Object>& attributeChangedCallback, |
| 42 const HashSet<AtomicString>& observedAttributes); |
36 | 43 |
37 virtual ~ScriptCustomElementDefinition() = default; | 44 virtual ~ScriptCustomElementDefinition() = default; |
38 | 45 |
39 v8::Local<v8::Object> constructor() const; | 46 v8::Local<v8::Object> constructor() const; |
40 v8::Local<v8::Object> prototype() const; | 47 v8::Local<v8::Object> prototype() const; |
41 | 48 |
42 private: | 49 private: |
43 ScriptCustomElementDefinition( | 50 ScriptCustomElementDefinition( |
44 ScriptState*, | 51 ScriptState*, |
45 const CustomElementDescriptor&, | 52 const CustomElementDescriptor&, |
46 const v8::Local<v8::Object>& constructor, | 53 const v8::Local<v8::Object>& constructor, |
47 const v8::Local<v8::Object>& prototype); | 54 const v8::Local<v8::Object>& prototype, |
| 55 const v8::Local<v8::Object>& connectedCallback, |
| 56 const v8::Local<v8::Object>& disconnectedCallback, |
| 57 const v8::Local<v8::Object>& attributeChangedCallback, |
| 58 const HashSet<AtomicString>& observedAttributes); |
48 | 59 |
49 // Implementations of |CustomElementDefinition| | 60 // Implementations of |CustomElementDefinition| |
50 ScriptValue getConstructorForScript() final; | 61 ScriptValue getConstructorForScript() final; |
51 bool runConstructor(Element*) override; | 62 bool runConstructor(Element*) override; |
52 | 63 |
53 RefPtr<ScriptState> m_scriptState; | 64 RefPtr<ScriptState> m_scriptState; |
54 ScopedPersistent<v8::Object> m_constructor; | 65 ScopedPersistent<v8::Object> m_constructor; |
55 ScopedPersistent<v8::Object> m_prototype; | 66 ScopedPersistent<v8::Object> m_prototype; |
| 67 ScopedPersistent<v8::Object> m_connectedCallback; |
| 68 ScopedPersistent<v8::Object> m_disconnectedCallback; |
| 69 ScopedPersistent<v8::Object> m_attributeChangedCallback; |
| 70 HashSet<AtomicString> m_observedAttributes; |
56 }; | 71 }; |
57 | 72 |
58 } // namespace blink | 73 } // namespace blink |
59 | 74 |
60 #endif // ScriptCustomElementDefinition_h | 75 #endif // ScriptCustomElementDefinition_h |
OLD | NEW |