| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{actionLinkText: (string|undefined), | 8 * @typedef {{actionLinkText: (string|undefined), |
| 9 * accountInfo: (string|undefined), | 9 * accountInfo: (string|undefined), |
| 10 * childUser: (boolean|undefined), | 10 * childUser: (boolean|undefined), |
| 11 * hasError: (boolean|undefined), | 11 * hasError: (boolean|undefined), |
| 12 * hasUnrecoverableError: (boolean|undefined), | 12 * hasUnrecoverableError: (boolean|undefined), |
| 13 * managed: (boolean|undefined), | 13 * managed: (boolean|undefined), |
| 14 * setupCompleted: (boolean|undefined), | 14 * setupCompleted: (boolean|undefined), |
| 15 * setupInProgress: (boolean|undefined), | 15 * setupInProgress: (boolean|undefined), |
| 16 * signedIn: (boolean|undefined), | 16 * signedIn: (boolean|undefined), |
| 17 * signinAllowed: (boolean|undefined), | 17 * signinAllowed: (boolean|undefined), |
| 18 * signoutAllowed: (boolean|undefined), | 18 * signoutAllowed: (boolean|undefined), |
| 19 * statusAction: (string|undefined), |
| 19 * statusText: (string|undefined), | 20 * statusText: (string|undefined), |
| 20 * supervisedUser: (boolean|undefined), | 21 * supervisedUser: (boolean|undefined), |
| 21 * syncSystemEnabled: (boolean|undefined)}} | 22 * syncSystemEnabled: (boolean|undefined)}} |
| 22 * @see chrome/browser/ui/webui/options/browser_options_handler.cc | 23 * @see chrome/browser/ui/webui/options/browser_options_handler.cc |
| 23 */ | 24 */ |
| 24 options.SyncStatus; | 25 options.SyncStatus; |
| 25 | 26 |
| 26 /** | 27 /** |
| 27 * @typedef {{id: string, name: string}} | 28 * @typedef {{id: string, name: string}} |
| 28 */ | 29 */ |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 statusSet || | 1207 statusSet || |
| 1207 (cr.isChromeOS && UIAccountTweaks.loggedInAsPublicAccount()); | 1208 (cr.isChromeOS && UIAccountTweaks.loggedInAsPublicAccount()); |
| 1208 $('sync-status').hidden = !statusSet; | 1209 $('sync-status').hidden = !statusSet; |
| 1209 | 1210 |
| 1210 $('sync-action-link').textContent = syncData.actionLinkText; | 1211 $('sync-action-link').textContent = syncData.actionLinkText; |
| 1211 // Don't show the action link if it is empty or undefined. | 1212 // Don't show the action link if it is empty or undefined. |
| 1212 $('sync-action-link').hidden = syncData.actionLinkText.length == 0; | 1213 $('sync-action-link').hidden = syncData.actionLinkText.length == 0; |
| 1213 $('sync-action-link').disabled = syncData.managed || | 1214 $('sync-action-link').disabled = syncData.managed || |
| 1214 !syncData.syncSystemEnabled; | 1215 !syncData.syncSystemEnabled; |
| 1215 | 1216 |
| 1216 // On Chrome OS, sign out the user and sign in again to get fresh | |
| 1217 // credentials on auth errors. | |
| 1218 $('sync-action-link').onclick = function(event) { | 1217 $('sync-action-link').onclick = function(event) { |
| 1219 if (cr.isChromeOS && syncData.hasError) | 1218 switch (syncData.statusAction) { |
| 1220 SyncSetupOverlay.doSignOutOnAuthError(); | 1219 case 'reauthenticate': |
| 1221 else | 1220 <if expr="chromeos"> |
| 1222 SyncSetupOverlay.showSetupUI(); | 1221 // On Chrome OS, sign out the user and sign in again to get fresh |
| 1222 // credentials on auth errors. |
| 1223 SyncSetupOverlay.doSignOutOnAuthError(); |
| 1224 </if> |
| 1225 <if expr="not chromeos"> |
| 1226 if (syncData.signoutAllowed) { |
| 1227 // Silently sign the user out without deleting their profile and |
| 1228 // prompt them to sign back in. |
| 1229 chrome.send('SyncSetupStopSyncing', [false /* deleteProfile */]); |
| 1230 SyncSetupOverlay.startSignIn(false /* creatingSupervisedUser */); |
| 1231 } else { |
| 1232 chrome.send('showDisconnectManagedProfileDialog'); |
| 1233 } |
| 1234 </if> |
| 1235 break; |
| 1236 case 'upgradeClient': |
| 1237 PageManager.showPageByName('help'); |
| 1238 break; |
| 1239 default: |
| 1240 SyncSetupOverlay.showSetupUI(); |
| 1241 } |
| 1223 }; | 1242 }; |
| 1224 | 1243 |
| 1225 if (syncData.hasError) | 1244 if (syncData.hasError) |
| 1226 $('sync-status').classList.add('sync-error'); | 1245 $('sync-status').classList.add('sync-error'); |
| 1227 else | 1246 else |
| 1228 $('sync-status').classList.remove('sync-error'); | 1247 $('sync-status').classList.remove('sync-error'); |
| 1229 | 1248 |
| 1230 // Disable the "customize / set up sync" button if sync has an | 1249 // Disable the "customize / set up sync" button if sync has an |
| 1231 // unrecoverable error. Also disable the button if sync has not been set | 1250 // unrecoverable error. Also disable the button if sync has not been set |
| 1232 // up and the user is being presented with a link to re-auth. | 1251 // up and the user is being presented with a link to re-auth. |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2430 | 2449 |
| 2431 settings.hidden = !isVisible; | 2450 settings.hidden = !isVisible; |
| 2432 }; | 2451 }; |
| 2433 } | 2452 } |
| 2434 | 2453 |
| 2435 // Export | 2454 // Export |
| 2436 return { | 2455 return { |
| 2437 BrowserOptions: BrowserOptions | 2456 BrowserOptions: BrowserOptions |
| 2438 }; | 2457 }; |
| 2439 }); | 2458 }); |
| OLD | NEW |