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 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| 111 * @return {boolean} | 117 * @return {boolean} |
| 112 */ | 118 */ |
| 113 showNoSyncedMessage: function(signInState, syncedDevicesLength) { | 119 showNoSyncedMessage: function(signInState, syncedDevicesLength) { |
| 120 if (this.guestSession_) | |
| 121 return true; | |
|
calamity
2016/07/21 04:56:49
nit: Newline after early return.
lshang
2016/07/21 07:09:55
Done.
| |
| 114 return signInState && syncedDevicesLength == 0; | 122 return signInState && syncedDevicesLength == 0; |
| 115 }, | 123 }, |
| 116 | 124 |
| 117 /** | 125 /** |
| 126 * Decide whether or not should hide sign in guide. | |
|
calamity
2016/07/21 04:56:49
* Hides the signin guide when the user is already
lshang
2016/07/21 07:09:55
Done.
| |
| 127 * @param {boolean} signInState | |
| 128 * @return {boolean} | |
| 129 */ | |
| 130 hideSignInGuide: function(signInState) { | |
|
calamity
2016/07/21 04:56:49
Maybe make this 'showSignInGuide' and invert every
lshang
2016/07/21 07:09:55
Done. Yeah I was also thinking of this, this is pr
| |
| 131 return signInState || this.guestSession_; | |
| 132 }, | |
| 133 | |
| 134 /** | |
| 118 * Decide what message should be displayed when user is logged in and there | 135 * Decide what message should be displayed when user is logged in and there |
| 119 * are no synced tabs. | 136 * are no synced tabs. |
| 120 * @param {boolean} fetchingSyncedTabs | 137 * @param {boolean} fetchingSyncedTabs |
| 121 * @return {string} | 138 * @return {string} |
| 122 */ | 139 */ |
| 123 noSyncedTabsMessage: function(fetchingSyncedTabs) { | 140 noSyncedTabsMessage: function(fetchingSyncedTabs) { |
| 124 return loadTimeData.getString( | 141 return loadTimeData.getString( |
| 125 fetchingSyncedTabs ? 'loading' : 'noSyncedResults'); | 142 fetchingSyncedTabs ? 'loading' : 'noSyncedResults'); |
| 126 }, | 143 }, |
| 127 | 144 |
| (...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 | 195 // User signed in, show the loading message when querying for synced |
| 179 // devices. | 196 // devices. |
| 180 this.fetchingSyncedTabs_ = true; | 197 this.fetchingSyncedTabs_ = true; |
| 181 }, | 198 }, |
| 182 | 199 |
| 183 searchTermChanged: function(searchedTerm) { | 200 searchTermChanged: function(searchedTerm) { |
| 184 this.clearDisplayedSyncedDevices_(); | 201 this.clearDisplayedSyncedDevices_(); |
| 185 this.updateSyncedDevices(this.sessionList); | 202 this.updateSyncedDevices(this.sessionList); |
| 186 } | 203 } |
| 187 }); | 204 }); |
| OLD | NEW |