Chromium Code Reviews| Index: chrome/browser/resources/md_history/synced_device_manager.js |
| diff --git a/chrome/browser/resources/md_history/synced_device_manager.js b/chrome/browser/resources/md_history/synced_device_manager.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..92ccbec45f032703b769a8e6970b178439bcdab5 |
| --- /dev/null |
| +++ b/chrome/browser/resources/md_history/synced_device_manager.js |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +Polymer({ |
| + is: 'history-synced-device-manager', |
| + |
| + properties: { |
| + // An array of synced devices with synced tab data. |
| + syncedDevices: { |
| + type: Array, |
| + value: function() { return []; } |
| + } |
| + }, |
| + |
| + /** |
| + * Adds |sessionList| to the currently displayed synced tabs. |
| + * @param {Object} sessionList |
| + */ |
| + addSyncedHistory: function(sessionList) { |
| + // TODO(calamity): Does not add more items onto the page when the |
| + // sessionList updates. Update the cards dynamically by refreshing the tab |
| + // list and last update time for each synced tab card. |
| + if (this.syncedDevices.length > 0) { |
|
tsergeant
2016/03/09 04:36:50
Nit: {}
calamity
2016/03/10 04:18:24
Done.
|
| + return; |
| + } |
| + |
| + for (var i = 0; i < sessionList.length; i++) { |
| + var tabs = []; |
| + for (var j = 0; j < sessionList[i].windows.length; j++) { |
| + tabs = tabs.concat(sessionList[i].windows[j].tabs); |
| + tabs[tabs.length - 1].needsWindowSeparator = true; |
| + } |
| + |
| + this.push('syncedDevices', { |
| + device: sessionList[i].name, |
| + lastUpdateTime: '– ' + sessionList[i].modifiedTime, |
| + tabs: tabs, |
| + }); |
| + } |
| + } |
| +}); |