| 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 /** @const */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
| 7 | 7 |
| 8 // Variable to track if a captcha challenge was issued. If this gets set to | 8 // Variable to track if a captcha challenge was issued. If this gets set to |
| 9 // true, it stays that way until we are told about successful login from | 9 // true, it stays that way until we are told about successful login from |
| 10 // the browser. This means subsequent errors (like invalid password) are | 10 // the browser. This means subsequent errors (like invalid password) are |
| 11 // rendered in the captcha state, which is basically identical except we | 11 // rendered in the captcha state, which is basically identical except we |
| 12 // don't show the top error blurb 'Error Signing in' or the 'Create | 12 // don't show the top error blurb 'Error Signing in' or the 'Create |
| 13 // account' link. | 13 // account' link. |
| 14 var captchaChallengeActive_ = false; | 14 var captchaChallengeActive_ = false; |
| 15 | 15 |
| 16 // True if the synced account uses a custom passphrase. | 16 // True if the synced account uses a custom passphrase. |
| 17 var usePassphrase_ = false; | 17 var usePassphrase_ = false; |
| 18 | 18 |
| 19 // True if the synced account uses 'encrypt everything'. | 19 // True if the synced account uses 'encrypt everything'. |
| 20 var useEncryptEverything_ = false; | 20 var useEncryptEverything_ = false; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * SyncSetupOverlay class | 23 * SyncSetupOverlay class |
| 24 * Encapsulated handling of the 'Sync Setup' overlay page. | 24 * Encapsulated handling of the 'Sync Setup' overlay page. |
| 25 * @class | 25 * @class |
| 26 */ | 26 */ |
| 27 function SyncSetupOverlay() { | 27 function SyncSetupOverlay() { |
| 28 OptionsPage.call(this, 'syncSetup', templateData.syncSetupOverlayTabTitle, | 28 OptionsPage.call(this, 'syncSetup', |
| 29 loadTimeData.getString('syncSetupOverlayTabTitle'), |
| 29 'sync-setup-overlay'); | 30 'sync-setup-overlay'); |
| 30 } | 31 } |
| 31 | 32 |
| 32 cr.addSingletonGetter(SyncSetupOverlay); | 33 cr.addSingletonGetter(SyncSetupOverlay); |
| 33 | 34 |
| 34 SyncSetupOverlay.prototype = { | 35 SyncSetupOverlay.prototype = { |
| 35 __proto__: OptionsPage.prototype, | 36 __proto__: OptionsPage.prototype, |
| 36 | 37 |
| 37 /** | 38 /** |
| 38 * Initializes the page. | 39 * Initializes the page. |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 } else { | 683 } else { |
| 683 $('errormsg-1-password').hidden = false; | 684 $('errormsg-1-password').hidden = false; |
| 684 } | 685 } |
| 685 this.setBlurbError_(args.errorMessage); | 686 this.setBlurbError_(args.errorMessage); |
| 686 } else if (3 == args.error) { | 687 } else if (3 == args.error) { |
| 687 $('errormsg-0-connection').hidden = false; | 688 $('errormsg-0-connection').hidden = false; |
| 688 this.setBlurbError_(args.errorMessage); | 689 this.setBlurbError_(args.errorMessage); |
| 689 } else if (4 == args.error) { | 690 } else if (4 == args.error) { |
| 690 this.showCaptcha_(args); | 691 this.showCaptcha_(args); |
| 691 } else if (7 == args.error) { | 692 } else if (7 == args.error) { |
| 692 this.setBlurbError_(localStrings.getString('serviceUnavailableError')); | 693 this.setBlurbError_(loadTimeData.getString('serviceUnavailableError')); |
| 693 } else if (8 == args.error) { | 694 } else if (8 == args.error) { |
| 694 this.showAccessCodeRequired_(); | 695 this.showAccessCodeRequired_(); |
| 695 } else if (args.errorMessage) { | 696 } else if (args.errorMessage) { |
| 696 this.setBlurbError_(args.errorMessage); | 697 this.setBlurbError_(args.errorMessage); |
| 697 } | 698 } |
| 698 | 699 |
| 699 if (args.fatalError) { | 700 if (args.fatalError) { |
| 700 $('errormsg-fatal').hidden = false; | 701 $('errormsg-fatal').hidden = false; |
| 701 $('sign-in').disabled = true; | 702 $('sign-in').disabled = true; |
| 702 return; | 703 return; |
| 703 } | 704 } |
| 704 | 705 |
| 705 $('sign-in').disabled = false; | 706 $('sign-in').disabled = false; |
| 706 $('sign-in').value = templateData['signin']; | 707 $('sign-in').value = loadTimeData.getString('signin'); |
| 707 this.loginSetFocus_(); | 708 this.loginSetFocus_(); |
| 708 }, | 709 }, |
| 709 | 710 |
| 710 resetErrorVisibility_: function() { | 711 resetErrorVisibility_: function() { |
| 711 $('errormsg-0-email').hidden = true; | 712 $('errormsg-0-email').hidden = true; |
| 712 $('errormsg-0-password').hidden = true; | 713 $('errormsg-0-password').hidden = true; |
| 713 $('errormsg-1-password').hidden = true; | 714 $('errormsg-1-password').hidden = true; |
| 714 $('errormsg-0-connection').hidden = true; | 715 $('errormsg-0-connection').hidden = true; |
| 715 $('errormsg-0-access-code').hidden = true; | 716 $('errormsg-0-access-code').hidden = true; |
| 716 }, | 717 }, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 var passwd = $('gaia-passwd'); | 791 var passwd = $('gaia-passwd'); |
| 791 var result = JSON.stringify({'user' : email.value, | 792 var result = JSON.stringify({'user' : email.value, |
| 792 'pass' : passwd.value, | 793 'pass' : passwd.value, |
| 793 'captcha' : f.captchaValue.value, | 794 'captcha' : f.captchaValue.value, |
| 794 'accessCode' : f.accessCode.value}); | 795 'accessCode' : f.accessCode.value}); |
| 795 $('sign-in').disabled = true; | 796 $('sign-in').disabled = true; |
| 796 chrome.send('SyncSetupSubmitAuth', [result]); | 797 chrome.send('SyncSetupSubmitAuth', [result]); |
| 797 }, | 798 }, |
| 798 | 799 |
| 799 showSuccessAndClose_: function() { | 800 showSuccessAndClose_: function() { |
| 800 $('sign-in').value = localStrings.getString('loginSuccess'); | 801 $('sign-in').value = loadTimeData.getString('loginSuccess'); |
| 801 setTimeout(this.closeOverlay_, 1600); | 802 setTimeout(this.closeOverlay_, 1600); |
| 802 }, | 803 }, |
| 803 | 804 |
| 804 showSuccessAndSettingUp_: function() { | 805 showSuccessAndSettingUp_: function() { |
| 805 $('sign-in').value = localStrings.getString('settingUp'); | 806 $('sign-in').value = loadTimeData.getString('settingUp'); |
| 806 this.setThrobbersVisible_(true); | 807 this.setThrobbersVisible_(true); |
| 807 $('top-blurb-error').hidden = true; | 808 $('top-blurb-error').hidden = true; |
| 808 }, | 809 }, |
| 809 | 810 |
| 810 /** | 811 /** |
| 811 * Displays the stop syncing dialog. | 812 * Displays the stop syncing dialog. |
| 812 * @private | 813 * @private |
| 813 */ | 814 */ |
| 814 showStopSyncingUI_: function() { | 815 showStopSyncingUI_: function() { |
| 815 // Hide any visible children of the overlay. | 816 // Hide any visible children of the overlay. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 | 889 |
| 889 SyncSetupOverlay.showStopSyncingUI = function() { | 890 SyncSetupOverlay.showStopSyncingUI = function() { |
| 890 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 891 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 891 }; | 892 }; |
| 892 | 893 |
| 893 // Export | 894 // Export |
| 894 return { | 895 return { |
| 895 SyncSetupOverlay: SyncSetupOverlay | 896 SyncSetupOverlay: SyncSetupOverlay |
| 896 }; | 897 }; |
| 897 }); | 898 }); |
| OLD | NEW |