| 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 /** |
| 22 * The list of tabs open for this device. |
| 23 * @type {!Array<!ForeignSessionTab>} |
| 24 */ |
| 25 tabs: { |
| 26 type: Array, |
| 27 value: function() { return []; }, |
| 28 observer: 'updateIcons_' |
| 29 }, |
| 30 |
| 31 // Whether the card is open. |
| 32 cardOpen_: { |
| 33 type: Boolean, |
| 34 value: true |
| 35 }, |
| 36 }, |
| 37 |
| 38 /** |
| 39 * Opens all the tabs displayed on the device in separate tabs. |
| 40 * @private |
| 41 */ |
| 42 openAllTabs_: function() { |
| 43 // TODO(calamity): add a warning if an excessive number of tabs will open. |
| 44 for (var i = 0; i < this.tabs.length; i++) |
| 45 window.open(this.tabs[i].url, '_blank'); |
| 46 }, |
| 47 |
| 48 /** |
| 49 * Toggles the dropdown display of synced tabs for each device card. |
| 50 */ |
| 51 toggleTabCard: function() { |
| 52 this.$.collapse.toggle(); |
| 53 this.$['dropdown-indicator'].icon = |
| 54 this.$.collapse.opened ? 'expand-less' : 'expand-more'; |
| 55 }, |
| 56 |
| 57 /** |
| 58 * When the synced tab information is set, the icon associated with the tab |
| 59 * website is also set. |
| 60 * @private |
| 61 */ |
| 62 updateIcons_: function() { |
| 63 this.async(function() { |
| 64 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); |
| 65 |
| 66 for (var i = 0; i < this.tabs.length; i++) { |
| 67 icons[i].style.backgroundImage = |
| 68 getFaviconImageSet(this.tabs[i].url); |
| 69 } |
| 70 }); |
| 71 } |
| 72 }); |
| OLD | NEW |