1<!DOCTYPE html> 2<!-- 3Copyright (c) 2014 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7 8<link rel="import" href="/tracing/ui/base/dom_helpers.html"> 9<link rel="import" href="/tracing/ui/base/ui.html"> 10 11<polymer-element name='tr-ui-b-info-bar' is='HTMLDivElement'> 12 <template> 13 <style> 14 :host { 15 align-items: center; 16 flex: 0 0 auto; 17 background-color: rgb(252, 235, 162); 18 border-bottom: 1px solid #A3A3A3; 19 border-left: 1px solid white; 20 border-right: 1px solid #A3A3A3; 21 border-top: 1px solid white; 22 display: flex; 23 height: 26px; 24 padding: 0 3px 0 3px; 25 } 26 27 :host(.info-bar-hidden) { 28 display: none; 29 } 30 31 #message { flex: 1 1 auto; } 32 </style> 33 34 <span id='message'></span> 35 <span id='buttons'></span> 36 </template> 37 38 <script> 39 'use strict'; 40 41 Polymer({ 42 ready: function() { 43 this.messageEl_ = this.$.message; 44 this.buttonsEl_ = this.$.buttons; 45 46 this.message = ''; 47 this.visible = false; 48 }, 49 50 get message() { 51 return this.messageEl_.textContent; 52 }, 53 54 set message(message) { 55 this.messageEl_.textContent = message; 56 }, 57 58 get visible() { 59 return !this.classList.contains('info-bar-hidden'); 60 }, 61 62 set visible(visible) { 63 if (visible) 64 this.classList.remove('info-bar-hidden'); 65 else 66 this.classList.add('info-bar-hidden'); 67 }, 68 69 removeAllButtons: function() { 70 this.buttonsEl_.textContent = ''; 71 }, 72 73 addButton: function(text, clickCallback) { 74 var button = document.createElement('button'); 75 button.textContent = text; 76 button.addEventListener('click', clickCallback); 77 this.buttonsEl_.appendChild(button); 78 return button; 79 } 80 }); 81 </script> 82</polymer-element> 83