| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SKY_ENGINE_CORE_DOM_CUSTOM_CUSTOMELEMENTLIFECYCLECALLBACKS_H_ | 31 #ifndef DartCustomElementLifecycleCallbacks_h |
| 32 #define SKY_ENGINE_CORE_DOM_CUSTOM_CUSTOMELEMENTLIFECYCLECALLBACKS_H_ | 32 #define DartCustomElementLifecycleCallbacks_h |
| 33 | 33 |
| 34 #include "sky/engine/wtf/RefCounted.h" | 34 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 35 #include "sky/engine/wtf/text/AtomicString.h" | 35 #include "core/dom/custom/CustomElementLifecycleCallbacks.h" |
| 36 #include "wtf/PassOwnPtr.h" |
| 37 #include "wtf/PassRefPtr.h" |
| 38 |
| 39 #include <dart_api.h> |
| 36 | 40 |
| 37 namespace blink { | 41 namespace blink { |
| 38 | 42 |
| 43 class CustomElementDefinition; |
| 44 class CustomElementLifecycleCallbacks; |
| 45 class DartCustomElementBinding; |
| 46 class DartScriptState; |
| 39 class Element; | 47 class Element; |
| 48 class ExecutionContext; |
| 40 | 49 |
| 41 class CustomElementLifecycleCallbacks : public RefCounted<CustomElementLifecycle
Callbacks> { | 50 class DartCustomElementLifecycleCallbacks : public CustomElementLifecycleCallbac
ks { |
| 42 public: | 51 public: |
| 43 virtual ~CustomElementLifecycleCallbacks() { } | 52 static PassRefPtr<DartCustomElementLifecycleCallbacks> create(DartScriptStat
e*); |
| 44 | 53 |
| 45 enum CallbackType { | 54 virtual ~DartCustomElementLifecycleCallbacks(); |
| 46 None = 0, | |
| 47 CreatedCallback = 1 << 0, | |
| 48 AttachedCallback = 1 << 1, | |
| 49 DetachedCallback = 1 << 2, | |
| 50 AttributeChangedCallback = 1 << 3 | |
| 51 }; | |
| 52 | 55 |
| 53 bool hasCallback(CallbackType type) const { return m_which & type; } | 56 bool setBinding(CustomElementDefinition* owner, PassOwnPtr<DartCustomElement
Binding>); |
| 54 | |
| 55 virtual void created(Element*) = 0; | |
| 56 virtual void attached(Element*) = 0; | |
| 57 virtual void detached(Element*) = 0; | |
| 58 virtual void attributeChanged(Element*, const AtomicString& name, const Atom
icString& oldValue, const AtomicString& newValue) = 0; | |
| 59 | |
| 60 protected: | |
| 61 CustomElementLifecycleCallbacks(CallbackType which) : m_which(which) { } | |
| 62 | 57 |
| 63 private: | 58 private: |
| 64 CallbackType m_which; | 59 DartCustomElementLifecycleCallbacks(DartScriptState*); |
| 60 |
| 61 virtual void created(Element*) OVERRIDE; |
| 62 virtual void attached(Element*) OVERRIDE; |
| 63 virtual void detached(Element*) OVERRIDE; |
| 64 virtual void attributeChanged(Element*, const AtomicString& name, const Atom
icString& oldValue, const AtomicString& newValue) OVERRIDE; |
| 65 |
| 66 void call(const char* methodName, Element*); |
| 67 |
| 68 RefPtr<DartScriptState> m_scriptState; |
| 69 CustomElementDefinition* m_owner; |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 } | 72 } |
| 68 | 73 |
| 69 #endif // SKY_ENGINE_CORE_DOM_CUSTOM_CUSTOMELEMENTLIFECYCLECALLBACKS_H_ | 74 #endif // DartCustomElementLifecycleCallbacks_h |
| OLD | NEW |