Chromium Code Reviews| Index: Source/core/html/shadow/PluginPlaceholderElement.js | 
| diff --git a/Source/core/html/shadow/PluginPlaceholderElement.js b/Source/core/html/shadow/PluginPlaceholderElement.js | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..23c0202044bd5e3748dffe38d3665c6238dc719d | 
| --- /dev/null | 
| +++ b/Source/core/html/shadow/PluginPlaceholderElement.js | 
| @@ -0,0 +1,46 @@ | 
| +// Copyright 2014 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +'use strict'; | 
| + | 
| +installClass('PluginPlaceholderElement', function(PluginPlaceholderElementPrototype) { | 
| + PluginPlaceholderElementPrototype.initializePlaceholderElements = function() { | 
| + // Produces DOM roughly equivalent to the following HTML: | 
| + // | 
| + // <div id="plugin-placeholder"> | 
| + // <div id="plugin-placeholder-content"> | 
| + // <div id="plugin-placeholder-message"></div> | 
| + // </div> | 
| + // </div> | 
| + // | 
| + // FIXME: Move style out of script and into CSS. | 
| 
 
haraken
2014/08/31 14:53:34
This is something Blink-in-JS needs to support. Do
 
jbroman
2014/08/31 16:53:50
The simplest approach for my needs so far (and Phi
 
haraken
2014/09/01 00:47:38
Yes, I believe this is a right way to go. I'll com
 
 | 
| + | 
| + this.id = 'plugin-placeholder'; | 
| + this.style.width = '100%'; | 
| + this.style.height = '100%'; | 
| + this.style.overflow = 'hidden'; | 
| + this.style.display = 'flex'; | 
| + this.style.alignItems = 'center'; | 
| + this.style.backgroundColor = 'gray'; | 
| + this.style.font = '12px -webkit-control'; | 
| + | 
| + var contentElement = document.createElement('div'); | 
| + contentElement.id = 'plugin-placeholder-content'; | 
| + contentElement.style.textAlign = 'center'; | 
| + contentElement.style.margin = 'auto'; | 
| + | 
| + var messageElement = document.createElement('div'); | 
| + messageElement.id = 'plugin-placeholder-message'; | 
| + | 
| + contentElement.appendChild(messageElement); | 
| + this.appendChild(contentElement); | 
| + | 
| + this.messageElement = messageElement; | 
| + }; | 
| + | 
| + Object.defineProperty(PluginPlaceholderElementPrototype, 'message', { | 
| + get: function() { return this.messageElement.innerHTML; }, | 
| + set: function(html) { this.messageElement.innerHTML = html; }, | 
| 
 
haraken
2014/08/31 14:53:34
What happens if |html| contains <script> tags? Isn
 
jbroman
2014/08/31 16:53:50
It should not be possible for author script to rea
 
jbroman
2014/08/31 19:00:51
Though now that this is in JavaScript, the possibi
 
haraken
2014/09/01 00:47:38
I'm not familiar with how the plugin placeholder e
 
 | 
| + }); | 
| +}); |