| 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 * opened: boolean, | 8 * opened: boolean, |
| 9 * separatorIndexes: !Array<number>, | 9 * separatorIndexes: !Array<number>, |
| 10 * timestamp: number, | 10 * timestamp: number, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 /** | 33 /** |
| 34 * An array of synced devices with synced tab data. | 34 * An array of synced devices with synced tab data. |
| 35 * @type {!Array<!ForeignDeviceInternal>} | 35 * @type {!Array<!ForeignDeviceInternal>} |
| 36 */ | 36 */ |
| 37 syncedDevices_: { | 37 syncedDevices_: { |
| 38 type: Array, | 38 type: Array, |
| 39 value: function() { return []; } | 39 value: function() { return []; } |
| 40 }, | 40 }, |
| 41 | 41 |
| 42 /** @private */ | 42 /** @private */ |
| 43 signInState_: { | 43 signInState: { |
| 44 type: Boolean, | 44 type: Boolean, |
| 45 value: loadTimeData.getBoolean('isUserSignedIn'), | 45 observer: 'signInStateChanged_', |
| 46 }, | 46 }, |
| 47 | 47 |
| 48 /** @private */ | 48 /** @private */ |
| 49 guestSession_: { | 49 guestSession_: { |
| 50 type: Boolean, | 50 type: Boolean, |
| 51 value: loadTimeData.getBoolean('isGuestSession'), | 51 value: loadTimeData.getBoolean('isGuestSession'), |
| 52 }, | 52 }, |
| 53 | 53 |
| 54 /** @private */ | 54 /** @private */ |
| 55 fetchingSyncedTabs_: { | 55 fetchingSyncedTabs_: { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 */ | 236 */ |
| 237 tabSyncDisabled: function() { | 237 tabSyncDisabled: function() { |
| 238 this.fetchingSyncedTabs_ = false; | 238 this.fetchingSyncedTabs_ = false; |
| 239 this.clearDisplayedSyncedDevices_(); | 239 this.clearDisplayedSyncedDevices_(); |
| 240 }, | 240 }, |
| 241 | 241 |
| 242 /** | 242 /** |
| 243 * Get called when user's sign in state changes, this will affect UI of synced | 243 * Get called when user's sign in state changes, this will affect UI of synced |
| 244 * tabs page. Sign in promo gets displayed when user is signed out, and | 244 * tabs page. Sign in promo gets displayed when user is signed out, and |
| 245 * different messages are shown when there are no synced tabs. | 245 * different messages are shown when there are no synced tabs. |
| 246 * @param {boolean} isUserSignedIn | |
| 247 */ | 246 */ |
| 248 updateSignInState: function(isUserSignedIn) { | 247 signInStateChanged_: function() { |
| 249 // If user's sign in state didn't change, then don't change message or | 248 this.fire('history-view-changed'); |
| 250 // update UI. | |
| 251 if (this.signInState_ == isUserSignedIn) | |
| 252 return; | |
| 253 | |
| 254 this.signInState_ = isUserSignedIn; | |
| 255 | 249 |
| 256 // User signed out, clear synced device list and show the sign in promo. | 250 // User signed out, clear synced device list and show the sign in promo. |
| 257 if (!isUserSignedIn) { | 251 if (!this.signInState) { |
| 258 this.clearDisplayedSyncedDevices_(); | 252 this.clearDisplayedSyncedDevices_(); |
| 259 return; | 253 return; |
| 260 } | 254 } |
| 261 // User signed in, show the loading message when querying for synced | 255 // User signed in, show the loading message when querying for synced |
| 262 // devices. | 256 // devices. |
| 263 this.fetchingSyncedTabs_ = true; | 257 this.fetchingSyncedTabs_ = true; |
| 264 }, | 258 }, |
| 265 | 259 |
| 266 searchTermChanged: function(searchTerm) { | 260 searchTermChanged: function(searchTerm) { |
| 267 this.clearDisplayedSyncedDevices_(); | 261 this.clearDisplayedSyncedDevices_(); |
| 268 this.updateSyncedDevices(this.sessionList); | 262 this.updateSyncedDevices(this.sessionList); |
| 269 } | 263 } |
| 270 }); | 264 }); |
| OLD | NEW |