OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 OptionsPage = options.OptionsPage; | 6 const 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 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 // Called once, when this html/js is loaded. | 394 // Called once, when this html/js is loaded. |
395 showConfigure_: function(args) { | 395 showConfigure_: function(args) { |
396 var datatypeSelect = document.getElementById('sync-select-datatypes'); | 396 var datatypeSelect = document.getElementById('sync-select-datatypes'); |
397 var self = this; | 397 var self = this; |
398 datatypeSelect.onchange = function() { | 398 datatypeSelect.onchange = function() { |
399 var syncAll = this.selectedIndex == 0; | 399 var syncAll = this.selectedIndex == 0; |
400 self.setCheckboxesToKeepEverythingSynced_(syncAll); | 400 self.setCheckboxesToKeepEverythingSynced_(syncAll); |
401 }; | 401 }; |
402 | 402 |
403 $('sync-setup-configure').classList.remove('hidden'); | 403 $('sync-setup-configure').hidden = false; |
404 | 404 |
405 if (args) { | 405 if (args) { |
406 if (!args['encryptionEnabled']) | 406 if (!args['encryptionEnabled']) |
407 $('customize-sync-encryption').classList.add('hidden'); | 407 $('customize-sync-encryption').hidden = true; |
408 this.setCheckboxesAndErrors_(args); | 408 this.setCheckboxesAndErrors_(args); |
409 | 409 |
410 // Whether to display the 'Sync everything' confirmation page or the | 410 // Whether to display the 'Sync everything' confirmation page or the |
411 // customize data types page. | 411 // customize data types page. |
412 var showSyncEverythingPage = args['showSyncEverythingPage']; | 412 var showSyncEverythingPage = args['showSyncEverythingPage']; |
413 var keepEverythingSynced = args['keepEverythingSynced']; | 413 var keepEverythingSynced = args['keepEverythingSynced']; |
414 this.usePassphrase_ = args['usePassphrase']; | 414 this.usePassphrase_ = args['usePassphrase']; |
415 if (showSyncEverythingPage == false || | 415 if (showSyncEverythingPage == false || |
416 keepEverythingSynced == false || this.usePassphrase_) { | 416 keepEverythingSynced == false || this.usePassphrase_) { |
417 this.showCustomizePage_(keepEverythingSynced); | 417 this.showCustomizePage_(keepEverythingSynced); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 if (page == 'settingUp') { | 462 if (page == 'settingUp') { |
463 this.setThrobbersVisible_(true); | 463 this.setThrobbersVisible_(true); |
464 return; | 464 return; |
465 } else { | 465 } else { |
466 this.setThrobbersVisible_(false); | 466 this.setThrobbersVisible_(false); |
467 } | 467 } |
468 | 468 |
469 // Hide an existing visible overlay. | 469 // Hide an existing visible overlay. |
470 var overlay = $('sync-setup-overlay'); | 470 var overlay = $('sync-setup-overlay'); |
471 for (var i = 0; i < overlay.children.length; i++) | 471 for (var i = 0; i < overlay.children.length; i++) |
472 overlay.children[i].classList.add('hidden'); | 472 overlay.children[i].hidden = true; |
473 | 473 |
474 this.setInputElementsDisabledState_(false); | 474 this.setInputElementsDisabledState_(false); |
475 | 475 |
476 if (page == 'login') | 476 if (page == 'login') |
477 this.showGaiaLogin_(args); | 477 this.showGaiaLogin_(args); |
478 else if (page == 'configure') | 478 else if (page == 'configure') |
479 this.showConfigure_(args); | 479 this.showConfigure_(args); |
480 else if (page == 'passphrase') | 480 else if (page == 'passphrase') |
481 this.showPassphrase_(args); | 481 this.showPassphrase_(args); |
482 | 482 |
483 if (page == 'done') | 483 if (page == 'done') |
484 this.closeOverlay_(); | 484 this.closeOverlay_(); |
485 else | 485 else |
486 this.showOverlay_(); | 486 this.showOverlay_(); |
487 }, | 487 }, |
488 | 488 |
489 setThrobbersVisible_: function(visible) { | 489 setThrobbersVisible_: function(visible) { |
490 var throbbers = document.getElementsByClassName("throbber"); | 490 var throbbers = document.getElementsByClassName("throbber"); |
491 for (var i = 0; i < throbbers.length; i++) | 491 for (var i = 0; i < throbbers.length; i++) |
492 throbbers[i].style.visibility = visible ? "visible" : "hidden"; | 492 throbbers[i].style.visibility = visible ? "visible" : "hidden"; |
493 }, | 493 }, |
494 | 494 |
495 showPassphrase_: function(args) { | 495 showPassphrase_: function(args) { |
496 $('sync-setup-passphrase').classList.remove('hidden'); | 496 $('sync-setup-passphrase').hidden = false; |
497 | 497 |
498 $('passphrase-rejected-body').style.display = "none"; | 498 $('passphrase-rejected-body').style.display = "none"; |
499 $('normal-body').style.display = "none"; | 499 $('normal-body').style.display = "none"; |
500 $('incorrect-passphrase').style.display = "none"; | 500 $('incorrect-passphrase').style.display = "none"; |
501 | 501 |
502 if (args["passphrase_creation_rejected"]) { | 502 if (args["passphrase_creation_rejected"]) { |
503 $('passphrase-rejected-body').style.display = "block"; | 503 $('passphrase-rejected-body').style.display = "block"; |
504 } else { | 504 } else { |
505 $('normal-body').style.display = "block"; | 505 $('normal-body').style.display = "block"; |
506 } | 506 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // It's showtime for the captcha now. | 551 // It's showtime for the captcha now. |
552 this.setElementDisplay_("captcha-div", "block"); | 552 this.setElementDisplay_("captcha-div", "block"); |
553 document.getElementById('gaia-email').disabled = true; | 553 document.getElementById('gaia-email').disabled = true; |
554 document.getElementById('gaia-passwd').disabled = false; | 554 document.getElementById('gaia-passwd').disabled = false; |
555 document.getElementById('captcha-value').disabled = false; | 555 document.getElementById('captcha-value').disabled = false; |
556 document.getElementById('captcha-wrapper').style.backgroundImage = | 556 document.getElementById('captcha-wrapper').style.backgroundImage = |
557 url(args.captchaUrl); | 557 url(args.captchaUrl); |
558 }, | 558 }, |
559 | 559 |
560 showGaiaLogin_: function(args) { | 560 showGaiaLogin_: function(args) { |
561 $('sync-setup-login').classList.remove('hidden'); | 561 $('sync-setup-login').hidden = false; |
562 | 562 |
563 document.getElementById('gaia-email').disabled = false; | 563 document.getElementById('gaia-email').disabled = false; |
564 document.getElementById('gaia-passwd').disabled = false; | 564 document.getElementById('gaia-passwd').disabled = false; |
565 | 565 |
566 var f = $('gaia-login-form'); | 566 var f = $('gaia-login-form'); |
567 var email = $('gaia-email'); | 567 var email = $('gaia-email'); |
568 var passwd = $('gaia-passwd'); | 568 var passwd = $('gaia-passwd'); |
569 if (f) { | 569 if (f) { |
570 if (args.user != undefined) { | 570 if (args.user != undefined) { |
571 if (email.value != args.user) | 571 if (email.value != args.user) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 688 |
689 showSuccessAndSettingUp_: function() { | 689 showSuccessAndSettingUp_: function() { |
690 $('sign-in').value = localStrings.getString('settingUp'); | 690 $('sign-in').value = localStrings.getString('settingUp'); |
691 }, | 691 }, |
692 | 692 |
693 /** @inheritDoc */ | 693 /** @inheritDoc */ |
694 shouldClose: function() { | 694 shouldClose: function() { |
695 if (!$('cancel-warning-box').hidden) { | 695 if (!$('cancel-warning-box').hidden) { |
696 chrome.send('SyncSetupPassphraseCancel', ['']); | 696 chrome.send('SyncSetupPassphraseCancel', ['']); |
697 return true; | 697 return true; |
698 } else if (!$('sync-setup-passphrase').classList.contains('hidden')) { | 698 } else if (!$('sync-setup-passphrase').hidden) { |
699 // The Passphrase page is showing, and the use has pressed escape. | 699 // The Passphrase page is showing, and the use has pressed escape. |
700 // Activate the cancel logic in this case. | 700 // Activate the cancel logic in this case. |
701 this.showCancelWarning_(); | 701 this.showCancelWarning_(); |
702 return false; | 702 return false; |
703 } | 703 } |
704 | 704 |
705 return true; | 705 return true; |
706 }, | 706 }, |
707 }; | 707 }; |
708 | 708 |
(...skipping 11 matching lines...) Expand all Loading... |
720 | 720 |
721 SyncSetupOverlay.showSuccessAndSettingUp = function() { | 721 SyncSetupOverlay.showSuccessAndSettingUp = function() { |
722 SyncSetupOverlay.getInstance().showSuccessAndSettingUp_(); | 722 SyncSetupOverlay.getInstance().showSuccessAndSettingUp_(); |
723 }; | 723 }; |
724 | 724 |
725 // Export | 725 // Export |
726 return { | 726 return { |
727 SyncSetupOverlay: SyncSetupOverlay | 727 SyncSetupOverlay: SyncSetupOverlay |
728 }; | 728 }; |
729 }); | 729 }); |
OLD | NEW |