Chromium Code Reviews| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Then, append any new devices. | 185 // Then, append any new devices. |
| 186 for (var i = updateCount; i < sessionList.length; i++) { | 186 for (var i = updateCount; i < sessionList.length; i++) { |
| 187 this.push('syncedDevices_', this.createInternalDevice_(sessionList[i])); | 187 this.push('syncedDevices_', this.createInternalDevice_(sessionList[i])); |
| 188 } | 188 } |
| 189 }, | 189 }, |
| 190 | 190 |
| 191 /** | 191 /** |
| 192 * End fetching synced tabs when sync is disabled. | |
| 193 */ | |
| 194 tabSyncDisabled: function() { | |
| 195 this.fetchingSyncedTabs_ = false; | |
|
tsergeant
2016/08/08 04:49:15
This doesn't quite work as intended in all cases:
lshang
2016/08/09 00:39:29
Done. Thanks for reminding:P
| |
| 196 }, | |
| 197 | |
| 198 /** | |
| 192 * Get called when user's sign in state changes, this will affect UI of synced | 199 * Get called when user's sign in state changes, this will affect UI of synced |
| 193 * tabs page. Sign in promo gets displayed when user is signed out, and | 200 * tabs page. Sign in promo gets displayed when user is signed out, and |
| 194 * different messages are shown when there are no synced tabs. | 201 * different messages are shown when there are no synced tabs. |
| 195 * @param {boolean} isUserSignedIn | 202 * @param {boolean} isUserSignedIn |
| 196 */ | 203 */ |
| 197 updateSignInState: function(isUserSignedIn) { | 204 updateSignInState: function(isUserSignedIn) { |
| 198 // If user's sign in state didn't change, then don't change message or | 205 // If user's sign in state didn't change, then don't change message or |
| 199 // update UI. | 206 // update UI. |
| 200 if (this.signInState_ == isUserSignedIn) | 207 if (this.signInState_ == isUserSignedIn) |
| 201 return; | 208 return; |
| 202 | 209 |
| 203 this.signInState_ = isUserSignedIn; | 210 this.signInState_ = isUserSignedIn; |
| 204 | 211 |
| 205 // User signed out, clear synced device list and show the sign in promo. | 212 // User signed out, clear synced device list and show the sign in promo. |
| 206 if (!isUserSignedIn) { | 213 if (!isUserSignedIn) { |
| 207 this.clearDisplayedSyncedDevices_(); | 214 this.clearDisplayedSyncedDevices_(); |
| 208 return; | 215 return; |
| 209 } | 216 } |
| 210 // User signed in, show the loading message when querying for synced | 217 // User signed in, show the loading message when querying for synced |
| 211 // devices. | 218 // devices. |
| 212 this.fetchingSyncedTabs_ = true; | 219 this.fetchingSyncedTabs_ = true; |
| 213 }, | 220 }, |
| 214 | 221 |
| 215 searchTermChanged: function(searchTerm) { | 222 searchTermChanged: function(searchTerm) { |
| 216 this.clearDisplayedSyncedDevices_(); | 223 this.clearDisplayedSyncedDevices_(); |
| 217 this.updateSyncedDevices(this.sessionList); | 224 this.updateSyncedDevices(this.sessionList); |
| 218 } | 225 } |
| 219 }); | 226 }); |
| OLD | NEW |