| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 #ifndef DartCustomElementConstructorBuilder_h | |
| 32 #define DartCustomElementConstructorBuilder_h | |
| 33 | |
| 34 #include "bindings/core/v8/CustomElementConstructorBuilder.h" | |
| 35 | |
| 36 #include <dart_api.h> | |
| 37 #include <v8.h> | |
| 38 | |
| 39 namespace blink { | |
| 40 | |
| 41 class CustomElementDefinition; | |
| 42 class DartCustomElementLifecycleCallbacks; | |
| 43 class Dictionary; | |
| 44 class Document; | |
| 45 class ExceptionState; | |
| 46 class QualifiedName; | |
| 47 class ScriptState; | |
| 48 | |
| 49 | |
| 50 // Handles the scripting-specific parts of the Custom Elements element | |
| 51 // registration algorithm and constructor generation algorithm. It is | |
| 52 // used in the implementation of those algorithms in | |
| 53 // Document::registerElement. | |
| 54 class DartCustomElementConstructorBuilder : public CustomElementConstructorBuild
er { | |
| 55 WTF_MAKE_NONCOPYABLE(DartCustomElementConstructorBuilder); | |
| 56 public: | |
| 57 DartCustomElementConstructorBuilder(Dart_Handle type, const AtomicString& ex
tendsTagName, DartScriptState*, const Dictionary* options); | |
| 58 virtual ~DartCustomElementConstructorBuilder() { } | |
| 59 | |
| 60 // The builder accumulates state and may run script at specific | |
| 61 // points. These methods must be called in order. When one fails | |
| 62 // (returns false), the calls must stop. | |
| 63 | |
| 64 virtual bool isFeatureAllowed() const; | |
| 65 virtual bool validateOptions(const AtomicString& type, QualifiedName& tagNam
e, ExceptionState&); | |
| 66 virtual bool findTagName(const AtomicString& customElementType, QualifiedNam
e& tagName); | |
| 67 virtual PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks(); | |
| 68 virtual bool createConstructor(Document*, CustomElementDefinition*, Exceptio
nState&); | |
| 69 virtual bool didRegisterDefinition(CustomElementDefinition*) const; | |
| 70 | |
| 71 // This method collects a return value for the bindings. It is | |
| 72 // safe to call this method even if the builder failed; it will | |
| 73 // return an empty value. | |
| 74 virtual ScriptValue bindingsReturnValue() const; | |
| 75 | |
| 76 private: | |
| 77 Dart_Handle m_customType; | |
| 78 intptr_t m_nativeClassId; | |
| 79 AtomicString m_namespaceURI; | |
| 80 AtomicString m_extendsTagName; | |
| 81 AtomicString m_localName; | |
| 82 RefPtr<DartScriptState> m_scriptState; | |
| 83 RefPtr<DartCustomElementLifecycleCallbacks> m_callbacks; | |
| 84 }; | |
| 85 | |
| 86 } | |
| 87 | |
| 88 #endif // DartCustomElementConstructorBuilder_h | |
| OLD | NEW |