OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @typedef {{device: string, | 6 * @typedef {{device: string, |
7 * lastUpdateTime: string, | 7 * lastUpdateTime: string, |
8 * separatorIndexes: !Array<number>, | 8 * separatorIndexes: !Array<number>, |
9 * timestamp: number, | 9 * timestamp: number, |
10 * tabs: !Array<!ForeignSessionTab>, | 10 * tabs: !Array<!ForeignSessionTab>, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 }, | 52 }, |
53 | 53 |
54 /** | 54 /** |
55 * @param {!ForeignSession} session | 55 * @param {!ForeignSession} session |
56 * @return {!ForeignDeviceInternal} | 56 * @return {!ForeignDeviceInternal} |
57 */ | 57 */ |
58 createInternalDevice_: function(session) { | 58 createInternalDevice_: function(session) { |
59 var tabs = []; | 59 var tabs = []; |
60 var separatorIndexes = []; | 60 var separatorIndexes = []; |
61 for (var i = 0; i < session.windows.length; i++) { | 61 for (var i = 0; i < session.windows.length; i++) { |
| 62 var windowId = session.windows[i].sessionId; |
62 var newTabs = session.windows[i].tabs; | 63 var newTabs = session.windows[i].tabs; |
63 if (newTabs.length == 0) | 64 if (newTabs.length == 0) |
64 continue; | 65 continue; |
65 | 66 |
| 67 newTabs.forEach(function(tab) { |
| 68 tab.windowId = windowId; |
| 69 }); |
66 | 70 |
67 if (!this.searchTerm) { | 71 if (!this.searchTerm) { |
68 // Add all the tabs if there is no search term. | 72 // Add all the tabs if there is no search term. |
69 tabs = tabs.concat(newTabs); | 73 tabs = tabs.concat(newTabs); |
70 separatorIndexes.push(tabs.length - 1); | 74 separatorIndexes.push(tabs.length - 1); |
71 } else { | 75 } else { |
72 var searchText = this.searchTerm.toLowerCase(); | 76 var searchText = this.searchTerm.toLowerCase(); |
73 var windowAdded = false; | 77 var windowAdded = false; |
74 for (var j = 0; j < newTabs.length; j++) { | 78 for (var j = 0; j < newTabs.length; j++) { |
75 var tab = newTabs[j]; | 79 var tab = newTabs[j]; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // User signed in, show the loading message when querying for synced | 182 // User signed in, show the loading message when querying for synced |
179 // devices. | 183 // devices. |
180 this.fetchingSyncedTabs_ = true; | 184 this.fetchingSyncedTabs_ = true; |
181 }, | 185 }, |
182 | 186 |
183 searchTermChanged: function(searchTerm) { | 187 searchTermChanged: function(searchTerm) { |
184 this.clearDisplayedSyncedDevices_(); | 188 this.clearDisplayedSyncedDevices_(); |
185 this.updateSyncedDevices(this.sessionList); | 189 this.updateSyncedDevices(this.sessionList); |
186 } | 190 } |
187 }); | 191 }); |
OLD | NEW |