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 CustomElementDefinitionBuilder_h | 5 #ifndef CustomElementDefinitionBuilder_h |
6 #define CustomElementDefinitionBuilder_h | 6 #define CustomElementDefinitionBuilder_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class CustomElementDefinition; | 14 class CustomElementDefinition; |
15 class CustomElementDescriptor; | 15 class CustomElementDescriptor; |
16 class CustomElementsRegistry; | 16 class CustomElementsRegistry; |
17 class ExceptionState; | 17 class ExceptionState; |
18 class ScriptState; | 18 class ScriptState; |
19 class ScriptValue; | 19 class ScriptValue; |
20 | 20 |
21 // Implement CustomElementDefinitionBuilder to provide | 21 // Implement CustomElementDefinitionBuilder to provide |
22 // technology-specific steps for CustomElementsRegistry.define. | 22 // technology-specific steps for CustomElementsRegistry.define. |
23 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis
try-define | 23 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis
try-define |
24 class CORE_EXPORT CustomElementDefinitionBuilder { | 24 class CORE_EXPORT CustomElementDefinitionBuilder { |
25 STACK_ALLOCATED(); | 25 STACK_ALLOCATED(); |
26 WTF_MAKE_NONCOPYABLE(CustomElementDefinitionBuilder); | 26 WTF_MAKE_NONCOPYABLE(CustomElementDefinitionBuilder); |
27 public: | 27 public: |
28 CustomElementDefinitionBuilder() { } | 28 CustomElementDefinitionBuilder() = default; |
| 29 virtual ~CustomElementDefinitionBuilder() = default; |
29 | 30 |
30 // This API necessarily sounds JavaScript specific; this implements | 31 // This API necessarily sounds JavaScript specific; this implements |
31 // some steps of the CustomElementsRegistry.define process, which | 32 // some steps of the CustomElementsRegistry.define process, which |
32 // are defined in terms of JavaScript. | 33 // are defined in terms of JavaScript. |
33 | 34 |
34 // Check the constructor is valid. Return false if processing | 35 // Check the constructor is valid. Return false if processing |
35 // should not proceed. | 36 // should not proceed. |
36 virtual bool checkConstructorIntrinsics() = 0; | 37 virtual bool checkConstructorIntrinsics() = 0; |
37 | 38 |
38 // Check the constructor is not already registered in the calling | 39 // Check the constructor is not already registered in the calling |
39 // registry. Return false if processing should not proceed. | 40 // registry. Return false if processing should not proceed. |
40 virtual bool checkConstructorNotRegistered() = 0; | 41 virtual bool checkConstructorNotRegistered() = 0; |
41 | 42 |
42 // Checking the prototype may destroy the window. Return false if | 43 // Checking the prototype may destroy the window. Return false if |
43 // processing should not proceed. | 44 // processing should not proceed. |
44 virtual bool checkPrototype() = 0; | 45 virtual bool checkPrototype() = 0; |
45 | 46 |
46 // Produce the definition. This must produce a definition. | 47 // Produce the definition. This must produce a definition. |
47 virtual CustomElementDefinition* build(const CustomElementDescriptor&) = 0; | 48 virtual CustomElementDefinition* build(const CustomElementDescriptor&) = 0; |
48 }; | 49 }; |
49 | 50 |
50 } // namespace blink | 51 } // namespace blink |
51 | 52 |
52 #endif // CustomElementDefinitionBuilder_h | 53 #endif // CustomElementDefinitionBuilder_h |
OLD | NEW |