| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 Polymer({ |
| 6 is: 'history-synced-device-card', |
| 7 |
| 8 properties: { |
| 9 // Name of the synced device. |
| 10 device: { |
| 11 type: String, |
| 12 value: '' |
| 13 }, |
| 14 |
| 15 // When the device information was last updated. |
| 16 lastUpdateTime: { |
| 17 type: String, |
| 18 value: '' |
| 19 }, |
| 20 |
| 21 // The list of tabs open for this device. |
| 22 tabs: { |
| 23 type: Array, |
| 24 value: function() { return []; }, |
| 25 observer: 'updateIcons_' |
| 26 }, |
| 27 |
| 28 // Whether the card is open. |
| 29 cardOpen: { |
| 30 type: Boolean, |
| 31 value: true |
| 32 }, |
| 33 }, |
| 34 |
| 35 /** |
| 36 * Opens all the tabs displayed on the device in separate tabs. |
| 37 * @private |
| 38 */ |
| 39 openAllTabs_: function() { |
| 40 for (var i = 0; i < this.tabs.length; i++) |
| 41 window.open(this.tabs[i].url, '_blank'); |
| 42 }, |
| 43 |
| 44 /** |
| 45 * Toggles the dropdown display of synced tabs for each device card. |
| 46 */ |
| 47 toggleTabCard: function() { |
| 48 this.$.collapse.toggle(); |
| 49 this.$['dropdown-indicator'].icon = |
| 50 this.$.collapse.opened ? 'expand-less' : 'expand-more'; |
| 51 }, |
| 52 |
| 53 /** |
| 54 * When the synced tab information is set, the icon associated with the tab |
| 55 * website is also set. |
| 56 * @private |
| 57 */ |
| 58 updateIcons_: function() { |
| 59 this.async(function() { |
| 60 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); |
| 61 |
| 62 for (var i = 0; i < this.tabs.length; i++) { |
| 63 icons[i].style.backgroundImage = |
| 64 getFaviconImageSet(this.tabs[i].url); |
| 65 } |
| 66 }); |
| 67 } |
| 68 }); |
| OLD | NEW |