OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DictionaryPluginPlaceholder_h | |
6 #define DictionaryPluginPlaceholder_h | |
7 | |
8 #include "core/html/shadow/PluginPlaceholderElement.h" | |
9 #include "core/plugins/PluginPlaceholder.h" | |
10 #include "core/testing/PluginPlaceholderOptions.h" | |
11 #include "wtf/text/WTFString.h" | |
12 | |
13 namespace blink { | |
14 | |
15 // Manipulates a plugin placeholder element based on a fixed dictionary given. | |
16 // Used for layout tests that examine the formatting of structured placeholders. | |
17 class DictionaryPluginPlaceholder final : public NoBaseWillBeGarbageCollected<Di
ctionaryPluginPlaceholder>, public PluginPlaceholder { | |
18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DictionaryPluginPlaceholder); | |
19 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(DictionaryPluginPlaceholder); | |
20 public: | |
21 static PassOwnPtrWillBeRawPtr<DictionaryPluginPlaceholder> create(Document&
document, const PluginPlaceholderOptions& options) | |
22 { | |
23 RefPtrWillBeRawPtr<PluginPlaceholderElement> placeholder = PluginPlaceho
lderElement::create(document); | |
24 if (options.hasMessage()) | |
25 placeholder->setMessage(options.message()); | |
26 | |
27 if (options.hasCloseable()) | |
28 placeholder->setIsCloseable(options.closeable()); | |
29 | |
30 return adoptPtrWillBeNoop(new DictionaryPluginPlaceholder(placeholder.re
lease())); | |
31 } | |
32 | |
33 #if !ENABLE(OILPAN) | |
34 ~DictionaryPluginPlaceholder() override { } | |
35 #endif | |
36 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_pluginPlaceholderElement);
} | |
37 | |
38 void loadIntoContainer(ContainerNode& container) override | |
39 { | |
40 container.removeChildren(); | |
41 container.appendChild(m_pluginPlaceholderElement, ASSERT_NO_EXCEPTION); | |
42 } | |
43 | |
44 private: | |
45 DictionaryPluginPlaceholder(PassRefPtrWillBeRawPtr<PluginPlaceholderElement>
element) : m_pluginPlaceholderElement(element) { } | |
46 | |
47 RefPtrWillBeMember<PluginPlaceholderElement> m_pluginPlaceholderElement; | |
48 }; | |
49 | |
50 } // namespace blink | |
51 | |
52 #endif // DictionaryPluginPlaceholder_h | |
OLD | NEW |