| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/html/shadow/PluginPlaceholderElement.h" | 6 #include "core/html/shadow/PluginPlaceholderElement.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/V8PluginPlaceholderElement.h" | 8 #include "bindings/core/v8/V8PluginPlaceholderElement.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/html/HTMLStyleElement.h" |
| 11 #include "public/platform/Platform.h" |
| 10 #include "wtf/Assertions.h" | 12 #include "wtf/Assertions.h" |
| 13 #include "wtf/text/WTFString.h" |
| 11 | 14 |
| 12 namespace blink { | 15 namespace blink { |
| 13 | 16 |
| 14 PluginPlaceholderElement::PluginPlaceholderElement(Document& document) | 17 PluginPlaceholderElement::PluginPlaceholderElement(Document& document) |
| 15 : HTMLDivElement(document) | 18 : HTMLDivElement(document) |
| 16 { | 19 { |
| 17 ScriptWrappable::init(this); | 20 ScriptWrappable::init(this); |
| 18 } | 21 } |
| 19 | 22 |
| 20 PassRefPtrWillBeRawPtr<PluginPlaceholderElement> PluginPlaceholderElement::creat
e(Document& document) | 23 PassRefPtrWillBeRawPtr<PluginPlaceholderElement> PluginPlaceholderElement::creat
e(Document& document) |
| 21 { | 24 { |
| 22 RefPtrWillBeRawPtr<PluginPlaceholderElement> element = adoptRefWillBeNoop(ne
w PluginPlaceholderElement(document)); | 25 RefPtrWillBeRawPtr<PluginPlaceholderElement> element = adoptRefWillBeNoop(ne
w PluginPlaceholderElement(document)); |
| 23 bool success = V8PluginPlaceholderElement::PrivateScript::createCallbackMeth
od(document.frame(), element.get()); | 26 bool success = V8PluginPlaceholderElement::PrivateScript::createCallbackMeth
od(document.frame(), element.get()); |
| 24 ASSERT_UNUSED(success, success); | 27 ASSERT_UNUSED(success, success); |
| 25 return element.release(); | 28 return element.release(); |
| 26 } | 29 } |
| 27 | 30 |
| 28 void PluginPlaceholderElement::setMessage(const String& htmlMessage) | 31 void PluginPlaceholderElement::setMessage(const String& htmlMessage) |
| 29 { | 32 { |
| 30 bool success = V8PluginPlaceholderElement::PrivateScript::messageAttributeSe
tter(document().frame(), this, htmlMessage); | 33 bool success = V8PluginPlaceholderElement::PrivateScript::messageAttributeSe
tter(document().frame(), this, htmlMessage); |
| 31 ASSERT_UNUSED(success, success); | 34 ASSERT_UNUSED(success, success); |
| 32 } | 35 } |
| 33 | 36 |
| 37 PassRefPtrWillBeRawPtr<HTMLStyleElement> PluginPlaceholderElement::createStyleEl
ement() |
| 38 { |
| 39 const WebData& styleData = Platform::current()->loadResource("PluginPlacehol
derElement.css"); |
| 40 ASSERT(!styleData.isEmpty()); |
| 41 String styleSource(styleData.data(), styleData.size()); |
| 42 RefPtrWillBeRawPtr<HTMLStyleElement> styleElement = HTMLStyleElement::create
(document(), false); |
| 43 styleElement->setTextContent(styleSource); |
| 44 styleElement->whitelistSource(styleSource); |
| 45 return styleElement.release(); |
| 46 } |
| 47 |
| 34 } // namespace blink | 48 } // namespace blink |
| OLD | NEW |