| 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 27 matching lines...) Expand all Loading... |
| 38 value: function() { return []; } | 38 value: function() { return []; } |
| 39 }, | 39 }, |
| 40 | 40 |
| 41 /** @private */ | 41 /** @private */ |
| 42 signInState_: { | 42 signInState_: { |
| 43 type: Boolean, | 43 type: Boolean, |
| 44 value: loadTimeData.getBoolean('isUserSignedIn'), | 44 value: loadTimeData.getBoolean('isUserSignedIn'), |
| 45 }, | 45 }, |
| 46 | 46 |
| 47 /** @private */ | 47 /** @private */ |
| 48 guestSession_: { |
| 49 type: Boolean, |
| 50 value: loadTimeData.getBoolean('isGuestSession'), |
| 51 }, |
| 52 |
| 53 /** @private */ |
| 48 fetchingSyncedTabs_: { | 54 fetchingSyncedTabs_: { |
| 49 type: Boolean, | 55 type: Boolean, |
| 50 value: false, | 56 value: false, |
| 51 } | 57 } |
| 52 }, | 58 }, |
| 53 | 59 |
| 54 /** | 60 /** |
| 55 * @param {!ForeignSession} session | 61 * @param {!ForeignSession} session |
| 56 * @return {!ForeignDeviceInternal} | 62 * @return {!ForeignDeviceInternal} |
| 57 */ | 63 */ |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 107 |
| 102 /** @private */ | 108 /** @private */ |
| 103 clearDisplayedSyncedDevices_: function() { | 109 clearDisplayedSyncedDevices_: function() { |
| 104 this.syncedDevices_ = []; | 110 this.syncedDevices_ = []; |
| 105 }, | 111 }, |
| 106 | 112 |
| 107 /** | 113 /** |
| 108 * Decide whether or not should display no synced tabs message. | 114 * Decide whether or not should display no synced tabs message. |
| 109 * @param {boolean} signInState | 115 * @param {boolean} signInState |
| 110 * @param {number} syncedDevicesLength | 116 * @param {number} syncedDevicesLength |
| 117 * @param {boolean} guestSession |
| 111 * @return {boolean} | 118 * @return {boolean} |
| 112 */ | 119 */ |
| 113 showNoSyncedMessage: function(signInState, syncedDevicesLength) { | 120 showNoSyncedMessage: function( |
| 121 signInState, syncedDevicesLength, guestSession) { |
| 122 if (guestSession) |
| 123 return true; |
| 124 |
| 114 return signInState && syncedDevicesLength == 0; | 125 return signInState && syncedDevicesLength == 0; |
| 115 }, | 126 }, |
| 116 | 127 |
| 117 /** | 128 /** |
| 129 * Shows the signin guide when the user is not signed in and not in a guest |
| 130 * session. |
| 131 * @param {boolean} signInState |
| 132 * @param {boolean} guestSession |
| 133 * @return {boolean} |
| 134 */ |
| 135 showSignInGuide: function(signInState, guestSession) { |
| 136 return !signInState && !guestSession; |
| 137 }, |
| 138 |
| 139 /** |
| 118 * Decide what message should be displayed when user is logged in and there | 140 * Decide what message should be displayed when user is logged in and there |
| 119 * are no synced tabs. | 141 * are no synced tabs. |
| 120 * @param {boolean} fetchingSyncedTabs | 142 * @param {boolean} fetchingSyncedTabs |
| 121 * @return {string} | 143 * @return {string} |
| 122 */ | 144 */ |
| 123 noSyncedTabsMessage: function(fetchingSyncedTabs) { | 145 noSyncedTabsMessage: function(fetchingSyncedTabs) { |
| 124 return loadTimeData.getString( | 146 return loadTimeData.getString( |
| 125 fetchingSyncedTabs ? 'loading' : 'noSyncedResults'); | 147 fetchingSyncedTabs ? 'loading' : 'noSyncedResults'); |
| 126 }, | 148 }, |
| 127 | 149 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // User signed in, show the loading message when querying for synced | 200 // User signed in, show the loading message when querying for synced |
| 179 // devices. | 201 // devices. |
| 180 this.fetchingSyncedTabs_ = true; | 202 this.fetchingSyncedTabs_ = true; |
| 181 }, | 203 }, |
| 182 | 204 |
| 183 searchTermChanged: function(searchTerm) { | 205 searchTermChanged: function(searchTerm) { |
| 184 this.clearDisplayedSyncedDevices_(); | 206 this.clearDisplayedSyncedDevices_(); |
| 185 this.updateSyncedDevices(this.sessionList); | 207 this.updateSyncedDevices(this.sessionList); |
| 186 } | 208 } |
| 187 }); | 209 }); |
| OLD | NEW |