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