| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class WrapperTypeInfo; | 54 class WrapperTypeInfo; |
| 55 | 55 |
| 56 // Handles the scripting-specific parts of the Custom Elements element | 56 // Handles the scripting-specific parts of the Custom Elements element |
| 57 // registration algorithm and constructor generation algorithm. It is | 57 // registration algorithm and constructor generation algorithm. It is |
| 58 // used in the implementation of those algorithms in | 58 // used in the implementation of those algorithms in |
| 59 // Document::registerElement. | 59 // Document::registerElement. |
| 60 class CustomElementConstructorBuilder { | 60 class CustomElementConstructorBuilder { |
| 61 WTF_MAKE_NONCOPYABLE(CustomElementConstructorBuilder); | 61 WTF_MAKE_NONCOPYABLE(CustomElementConstructorBuilder); |
| 62 public: | 62 public: |
| 63 CustomElementConstructorBuilder(ScriptState*, const Dictionary* options); | 63 CustomElementConstructorBuilder(ScriptState*, const Dictionary* options); |
| 64 virtual ~CustomElementConstructorBuilder() { } |
| 64 | 65 |
| 65 // The builder accumulates state and may run script at specific | 66 // The builder accumulates state and may run script at specific |
| 66 // points. These methods must be called in order. When one fails | 67 // points. These methods must be called in order. When one fails |
| 67 // (returns false), the calls must stop. | 68 // (returns false), the calls must stop. |
| 68 | 69 |
| 69 bool isFeatureAllowed() const; | 70 virtual bool isFeatureAllowed() const; |
| 70 bool validateOptions(const AtomicString& type, ExceptionState&); | 71 virtual bool validateOptions(const AtomicString& type, ExceptionState&); |
| 71 bool findTagName(const AtomicString& customElementType, QualifiedName& tagNa
me); | 72 virtual bool findTagName(const AtomicString& customElementType, QualifiedNam
e& tagName); |
| 72 PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks(); | 73 virtual PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks(); |
| 73 bool createConstructor(Document*, CustomElementDefinition*, ExceptionState&)
; | 74 virtual bool createConstructor(Document*, CustomElementDefinition*, Exceptio
nState&); |
| 74 bool didRegisterDefinition(CustomElementDefinition*) const; | 75 virtual bool didRegisterDefinition(CustomElementDefinition*) const; |
| 75 | 76 |
| 76 // This method collects a return value for the bindings. It is | 77 // This method collects a return value for the bindings. It is |
| 77 // safe to call this method even if the builder failed; it will | 78 // safe to call this method even if the builder failed; it will |
| 78 // return an empty value. | 79 // return an empty value. |
| 79 ScriptValue bindingsReturnValue() const; | 80 virtual ScriptValue bindingsReturnValue() const; |
| 80 | 81 |
| 81 private: | 82 private: |
| 82 static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); | 83 static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); |
| 83 bool hasValidPrototypeChainFor(V8PerContextData*, WrapperTypeInfo*) const; | 84 bool hasValidPrototypeChainFor(V8PerContextData*, WrapperTypeInfo*) const; |
| 84 bool prototypeIsValid(const AtomicString& type, ExceptionState&) const; | 85 bool prototypeIsValid(const AtomicString& type, ExceptionState&) const; |
| 85 v8::Handle<v8::Function> retrieveCallback(v8::Isolate*, const char* name); | 86 v8::Handle<v8::Function> retrieveCallback(v8::Isolate*, const char* name); |
| 86 | 87 |
| 87 v8::Handle<v8::Context> m_context; | 88 v8::Handle<v8::Context> m_context; |
| 88 const Dictionary* m_options; | 89 const Dictionary* m_options; |
| 89 v8::Handle<v8::Object> m_prototype; | 90 v8::Handle<v8::Object> m_prototype; |
| 90 WrapperTypeInfo* m_wrapperType; | 91 WrapperTypeInfo* m_wrapperType; |
| 91 AtomicString m_namespaceURI; | 92 AtomicString m_namespaceURI; |
| 92 v8::Handle<v8::Function> m_constructor; | 93 v8::Handle<v8::Function> m_constructor; |
| 93 RefPtr<V8CustomElementLifecycleCallbacks> m_callbacks; | 94 RefPtr<V8CustomElementLifecycleCallbacks> m_callbacks; |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } | 97 } |
| 97 | 98 |
| 98 #endif // CustomElementConstructorBuilder_h | 99 #endif // CustomElementConstructorBuilder_h |
| OLD | NEW |