Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/resources/sync_setup_overlay.js

Issue 10200002: Sync UI: Use camelCase for variables sent to JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 // Don't allow the user to tweak the settings once we send the 215 // Don't allow the user to tweak the settings once we send the
216 // configuration to the backend. 216 // configuration to the backend.
217 this.setInputElementsDisabledState_(true); 217 this.setInputElementsDisabledState_(true);
218 this.animateDisableLink_($('use-default-link'), true, null); 218 this.animateDisableLink_($('use-default-link'), true, null);
219 219
220 // These values need to be kept in sync with where they are read in 220 // These values need to be kept in sync with where they are read in
221 // SyncSetupFlow::GetDataTypeChoiceData(). 221 // SyncSetupFlow::GetDataTypeChoiceData().
222 var result = JSON.stringify({ 222 var result = JSON.stringify({
223 'syncAllDataTypes': syncAll, 223 'syncAllDataTypes': syncAll,
224 'sync_bookmarks': syncAll || $('bookmarks-checkbox').checked, 224 'bookmarksSynced': syncAll || $('bookmarks-checkbox').checked,
225 'sync_preferences': syncAll || $('preferences-checkbox').checked, 225 'preferencesSynced': syncAll || $('preferences-checkbox').checked,
226 'sync_themes': syncAll || $('themes-checkbox').checked, 226 'themesSynced': syncAll || $('themes-checkbox').checked,
227 'sync_passwords': syncAll || $('passwords-checkbox').checked, 227 'passwordsSynced': syncAll || $('passwords-checkbox').checked,
228 'sync_autofill': syncAll || $('autofill-checkbox').checked, 228 'autofillSynced': syncAll || $('autofill-checkbox').checked,
229 'sync_extensions': syncAll || $('extensions-checkbox').checked, 229 'extensionsSynced': syncAll || $('extensions-checkbox').checked,
230 'sync_typed_urls': syncAll || $('typed-urls-checkbox').checked, 230 'typedUrlsSynced': syncAll || $('typed-urls-checkbox').checked,
231 'sync_apps': syncAll || $('apps-checkbox').checked, 231 'appsSynced': syncAll || $('apps-checkbox').checked,
232 'sync_sessions': syncAll || $('sessions-checkbox').checked, 232 'sessionsSynced': syncAll || $('sessions-checkbox').checked,
233 'encryptAllData': encryptAllData, 233 'encryptAllData': encryptAllData,
234 'usePassphrase': usePassphrase, 234 'usePassphrase': usePassphrase,
235 'isGooglePassphrase': googlePassphrase, 235 'isGooglePassphrase': googlePassphrase,
236 'passphrase': customPassphrase 236 'passphrase': customPassphrase
237 }); 237 });
238 chrome.send('SyncSetupConfigure', [result]); 238 chrome.send('SyncSetupConfigure', [result]);
239 }, 239 },
240 240
241 /** 241 /**
242 * Sets the disabled property of all input elements within the 'Customize 242 * Sets the disabled property of all input elements within the 'Customize
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 return; 278 return;
279 elt.removeEventListener('webkitTransitionEnd', f); 279 elt.removeEventListener('webkitTransitionEnd', f);
280 elt.classList.remove('transparent'); 280 elt.classList.remove('transparent');
281 elt.hidden = true; 281 elt.hidden = true;
282 }); 282 });
283 } else { 283 } else {
284 elt.hidden = false; 284 elt.hidden = false;
285 elt.onclick = enabledFunction; 285 elt.onclick = enabledFunction;
286 } 286 }
287 }, 287 },
288 288
Dan Beam 2012/04/23 21:32:56 @param {Object} args (doesn't need to have every k
James Hawkins 2012/04/24 16:53:58 Done.
289 setChooseDataTypesCheckboxes_: function(args) { 289 setChooseDataTypesCheckboxes_: function(args) {
290 var datatypeSelect = $('sync-select-datatypes'); 290 var datatypeSelect = $('sync-select-datatypes');
291 datatypeSelect.selectedIndex = args.syncAllDataTypes ? 0 : 1; 291 datatypeSelect.selectedIndex = args.syncAllDataTypes ? 0 : 1;
292 292
293 $('bookmarks-checkbox').checked = args.sync_bookmarks; 293 $('bookmarks-checkbox').checked = args.bookmarksSynced;
294 $('preferences-checkbox').checked = args.sync_preferences; 294 $('preferences-checkbox').checked = args.preferencesSynced;
295 $('themes-checkbox').checked = args.sync_themes; 295 $('themes-checkbox').checked = args.themesSynced;
296 296
297 if (args.passwords_registered) { 297 if (args.passwordsRegistered) {
298 $('passwords-checkbox').checked = args.sync_passwords; 298 $('passwords-checkbox').checked = args.passwordsSynced;
299 $('passwords-item').hidden = false; 299 $('passwords-item').hidden = false;
300 } else { 300 } else {
301 $('passwords-item').hidden = true; 301 $('passwords-item').hidden = true;
302 } 302 }
303 if (args.autofill_registered) { 303 if (args.autofillRegistered) {
304 $('autofill-checkbox').checked = args.sync_autofill; 304 $('autofill-checkbox').checked = args.autofillSynced;
305 $('autofill-item').hidden = false; 305 $('autofill-item').hidden = false;
306 } else { 306 } else {
307 $('autofill-item').hidden = true; 307 $('autofill-item').hidden = true;
308 } 308 }
309 if (args.extensions_registered) { 309 if (args.extensionsRegistered) {
310 $('extensions-checkbox').checked = args.sync_extensions; 310 $('extensions-checkbox').checked = args.extensionsSynced;
311 $('extensions-item').hidden = false; 311 $('extensions-item').hidden = false;
312 } else { 312 } else {
313 $('extensions-item').hidden = true; 313 $('extensions-item').hidden = true;
314 } 314 }
315 if (args.typed_urls_registered) { 315 if (args.typedUrlsRegistered) {
316 $('typed-urls-checkbox').checked = args.sync_typed_urls; 316 $('typed-urls-checkbox').checked = args.typedUrlsSynced;
317 $('omnibox-item').hidden = false; 317 $('omnibox-item').hidden = false;
318 } else { 318 } else {
319 $('omnibox-item').hidden = true; 319 $('omnibox-item').hidden = true;
320 } 320 }
321 if (args.apps_registered) { 321 if (args.appsRegistered) {
322 $('apps-checkbox').checked = args.sync_apps; 322 $('apps-checkbox').checked = args.appsSynced;
323 $('apps-item').hidden = false; 323 $('apps-item').hidden = false;
324 } else { 324 } else {
325 $('apps-item').hidden = true; 325 $('apps-item').hidden = true;
326 } 326 }
327 if (args.sessions_registered) { 327 if (args.sessionsRegistered) {
328 $('sessions-checkbox').checked = args.sync_sessions; 328 $('sessions-checkbox').checked = args.sessionsSynced;
329 $('sessions-item').hidden = false; 329 $('sessions-item').hidden = false;
330 } else { 330 } else {
331 $('sessions-item').hidden = true; 331 $('sessions-item').hidden = true;
332 } 332 }
333 333
334 this.setCheckboxesToKeepEverythingSynced_(args.syncAllDataTypes); 334 this.setCheckboxesToKeepEverythingSynced_(args.syncAllDataTypes);
335 }, 335 },
336 336
337 setEncryptionRadios_: function(args) { 337 setEncryptionRadios_: function(args) {
338 if (args['encryptAllData']) { 338 if (args['encryptAllData']) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (args) { 383 if (args) {
384 this.setCheckboxesAndErrors_(args); 384 this.setCheckboxesAndErrors_(args);
385 385
386 this.useEncryptEverything_ = args['encryptAllData']; 386 this.useEncryptEverything_ = args['encryptAllData'];
387 387
388 // Whether to display the 'Sync everything' confirmation page or the 388 // Whether to display the 'Sync everything' confirmation page or the
389 // customize data types page. 389 // customize data types page.
390 var syncAllDataTypes = args['syncAllDataTypes']; 390 var syncAllDataTypes = args['syncAllDataTypes'];
391 this.usePassphrase_ = args['usePassphrase']; 391 this.usePassphrase_ = args['usePassphrase'];
392 if (args['showSyncEverythingPage'] == false || this.usePassphrase_ || 392 if (args['showSyncEverythingPage'] == false || this.usePassphrase_ ||
393 syncAllDataTypes == false || args['show_passphrase']) { 393 syncAllDataTypes == false || args['showPassphrase']) {
394 this.showCustomizePage_(args, syncAllDataTypes); 394 this.showCustomizePage_(args, syncAllDataTypes);
395 } else { 395 } else {
396 this.showSyncEverythingPage_(); 396 this.showSyncEverythingPage_();
397 } 397 }
398 } 398 }
399 }, 399 },
400 400
401 showSpinner_: function() { 401 showSpinner_: function() {
402 this.resetPage_('sync-setup-spinner'); 402 this.resetPage_('sync-setup-spinner');
403 $('sync-setup-spinner').hidden = false; 403 $('sync-setup-spinner').hidden = false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (args['usePassphrase']) 451 if (args['usePassphrase'])
452 $('normal-body').hidden = false; 452 $('normal-body').hidden = false;
453 else 453 else
454 $('google-passphrase-needed-body').hidden = false; 454 $('google-passphrase-needed-body').hidden = false;
455 455
456 $('passphrase-learn-more').hidden = false; 456 $('passphrase-learn-more').hidden = false;
457 // Warn the user about their incorrect passphrase if we need a passphrase 457 // Warn the user about their incorrect passphrase if we need a passphrase
458 // and the passphrase field is non-empty (meaning they tried to set it 458 // and the passphrase field is non-empty (meaning they tried to set it
459 // previously but failed). 459 // previously but failed).
460 $('incorrect-passphrase').hidden = 460 $('incorrect-passphrase').hidden =
461 !(args['usePassphrase'] && args['passphrase_failed']); 461 !(args['usePassphrase'] && args['passphraseFailed']);
462 462
463 $('sync-passphrase-warning').hidden = false; 463 $('sync-passphrase-warning').hidden = false;
464 $('passphrase').focus(); 464 $('passphrase').focus();
465 }, 465 },
466 466
467 /** @private */ 467 /** @private */
468 showCustomizePage_: function(args, syncEverything) { 468 showCustomizePage_: function(args, syncEverything) {
469 $('confirm-sync-preferences').hidden = true; 469 $('confirm-sync-preferences').hidden = true;
470 $('customize-sync-preferences').hidden = false; 470 $('customize-sync-preferences').hidden = false;
471 471
472 $('sync-custom-passphrase-container').hidden = false; 472 $('sync-custom-passphrase-container').hidden = false;
473 $('sync-existing-passphrase-container').hidden = true; 473 $('sync-existing-passphrase-container').hidden = true;
474 474
475 // If the user has selected the 'Customize' page on initial set up, it's 475 // If the user has selected the 'Customize' page on initial set up, it's
476 // likely he intends to change the data types. Select the 476 // likely he intends to change the data types. Select the
477 // 'Choose data types' option in this case. 477 // 'Choose data types' option in this case.
478 var index = syncEverything ? 0 : 1; 478 var index = syncEverything ? 0 : 1;
479 $('sync-select-datatypes').selectedIndex = index; 479 $('sync-select-datatypes').selectedIndex = index;
480 this.setDataTypeCheckboxesEnabled_(!syncEverything); 480 this.setDataTypeCheckboxesEnabled_(!syncEverything);
481 481
482 // The passphrase input may need to take over focus from the OK button, so 482 // The passphrase input may need to take over focus from the OK button, so
483 // set focus before that logic. 483 // set focus before that logic.
484 $('choose-datatypes-ok').focus(); 484 $('choose-datatypes-ok').focus();
485 485
486 if (args && args['show_passphrase']) { 486 if (args && args['showPassphrase']) {
Dan Beam 2012/04/23 21:32:56 can you change these to .key instead of ['key']?
James Hawkins 2012/04/24 16:53:58 Done.
487 this.showPassphraseContainer_(args); 487 this.showPassphraseContainer_(args);
488 } else { 488 } else {
489 // We only show the 'Use Default' link if we're not prompting for an 489 // We only show the 'Use Default' link if we're not prompting for an
490 // existing passphrase. 490 // existing passphrase.
491 var self = this; 491 var self = this;
492 this.animateDisableLink_($('use-default-link'), false, function() { 492 this.animateDisableLink_($('use-default-link'), false, function() {
493 self.showSyncEverythingPage_(); 493 self.showSyncEverythingPage_();
494 }); 494 });
495 } 495 }
496 }, 496 },
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 var f = $('gaia-login-form'); 650 var f = $('gaia-login-form');
651 var email = $('gaia-email'); 651 var email = $('gaia-email');
652 var passwd = $('gaia-passwd'); 652 var passwd = $('gaia-passwd');
653 if (f) { 653 if (f) {
654 if (args.user != undefined) { 654 if (args.user != undefined) {
655 if (email.value != args.user) 655 if (email.value != args.user)
656 passwd.value = ''; // Reset the password field 656 passwd.value = ''; // Reset the password field
657 email.value = args.user; 657 email.value = args.user;
658 } 658 }
659 659
660 if (!args.editable_user) { 660 if (!args.editableUser) {
661 $('email-row').hidden = true; 661 $('email-row').hidden = true;
662 var span = $('email-readonly'); 662 var span = $('email-readonly');
663 span.textContent = email.value; 663 span.textContent = email.value;
664 $('email-readonly-row').hidden = false; 664 $('email-readonly-row').hidden = false;
665 $('create-account-div').hidden = true; 665 $('create-account-div').hidden = true;
666 } 666 }
667 667
668 f.accessCode.disabled = true; 668 f.accessCode.disabled = true;
669 } 669 }
670 670
671 if (1 == args.error) { 671 if (1 == args.error) {
672 var access_code = $('access-code'); 672 var accessCode = $('access-code');
673 if (access_code.value) { 673 if (accessCode.value) {
674 $('errormsg-0-access-code').hidden = false; 674 $('errormsg-0-access-code').hidden = false;
675 this.showAccessCodeRequired_(); 675 this.showAccessCodeRequired_();
676 } else { 676 } else {
677 $('errormsg-1-password').hidden = false; 677 $('errormsg-1-password').hidden = false;
678 } 678 }
679 this.setBlurbError_(args.error_message); 679 this.setBlurbError_(args.errorMessage);
680 } else if (3 == args.error) { 680 } else if (3 == args.error) {
681 $('errormsg-0-connection').hidden = false; 681 $('errormsg-0-connection').hidden = false;
682 this.setBlurbError_(args.error_message); 682 this.setBlurbError_(args.errorMessage);
683 } else if (4 == args.error) { 683 } else if (4 == args.error) {
684 this.showCaptcha_(args); 684 this.showCaptcha_(args);
685 } else if (7 == args.error) { 685 } else if (7 == args.error) {
686 this.setBlurbError_(localStrings.getString('serviceUnavailableError')); 686 this.setBlurbError_(localStrings.getString('serviceUnavailableError'));
687 } else if (8 == args.error) { 687 } else if (8 == args.error) {
688 this.showAccessCodeRequired_(); 688 this.showAccessCodeRequired_();
689 } else if (args.error_message) { 689 } else if (args.errorMessage) {
690 this.setBlurbError_(args.error_message); 690 this.setBlurbError_(args.errorMessage);
691 } 691 }
692 692
693 if (args.fatalError) { 693 if (args.fatalError) {
694 $('errormsg-fatal').hidden = false; 694 $('errormsg-fatal').hidden = false;
695 $('sign-in').disabled = true; 695 $('sign-in').disabled = true;
696 return; 696 return;
697 } 697 }
698 698
699 $('sign-in').disabled = false; 699 $('sign-in').disabled = false;
700 $('sign-in').value = templateData['signin']; 700 $('sign-in').value = templateData['signin'];
701 this.loginSetFocus_(); 701 this.loginSetFocus_();
702 }, 702 },
703 703
704 resetErrorVisibility_: function() { 704 resetErrorVisibility_: function() {
705 $('errormsg-0-email').hidden = true; 705 $('errormsg-0-email').hidden = true;
706 $('errormsg-0-password').hidden = true; 706 $('errormsg-0-password').hidden = true;
707 $('errormsg-1-password').hidden = true; 707 $('errormsg-1-password').hidden = true;
708 $('errormsg-0-connection').hidden = true; 708 $('errormsg-0-connection').hidden = true;
709 $('errormsg-0-access-code').hidden = true; 709 $('errormsg-0-access-code').hidden = true;
710 }, 710 },
711 711
712 setBlurbError_: function(error_message) { 712 setBlurbError_: function(errorMessage) {
713 if (this.captchaChallengeActive_) 713 if (this.captchaChallengeActive_)
714 return; // No blurb in captcha challenge mode. 714 return; // No blurb in captcha challenge mode.
715 715
716 if (error_message) { 716 if (errorMessage) {
717 $('error-signing-in').hidden = true; 717 $('error-signing-in').hidden = true;
718 $('error-custom').hidden = false; 718 $('error-custom').hidden = false;
719 $('error-custom').textContent = error_message; 719 $('error-custom').textContent = errorMessage;
720 } else { 720 } else {
721 $('error-signing-in').hidden = false; 721 $('error-signing-in').hidden = false;
722 $('error-custom').hidden = true; 722 $('error-custom').hidden = true;
723 } 723 }
724 724
725 $('top-blurb-error').hidden = false; 725 $('top-blurb-error').hidden = false;
726 $('gaia-email').disabled = false; 726 $('gaia-email').disabled = false;
727 $('gaia-passwd').disabled = false; 727 $('gaia-passwd').disabled = false;
728 }, 728 },
729 729
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 $('access-code').disabled = true; 778 $('access-code').disabled = true;
779 779
780 this.setThrobbersVisible_(true); 780 this.setThrobbersVisible_(true);
781 781
782 var f = $('gaia-login-form'); 782 var f = $('gaia-login-form');
783 var email = $('gaia-email'); 783 var email = $('gaia-email');
784 var passwd = $('gaia-passwd'); 784 var passwd = $('gaia-passwd');
785 var result = JSON.stringify({'user' : email.value, 785 var result = JSON.stringify({'user' : email.value,
786 'pass' : passwd.value, 786 'pass' : passwd.value,
787 'captcha' : f.captchaValue.value, 787 'captcha' : f.captchaValue.value,
788 'access_code' : f.accessCode.value}); 788 'accessCode' : f.accessCode.value});
789 $('sign-in').disabled = true; 789 $('sign-in').disabled = true;
790 chrome.send('SyncSetupSubmitAuth', [result]); 790 chrome.send('SyncSetupSubmitAuth', [result]);
791 }, 791 },
792 792
793 showSuccessAndClose_: function() { 793 showSuccessAndClose_: function() {
794 $('sign-in').value = localStrings.getString('loginSuccess'); 794 $('sign-in').value = localStrings.getString('loginSuccess');
795 setTimeout(this.closeOverlay_, 1600); 795 setTimeout(this.closeOverlay_, 1600);
796 }, 796 },
797 797
798 showSuccessAndSettingUp_: function() { 798 showSuccessAndSettingUp_: function() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 882
883 SyncSetupOverlay.showStopSyncingUI = function() { 883 SyncSetupOverlay.showStopSyncingUI = function() {
884 SyncSetupOverlay.getInstance().showStopSyncingUI_(); 884 SyncSetupOverlay.getInstance().showStopSyncingUI_();
885 }; 885 };
886 886
887 // Export 887 // Export
888 return { 888 return {
889 SyncSetupOverlay: SyncSetupOverlay 889 SyncSetupOverlay: SyncSetupOverlay
890 }; 890 };
891 }); 891 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698