| 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-manager', |
| 7 |
| 8 properties: { |
| 9 /** |
| 10 * An array of synced devices with synced tab data. |
| 11 * @type {!Array<!{device: string, |
| 12 * lastUpdateTime: string, |
| 13 * tabs: !Array<!ForeignSessionTab>}>} |
| 14 */ |
| 15 syncedDevices: { |
| 16 type: Array, |
| 17 value: function() { return []; } |
| 18 } |
| 19 }, |
| 20 |
| 21 /** |
| 22 * Adds |sessionList| to the currently displayed synced tabs. |
| 23 * @param {!Array<!ForeignSession>} sessionList |
| 24 */ |
| 25 addSyncedHistory: function(sessionList) { |
| 26 // TODO(calamity): Does not add more items onto the page when the |
| 27 // sessionList updates. Update the cards dynamically by refreshing the tab |
| 28 // list and last update time for each synced tab card. |
| 29 if (this.syncedDevices.length > 0) |
| 30 return; |
| 31 |
| 32 for (var i = 0; i < sessionList.length; i++) { |
| 33 var tabs = []; |
| 34 for (var j = 0; j < sessionList[i].windows.length; j++) { |
| 35 var newTabs = sessionList[i].windows[j].tabs; |
| 36 if (newTabs.length == 0) |
| 37 continue; |
| 38 |
| 39 tabs = tabs.concat(newTabs); |
| 40 tabs[tabs.length - 1].needsWindowSeparator = true; |
| 41 } |
| 42 |
| 43 this.push('syncedDevices', { |
| 44 device: sessionList[i].name, |
| 45 lastUpdateTime: '– ' + sessionList[i].modifiedTime, |
| 46 tabs: tabs, |
| 47 }); |
| 48 } |
| 49 } |
| 50 }); |
| OLD | NEW |