| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 const v8::Local<v8::Value>& constructor); | 28 const v8::Local<v8::Value>& constructor); |
| 29 | 29 |
| 30 static ScriptCustomElementDefinition* create( | 30 static ScriptCustomElementDefinition* create( |
| 31 ScriptState*, | 31 ScriptState*, |
| 32 CustomElementsRegistry*, | 32 CustomElementsRegistry*, |
| 33 const CustomElementDescriptor&, | 33 const CustomElementDescriptor&, |
| 34 const v8::Local<v8::Object>& constructor, | 34 const v8::Local<v8::Object>& constructor, |
| 35 const v8::Local<v8::Object>& prototype, | 35 const v8::Local<v8::Object>& prototype, |
| 36 const v8::Local<v8::Function>& connectedCallback, | 36 const v8::Local<v8::Function>& connectedCallback, |
| 37 const v8::Local<v8::Function>& disconnectedCallback, | 37 const v8::Local<v8::Function>& disconnectedCallback, |
| 38 const v8::Local<v8::Function>& adoptedCallback, |
| 38 const v8::Local<v8::Function>& attributeChangedCallback, | 39 const v8::Local<v8::Function>& attributeChangedCallback, |
| 39 const HashSet<AtomicString>& observedAttributes); | 40 const HashSet<AtomicString>& observedAttributes); |
| 40 | 41 |
| 41 virtual ~ScriptCustomElementDefinition() = default; | 42 virtual ~ScriptCustomElementDefinition() = default; |
| 42 | 43 |
| 43 v8::Local<v8::Object> constructor() const; | 44 v8::Local<v8::Object> constructor() const; |
| 44 v8::Local<v8::Object> prototype() const; | 45 v8::Local<v8::Object> prototype() const; |
| 45 | 46 |
| 46 HTMLElement* createElementSync(Document&, const QualifiedName&) override; | 47 HTMLElement* createElementSync(Document&, const QualifiedName&) override; |
| 47 HTMLElement* createElementSync(Document&, const QualifiedName&, ExceptionSta
te&) override; | 48 HTMLElement* createElementSync(Document&, const QualifiedName&, ExceptionSta
te&) override; |
| 48 | 49 |
| 49 void fireErrorEvent( | 50 void fireErrorEvent( |
| 50 ScriptState*, | 51 ScriptState*, |
| 51 const String& message, | 52 const String& message, |
| 52 v8::Local<v8::Value> exception, | 53 v8::Local<v8::Value> exception, |
| 53 std::unique_ptr<SourceLocation>); | 54 std::unique_ptr<SourceLocation>); |
| 54 | 55 |
| 55 bool hasConnectedCallback() const override; | 56 bool hasConnectedCallback() const override; |
| 56 bool hasDisconnectedCallback() const override; | 57 bool hasDisconnectedCallback() const override; |
| 58 bool hasAdoptedCallback() const override; |
| 57 | 59 |
| 58 void runConnectedCallback(Element*) override; | 60 void runConnectedCallback(Element*) override; |
| 59 void runDisconnectedCallback(Element*) override; | 61 void runDisconnectedCallback(Element*) override; |
| 62 void runAdoptedCallback(Element*) override; |
| 60 void runAttributeChangedCallback(Element*, const QualifiedName&, | 63 void runAttributeChangedCallback(Element*, const QualifiedName&, |
| 61 const AtomicString& oldValue, const AtomicString& newValue) override; | 64 const AtomicString& oldValue, const AtomicString& newValue) override; |
| 62 | 65 |
| 63 private: | 66 private: |
| 64 ScriptCustomElementDefinition( | 67 ScriptCustomElementDefinition( |
| 65 ScriptState*, | 68 ScriptState*, |
| 66 const CustomElementDescriptor&, | 69 const CustomElementDescriptor&, |
| 67 const v8::Local<v8::Object>& constructor, | 70 const v8::Local<v8::Object>& constructor, |
| 68 const v8::Local<v8::Object>& prototype, | 71 const v8::Local<v8::Object>& prototype, |
| 69 const v8::Local<v8::Function>& connectedCallback, | 72 const v8::Local<v8::Function>& connectedCallback, |
| 70 const v8::Local<v8::Function>& disconnectedCallback, | 73 const v8::Local<v8::Function>& disconnectedCallback, |
| 74 const v8::Local<v8::Function>& adoptedCallback, |
| 71 const v8::Local<v8::Function>& attributeChangedCallback, | 75 const v8::Local<v8::Function>& attributeChangedCallback, |
| 72 const HashSet<AtomicString>& observedAttributes); | 76 const HashSet<AtomicString>& observedAttributes); |
| 73 | 77 |
| 74 // Implementations of |CustomElementDefinition| | 78 // Implementations of |CustomElementDefinition| |
| 75 ScriptValue getConstructorForScript() final; | 79 ScriptValue getConstructorForScript() final; |
| 76 bool runConstructor(Element*) override; | 80 bool runConstructor(Element*) override; |
| 77 Element* runConstructor(); | 81 Element* runConstructor(); |
| 78 | 82 |
| 79 void runCallback(v8::Local<v8::Function>, Element*, | 83 void runCallback(v8::Local<v8::Function>, Element*, |
| 80 int argc = 0, v8::Local<v8::Value> argv[] = nullptr); | 84 int argc = 0, v8::Local<v8::Value> argv[] = nullptr); |
| 81 | 85 |
| 82 RefPtr<ScriptState> m_scriptState; | 86 RefPtr<ScriptState> m_scriptState; |
| 83 ScopedPersistent<v8::Object> m_constructor; | 87 ScopedPersistent<v8::Object> m_constructor; |
| 84 ScopedPersistent<v8::Object> m_prototype; | 88 ScopedPersistent<v8::Object> m_prototype; |
| 85 ScopedPersistent<v8::Function> m_connectedCallback; | 89 ScopedPersistent<v8::Function> m_connectedCallback; |
| 86 ScopedPersistent<v8::Function> m_disconnectedCallback; | 90 ScopedPersistent<v8::Function> m_disconnectedCallback; |
| 91 ScopedPersistent<v8::Function> m_adoptedCallback; |
| 87 ScopedPersistent<v8::Function> m_attributeChangedCallback; | 92 ScopedPersistent<v8::Function> m_attributeChangedCallback; |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 } // namespace blink | 95 } // namespace blink |
| 91 | 96 |
| 92 #endif // ScriptCustomElementDefinition_h | 97 #endif // ScriptCustomElementDefinition_h |
| OLD | NEW |