| 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.define('options', function() { | 5 cr.define('options', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
| 9 | 9 |
| 10 // | 10 // |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 $('advanced-settings').addEventListener('webkitTransitionEnd', | 80 $('advanced-settings').addEventListener('webkitTransitionEnd', |
| 81 this.updateAdvancedSettingsExpander_.bind(this)); | 81 this.updateAdvancedSettingsExpander_.bind(this)); |
| 82 | 82 |
| 83 if (cr.isChromeOS) | 83 if (cr.isChromeOS) |
| 84 UIAccountTweaks.applyGuestModeVisibility(document); | 84 UIAccountTweaks.applyGuestModeVisibility(document); |
| 85 | 85 |
| 86 // Sync (Sign in) section. | 86 // Sync (Sign in) section. |
| 87 this.updateSyncState_(loadTimeData.getValue('syncData')); | 87 this.updateSyncState_(loadTimeData.getValue('syncData')); |
| 88 | 88 |
| 89 $('sync-action-link').onclick = function(event) { | |
| 90 if (cr.isChromeOS) { | |
| 91 // On Chrome OS, sign out the user and sign in again to get fresh | |
| 92 // credentials on auth errors. | |
| 93 SyncSetupOverlay.doSignOutOnAuthError(); | |
| 94 } else { | |
| 95 SyncSetupOverlay.showErrorUI(); | |
| 96 } | |
| 97 }; | |
| 98 $('start-stop-sync').onclick = function(event) { | 89 $('start-stop-sync').onclick = function(event) { |
| 99 if (self.syncSetupCompleted) | 90 if (self.syncSetupCompleted) |
| 100 SyncSetupOverlay.showStopSyncingUI(); | 91 SyncSetupOverlay.showStopSyncingUI(); |
| 101 else if (cr.isChromeOS) | 92 else if (cr.isChromeOS) |
| 102 SyncSetupOverlay.showSetupUIWithoutLogin(); | 93 SyncSetupOverlay.showSetupUIWithoutLogin(); |
| 103 else | 94 else |
| 104 SyncSetupOverlay.showSetupUI(); | 95 SyncSetupOverlay.showSetupUI(); |
| 105 }; | 96 }; |
| 106 $('customize-sync').onclick = function(event) { | 97 $('customize-sync').onclick = function(event) { |
| 107 if (cr.isChromeOS) | 98 if (cr.isChromeOS) |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 // TODO(estade): can this just be textContent? | 649 // TODO(estade): can this just be textContent? |
| 659 $('sync-status-text').innerHTML = syncData.statusText; | 650 $('sync-status-text').innerHTML = syncData.statusText; |
| 660 var statusSet = syncData.statusText.length != 0; | 651 var statusSet = syncData.statusText.length != 0; |
| 661 $('sync-overview').hidden = statusSet; | 652 $('sync-overview').hidden = statusSet; |
| 662 $('sync-status').hidden = !statusSet; | 653 $('sync-status').hidden = !statusSet; |
| 663 | 654 |
| 664 $('sync-action-link').textContent = syncData.actionLinkText; | 655 $('sync-action-link').textContent = syncData.actionLinkText; |
| 665 $('sync-action-link').hidden = syncData.actionLinkText.length == 0; | 656 $('sync-action-link').hidden = syncData.actionLinkText.length == 0; |
| 666 $('sync-action-link').disabled = syncData.managed; | 657 $('sync-action-link').disabled = syncData.managed; |
| 667 | 658 |
| 659 if (cr.isChromeOS && syncData.hasError) { |
| 660 // On Chrome OS, sign out the user and sign in again to get fresh |
| 661 // credentials on auth errors. |
| 662 $('sync-action-link').onclick = function(event) { |
| 663 SyncSetupOverlay.doSignOutOnAuthError(); |
| 664 }; |
| 665 } else { |
| 666 $('sync-action-link').onclick = function(event) { |
| 667 SyncSetupOverlay.showErrorUI(); |
| 668 }; |
| 669 } |
| 670 |
| 668 if (syncData.hasError) | 671 if (syncData.hasError) |
| 669 $('sync-status').classList.add('sync-error'); | 672 $('sync-status').classList.add('sync-error'); |
| 670 else | 673 else |
| 671 $('sync-status').classList.remove('sync-error'); | 674 $('sync-status').classList.remove('sync-error'); |
| 672 | 675 |
| 673 $('customize-sync').disabled = syncData.hasUnrecoverableError; | 676 $('customize-sync').disabled = syncData.hasUnrecoverableError; |
| 674 // Move #enable-auto-login-checkbox to a different location on CrOS. | 677 // Move #enable-auto-login-checkbox to a different location on CrOS. |
| 675 if (cr.isChromeOs) { | 678 if (cr.isChromeOs) { |
| 676 $('sync-general').insertBefore($('sync-status').nextSibling, | 679 $('sync-general').insertBefore($('sync-status').nextSibling, |
| 677 $('enable-auto-login-checkbox')); | 680 $('enable-auto-login-checkbox')); |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 BrowserOptions.getLoggedInUsername = function() { | 1377 BrowserOptions.getLoggedInUsername = function() { |
| 1375 return BrowserOptions.getInstance().username_; | 1378 return BrowserOptions.getInstance().username_; |
| 1376 }; | 1379 }; |
| 1377 } | 1380 } |
| 1378 | 1381 |
| 1379 // Export | 1382 // Export |
| 1380 return { | 1383 return { |
| 1381 BrowserOptions: BrowserOptions | 1384 BrowserOptions: BrowserOptions |
| 1382 }; | 1385 }; |
| 1383 }); | 1386 }); |
| OLD | NEW |