1 // Copyright (c) 2012 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 exports.didCreateDocumentElement = function() { 6 var root = document.documentElement.webkitCreateShadowRoot(); 7 root.appendChild(document.createElement('style')).innerText = 8 // TODO(jeremya): switch this to use automatic inlining once grit 9 // supports inlining into JS. See http://crbug.com/146319. 10 "x-titlebar { height: 24px; width: 100%; " + 11 "position: fixed; left: 0; top: 0; }\n" + 12 "div { margin-top: 24px; position: absolute; top: 0px; width: 100%; " + 13 "-webkit-widget-region: region(control rectangle); }\n" + 14 ":-webkit-full-screen * { display: none; }\n" + 15 ":-webkit-full-screen-document * { display: none; }\n" + 16 "div:-webkit-full-screen, div:-webkit-full-screen-document { " + 17 "margin-top: 0; }\n" + 18 "button { -webkit-widget-region: region(control rectangle); }\n" + 19 "button.close { border: 0; background-color: transparent; " + 20 "width: 16px; height: 16px; " + 21 "position: absolute; right: 4px; top: 4px; }\n" + 22 "button.close { background-image: url(data:image/png;base64," + 23 "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA9ElEQVQ4T7VTQQ6CMBCk0H" + 24 "AyIfAQbiZ+QHyDL/QLxqvx4MWDB+MvFAWMAuKsacmmSjkQSDbQ2Z3Z3WkQzsBHDOQ7owgs" + 25 "MdUacTGmi3BeIFYcNycgciGlfFRVtcd3qoojz/PmdV0XOD8RGy1iCoQgT5G8IyREjni7IC" + 26 "cg58ilwA7A8i4BwgMUxkKIV9M0PggTAoFlJpnwLhO5iEuFapq2s20CyoWIGbpeaRICyrI8" + 27 "89FtAtqwGxdQ65yYsV8NcwVN5obR/uTJW4mQsfp2fgToGjPqbBjWeoJVfNRsbSskSO7+7B" + 28 "sAiznZdgu6Qe97lH+htysv+AA10msRAt5JYQAAAABJRU5ErkJggg==); }\n" + 29 "button.close:hover { background-image: url(data:image/png;base64," + 30 "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABTElEQVQ4T2NkoBAwUqifAc" + 31 "WA////KwANFAPiV4yMjA+QDcclBzcApCA6Otpz2bJluQkJCf3z58/fDTMEnxyyAWZADQuA" + 32 "tj4B4ncpKSnbZs+efQjkCqjBmUDmMyD+ADSwD6j2FEgOxQWJiYmuCxYscIYawpWamnr89+" + 33 "/fHECxbKjmB2VlZbs6OzsvwFyHEQZATXZz5syxAGr4BMR8QCwJDYvn1dXVO1taWi4ihw9G" + 34 "LID8m5aWZgt0viXUEBaQAUDNh9E1o3gBFuIgA6Be8QKK3QXiLyA5oNMvIDsdph7DC9AASw" + 35 "cquI9sAJDNk5GRcX769OlHsXoBKapAoQ2KiQcgPwMDkbGrq8sGyP8DChNQwM6aNeswRiAC" + 36 "DYBF4yOgwnuwAAM5NTMz03rGjBnWsIAFql2ANxqB/l2B7F/kgCUYjUBbyEvKsFAllaY4Nw" + 37 "IAmJDPEd+LFvYAAAAASUVORK5CYII=); }\n" + 38 "button.close:active { background-image: url(data:image/png;base64," + 39 "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZ0lEQVQ4T2NkoBAwUqifge" + 40 "oG2AFd1AfERUB8CM11WOXQXXAGSROyITDNMGkTGAPdAHSFIENAAOQqGEBxHbYwQDcE2ScY" + 41 "XsMViNgMwRYuOGOBIgMo8gLFgUi1aCQ7IZGcNaieF0h2AQCMABwRdsuhtQAAAABJRU5Erk" + 42 "Jggg==); }\n" 43 var titlebar = root.appendChild(document.createElement('x-titlebar')); 44 var closeButton = titlebar.appendChild(document.createElement('button')); 45 closeButton.className = 'close' 46 closeButton.addEventListener('click', function() { window.close(); }); 47 var container = root.appendChild(document.createElement('div')); 48 container.appendChild(document.createElement('content')); 49 } 50