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

Side by Side Diff: chrome/browser/resources/options/manage_profile_overlay.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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
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 var Page = cr.ui.pageManager.Page; 6 var Page = cr.ui.pageManager.Page;
7 var PageManager = cr.ui.pageManager.PageManager; 7 var PageManager = cr.ui.pageManager.PageManager;
8 var ArrayDataModel = cr.ui.ArrayDataModel; 8 var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 /** 10 /**
11 * ManageProfileOverlay class 11 * ManageProfileOverlay class
12 * Encapsulated handling of the 'Manage profile...' overlay page. 12 * Encapsulated handling of the 'Manage profile...' overlay page.
13 * @constructor 13 * @constructor
14 * @extends {cr.ui.pageManager.Page} 14 * @extends {cr.ui.pageManager.Page}
15 */ 15 */
16 function ManageProfileOverlay() { 16 function ManageProfileOverlay() {
17 Page.call(this, 'manageProfile', 17 Page.call(
18 loadTimeData.getString('manageProfileTabTitle'), 18 this, 'manageProfile', loadTimeData.getString('manageProfileTabTitle'),
19 'manage-profile-overlay'); 19 'manage-profile-overlay');
20 } 20 }
21 21
22 cr.addSingletonGetter(ManageProfileOverlay); 22 cr.addSingletonGetter(ManageProfileOverlay);
23 23
24 ManageProfileOverlay.prototype = { 24 ManageProfileOverlay.prototype = {
25 // Inherit from Page. 25 // Inherit from Page.
26 __proto__: Page.prototype, 26 __proto__: Page.prototype,
27 27
28 // Info about the currently managed/deleted profile. 28 // Info about the currently managed/deleted profile.
29 profileInfo_: null, 29 profileInfo_: null,
(...skipping 12 matching lines...) Expand all
42 // The currently selected icon in the icon grid. 42 // The currently selected icon in the icon grid.
43 iconGridSelectedURL_: null, 43 iconGridSelectedURL_: null,
44 44
45 /** @override */ 45 /** @override */
46 initializePage: function() { 46 initializePage: function() {
47 Page.prototype.initializePage.call(this); 47 Page.prototype.initializePage.call(this);
48 48
49 var self = this; 49 var self = this;
50 options.ProfilesIconGrid.decorate($('manage-profile-icon-grid')); 50 options.ProfilesIconGrid.decorate($('manage-profile-icon-grid'));
51 options.ProfilesIconGrid.decorate($('create-profile-icon-grid')); 51 options.ProfilesIconGrid.decorate($('create-profile-icon-grid'));
52 self.registerCommonEventHandlers_('create', 52 self.registerCommonEventHandlers_(
53 self.submitCreateProfile_.bind(self)); 53 'create', self.submitCreateProfile_.bind(self));
54 self.registerCommonEventHandlers_('manage', 54 self.registerCommonEventHandlers_(
55 self.submitManageChanges_.bind(self)); 55 'manage', self.submitManageChanges_.bind(self));
56 56
57 // Override the create-profile-ok and create-* keydown handlers, to avoid 57 // Override the create-profile-ok and create-* keydown handlers, to avoid
58 // closing the overlay until we finish creating the profile. 58 // closing the overlay until we finish creating the profile.
59 $('create-profile-ok').onclick = function(event) { 59 $('create-profile-ok').onclick = function(event) {
60 self.submitCreateProfile_(); 60 self.submitCreateProfile_();
61 }; 61 };
62 62
63 $('create-profile-cancel').onclick = function(event) { 63 $('create-profile-cancel').onclick = function(event) {
64 CreateProfileOverlay.cancelCreateProfile(); 64 CreateProfileOverlay.cancelCreateProfile();
65 }; 65 };
66 66
67 $('manage-profile-cancel').onclick = 67 $('manage-profile-cancel').onclick =
68 $('disconnect-managed-profile-cancel').onclick = 68 $('disconnect-managed-profile-cancel').onclick =
69 $('delete-profile-cancel').onclick = function(event) { 69 $('delete-profile-cancel').onclick = function(event) {
70 PageManager.closeOverlay(); 70 PageManager.closeOverlay();
71 }; 71 };
72 $('delete-profile-ok').onclick = function(event) { 72 $('delete-profile-ok').onclick = function(event) {
73 PageManager.closeOverlay(); 73 PageManager.closeOverlay();
74 chrome.send('deleteProfile', [self.profileInfo_.filePath]); 74 chrome.send('deleteProfile', [self.profileInfo_.filePath]);
75 options.SupervisedUserListData.resetPromise(); 75 options.SupervisedUserListData.resetPromise();
76 }; 76 };
77 $('add-shortcut-button').onclick = function(event) { 77 $('add-shortcut-button').onclick = function(event) {
78 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); 78 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]);
79 }; 79 };
80 $('remove-shortcut-button').onclick = function(event) { 80 $('remove-shortcut-button').onclick = function(event) {
81 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); 81 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]);
82 }; 82 };
83 83
84 $('disconnect-managed-profile-ok').onclick = function(event) { 84 $('disconnect-managed-profile-ok').onclick = function(event) {
85 PageManager.closeOverlay(); 85 PageManager.closeOverlay();
86 chrome.send('deleteProfile', 86 chrome.send(
87 [BrowserOptions.getCurrentProfile().filePath]); 87 'deleteProfile', [BrowserOptions.getCurrentProfile().filePath]);
88 }; 88 };
89 89
90 $('create-profile-supervised-signed-in-learn-more-link').onclick = 90 $('create-profile-supervised-signed-in-learn-more-link').onclick =
91 function(event) { 91 function(event) {
92 PageManager.showPageByName('supervisedUserLearnMore'); 92 PageManager.showPageByName('supervisedUserLearnMore');
93 return false; 93 return false;
94 }; 94 };
95 95
96 $('create-profile-supervised-sign-in-link').onclick = 96 $('create-profile-supervised-sign-in-link').onclick = function(event) {
97 function(event) {
98 SyncSetupOverlay.startSignIn(true /* creatingSupervisedUser */); 97 SyncSetupOverlay.startSignIn(true /* creatingSupervisedUser */);
99 }; 98 };
100 99
101 $('create-profile-supervised-sign-in-again-link').onclick = 100 $('create-profile-supervised-sign-in-again-link').onclick = function(
102 function(event) { 101 event) {
103 SyncSetupOverlay.showSetupUI(); 102 SyncSetupOverlay.showSetupUI();
104 }; 103 };
105 104
106 $('import-existing-supervised-user-link').onclick = function(event) { 105 $('import-existing-supervised-user-link').onclick = function(event) {
107 // Hide the import button to trigger a cursor update. The import button 106 // Hide the import button to trigger a cursor update. The import button
108 // is shown again when the import overlay loads. TODO(akuegel): Remove 107 // is shown again when the import overlay loads. TODO(akuegel): Remove
109 // this temporary fix when crbug/246304 is resolved. 108 // this temporary fix when crbug/246304 is resolved.
110 $('import-existing-supervised-user-link').hidden = true; 109 $('import-existing-supervised-user-link').hidden = true;
111 PageManager.showPageByName('supervisedUserImport'); 110 PageManager.showPageByName('supervisedUserImport');
112 }; 111 };
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 * @param {Object} supervisedUser 345 * @param {Object} supervisedUser
347 * @param {boolean} nameIsUnique 346 * @param {boolean} nameIsUnique
348 */ 347 */
349 getImportHandler_: function(supervisedUser, nameIsUnique) { 348 getImportHandler_: function(supervisedUser, nameIsUnique) {
350 return function() { 349 return function() {
351 if (supervisedUser.needAvatar || !nameIsUnique) { 350 if (supervisedUser.needAvatar || !nameIsUnique) {
352 PageManager.showPageByName('supervisedUserImport'); 351 PageManager.showPageByName('supervisedUserImport');
353 } else { 352 } else {
354 this.hideErrorBubble_('create'); 353 this.hideErrorBubble_('create');
355 CreateProfileOverlay.updateCreateInProgress(true); 354 CreateProfileOverlay.updateCreateInProgress(true);
356 chrome.send('createProfile', 355 chrome.send('createProfile', [
357 [supervisedUser.name, supervisedUser.iconURL, false, true, 356 supervisedUser.name, supervisedUser.iconURL, false, true,
358 supervisedUser.id]); 357 supervisedUser.id
358 ]);
359 } 359 }
360 }.bind(this); 360 }.bind(this);
361 }, 361 },
362 362
363 /** 363 /**
364 * Callback which receives the list of existing supervised users. Checks if 364 * Callback which receives the list of existing supervised users. Checks if
365 * the currently entered name is the name of an already existing supervised 365 * the currently entered name is the name of an already existing supervised
366 * user. If yes, the user is prompted to import the existing supervised 366 * user. If yes, the user is prompted to import the existing supervised
367 * user, and the create button is disabled. 367 * user, and the create button is disabled.
368 * If the received list is empty, hides the "import" link. 368 * If the received list is empty, hides the "import" link.
(...skipping 23 matching lines...) Expand all
392 // Handling the case when multiple supervised users with the same 392 // Handling the case when multiple supervised users with the same
393 // name exist, but not all of them are on the device. 393 // name exist, but not all of them are on the device.
394 // If at least one is not imported, we want to offer that 394 // If at least one is not imported, we want to offer that
395 // option to the user. This could happen due to a bug that allowed 395 // option to the user. This could happen due to a bug that allowed
396 // creating SUs with the same name (https://crbug.com/557445). 396 // creating SUs with the same name (https://crbug.com/557445).
397 var allOnCurrentDevice = supervisedUsers[i].onCurrentDevice; 397 var allOnCurrentDevice = supervisedUsers[i].onCurrentDevice;
398 var j; 398 var j;
399 for (j = i + 1; j < supervisedUsers.length; ++j) { 399 for (j = i + 1; j < supervisedUsers.length; ++j) {
400 if (supervisedUsers[j].name == newName) { 400 if (supervisedUsers[j].name == newName) {
401 nameIsUnique = false; 401 nameIsUnique = false;
402 allOnCurrentDevice = allOnCurrentDevice && 402 allOnCurrentDevice =
403 supervisedUsers[j].onCurrentDevice; 403 allOnCurrentDevice && supervisedUsers[j].onCurrentDevice;
404 } 404 }
405 } 405 }
406 406
407 var errorHtml = allOnCurrentDevice ? 407 var errorHtml = allOnCurrentDevice ?
408 loadTimeData.getStringF( 408 loadTimeData.getStringF(
409 'managedProfilesExistingLocalSupervisedUser') : 409 'managedProfilesExistingLocalSupervisedUser') :
410 loadTimeData.getStringF( 410 loadTimeData.getStringF(
411 'manageProfilesExistingSupervisedUser', 411 'manageProfilesExistingSupervisedUser',
412 HTMLEscape(elide(newName, /* maxLength */ 50))); 412 HTMLEscape(elide(newName, /* maxLength */ 50)));
413 this.showErrorBubble_(errorHtml, 'create', true); 413 this.showErrorBubble_(errorHtml, 'create', true);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 448
449 /** 449 /**
450 * Called when the user clicks "OK" or hits enter. Saves the newly changed 450 * Called when the user clicks "OK" or hits enter. Saves the newly changed
451 * profile info. 451 * profile info.
452 * @private 452 * @private
453 */ 453 */
454 submitManageChanges_: function() { 454 submitManageChanges_: function() {
455 var name = $('manage-profile-name').value; 455 var name = $('manage-profile-name').value;
456 var iconURL = $('manage-profile-icon-grid').selectedItem; 456 var iconURL = $('manage-profile-icon-grid').selectedItem;
457 457
458 chrome.send('setProfileIconAndName', 458 chrome.send(
459 [this.profileInfo_.filePath, iconURL, name]); 459 'setProfileIconAndName', [this.profileInfo_.filePath, iconURL, name]);
460 if (name != this.profileInfo_.name) 460 if (name != this.profileInfo_.name)
461 options.SupervisedUserListData.resetPromise(); 461 options.SupervisedUserListData.resetPromise();
462 }, 462 },
463 463
464 /** 464 /**
465 * Abstract method. Should be overriden in subclasses. 465 * Abstract method. Should be overriden in subclasses.
466 * @param {string} email 466 * @param {string} email
467 * @param {boolean} hasError 467 * @param {boolean} hasError
468 * @protected 468 * @protected
469 */ 469 */
(...skipping 18 matching lines...) Expand all
488 488
489 // Get the user's chosen name and icon, or default if they do not 489 // Get the user's chosen name and icon, or default if they do not
490 // wish to customize their profile. 490 // wish to customize their profile.
491 var name = $('create-profile-name').value; 491 var name = $('create-profile-name').value;
492 var iconUrl = $('create-profile-icon-grid').selectedItem; 492 var iconUrl = $('create-profile-icon-grid').selectedItem;
493 var createShortcut = $('create-shortcut').checked; 493 var createShortcut = $('create-shortcut').checked;
494 var isSupervised = $('create-profile-supervised').checked; 494 var isSupervised = $('create-profile-supervised').checked;
495 var existingSupervisedUserId = ''; 495 var existingSupervisedUserId = '';
496 496
497 // 'createProfile' is handled by the CreateProfileHandler. 497 // 'createProfile' is handled by the CreateProfileHandler.
498 chrome.send('createProfile', 498 chrome.send('createProfile', [
499 [name, iconUrl, createShortcut, 499 name, iconUrl, createShortcut, isSupervised, existingSupervisedUserId
500 isSupervised, existingSupervisedUserId]); 500 ]);
501 }, 501 },
502 502
503 /** 503 /**
504 * Called when the selected icon in the icon grid changes. 504 * Called when the selected icon in the icon grid changes.
505 * @param {string} mode A label that specifies the type of dialog box which 505 * @param {string} mode A label that specifies the type of dialog box which
506 * is currently being viewed (i.e. 'create' or 'manage'). 506 * is currently being viewed (i.e. 'create' or 'manage').
507 * @private 507 * @private
508 */ 508 */
509 onIconGridSelectionChanged_: function(mode) { 509 onIconGridSelectionChanged_: function(mode) {
510 var iconURL = $(mode + '-profile-icon-grid').selectedItem; 510 var iconURL = $(mode + '-profile-icon-grid').selectedItem;
511 if (!iconURL || iconURL == this.iconGridSelectedURL_) 511 if (!iconURL || iconURL == this.iconGridSelectedURL_)
512 return; 512 return;
513 this.iconGridSelectedURL_ = iconURL; 513 this.iconGridSelectedURL_ = iconURL;
514 if (this.profileNameIsDefault_) { 514 if (this.profileNameIsDefault_) {
515 var index = $(mode + '-profile-icon-grid').selectionModel.selectedIndex; 515 var index = $(mode + '-profile-icon-grid').selectionModel.selectedIndex;
516 var name = this.defaultProfileNames_[index]; 516 var name = this.defaultProfileNames_[index];
517 if (name) { 517 if (name) {
518 this.setProfileName_(name, mode); 518 this.setProfileName_(name, mode);
519 this.updateCreateOrImport_(mode); 519 this.updateCreateOrImport_(mode);
520 } 520 }
521 } 521 }
522 if (this.profileInfo_ && this.profileInfo_.filePath) { 522 if (this.profileInfo_ && this.profileInfo_.filePath) {
523 chrome.send('profileIconSelectionChanged', 523 chrome.send(
524 [this.profileInfo_.filePath, iconURL]); 524 'profileIconSelectionChanged',
525 [this.profileInfo_.filePath, iconURL]);
525 } 526 }
526 }, 527 },
527 528
528 /** 529 /**
529 * Updates the contents of the "Manage Profile" section of the dialog, 530 * Updates the contents of the "Manage Profile" section of the dialog,
530 * and shows that section. 531 * and shows that section.
531 * @private 532 * @private
532 */ 533 */
533 prepareForManageDialog_: function() { 534 prepareForManageDialog_: function() {
534 chrome.send('refreshGaiaPicture'); 535 chrome.send('refreshGaiaPicture');
(...skipping 26 matching lines...) Expand all
561 * @private 562 * @private
562 */ 563 */
563 showDeleteDialog_: function(profileInfo) { 564 showDeleteDialog_: function(profileInfo) {
564 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); 565 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage');
565 $('manage-profile-overlay-create').hidden = true; 566 $('manage-profile-overlay-create').hidden = true;
566 $('manage-profile-overlay-manage').hidden = true; 567 $('manage-profile-overlay-manage').hidden = true;
567 $('manage-profile-overlay-delete').hidden = false; 568 $('manage-profile-overlay-delete').hidden = false;
568 $('manage-profile-overlay-disconnect-managed').hidden = true; 569 $('manage-profile-overlay-disconnect-managed').hidden = true;
569 $('delete-profile-icon').style.content = 570 $('delete-profile-icon').style.content =
570 cr.icon.getImage(profileInfo.iconURL); 571 cr.icon.getImage(profileInfo.iconURL);
571 $('delete-profile-text').textContent = 572 $('delete-profile-text').textContent = loadTimeData.getStringF(
572 loadTimeData.getStringF('deleteProfileMessage', 573 'deleteProfileMessage', elide(profileInfo.name, /* maxLength */ 50));
573 elide(profileInfo.name, /* maxLength */ 50));
574 $('delete-supervised-profile-addendum').hidden = 574 $('delete-supervised-profile-addendum').hidden =
575 !profileInfo.isSupervised || profileInfo.isChild; 575 !profileInfo.isSupervised || profileInfo.isChild;
576 576
577 // Because this dialog isn't useful when refreshing or as part of the 577 // Because this dialog isn't useful when refreshing or as part of the
578 // history, don't create a history entry for it when showing. 578 // history, don't create a history entry for it when showing.
579 PageManager.showPageByName('manageProfile', false); 579 PageManager.showPageByName('manageProfile', false);
580 chrome.send('logDeleteUserDialogShown'); 580 chrome.send('logDeleteUserDialogShown');
581 }, 581 },
582 582
583 /** 583 /**
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 'showDeleteDialog', 619 'showDeleteDialog',
620 'showDisconnectManagedProfileDialog', 620 'showDisconnectManagedProfileDialog',
621 'showCreateDialog', 621 'showCreateDialog',
622 ]); 622 ]);
623 623
624 /** 624 /**
625 * @constructor 625 * @constructor
626 * @extends {options.ManageProfileOverlay} 626 * @extends {options.ManageProfileOverlay}
627 */ 627 */
628 function DisconnectAccountOverlay() { 628 function DisconnectAccountOverlay() {
629 Page.call(this, 'signOut', 629 Page.call(
630 loadTimeData.getString('disconnectAccountTabTitle'), 630 this, 'signOut', loadTimeData.getString('disconnectAccountTabTitle'),
631 'manage-profile-overlay'); 631 'manage-profile-overlay');
632 } 632 }
633 633
634 cr.addSingletonGetter(DisconnectAccountOverlay); 634 cr.addSingletonGetter(DisconnectAccountOverlay);
635 635
636 DisconnectAccountOverlay.prototype = { 636 DisconnectAccountOverlay.prototype = {
637 __proto__: ManageProfileOverlay.prototype, 637 __proto__: ManageProfileOverlay.prototype,
638 638
639 /** @override */ 639 /** @override */
640 canShowPage: function() { 640 canShowPage: function() {
641 var syncData = loadTimeData.getValue('syncData'); 641 var syncData = loadTimeData.getValue('syncData');
642 return syncData.signedIn && !syncData.signoutAllowed; 642 return syncData.signedIn && !syncData.signoutAllowed;
643 }, 643 },
644 644
645 /** @override */ 645 /** @override */
646 didShowPage: function() { 646 didShowPage: function() {
647 chrome.send('showDisconnectManagedProfileDialog'); 647 chrome.send('showDisconnectManagedProfileDialog');
648 } 648 }
649 }; 649 };
650 650
651 /** 651 /**
652 * @constructor 652 * @constructor
653 * @extends {options.ManageProfileOverlay} 653 * @extends {options.ManageProfileOverlay}
654 */ 654 */
655 function CreateProfileOverlay() { 655 function CreateProfileOverlay() {
656 Page.call(this, 'createProfile', 656 Page.call(
657 loadTimeData.getString('createProfileTabTitle'), 657 this, 'createProfile', loadTimeData.getString('createProfileTabTitle'),
658 'manage-profile-overlay'); 658 'manage-profile-overlay');
659 } 659 }
660 660
661 cr.addSingletonGetter(CreateProfileOverlay); 661 cr.addSingletonGetter(CreateProfileOverlay);
662 662
663 CreateProfileOverlay.prototype = { 663 CreateProfileOverlay.prototype = {
664 __proto__: ManageProfileOverlay.prototype, 664 __proto__: ManageProfileOverlay.prototype,
665 665
666 // The signed-in email address of the current profile, or empty if they're 666 // The signed-in email address of the current profile, or empty if they're
667 // not signed in. 667 // not signed in.
668 signedInEmail_: '', 668 signedInEmail_: '',
(...skipping 10 matching lines...) Expand all
679 didShowPage: function() { 679 didShowPage: function() {
680 chrome.send('requestCreateProfileUpdate'); 680 chrome.send('requestCreateProfileUpdate');
681 chrome.send('requestDefaultProfileIcons', ['create']); 681 chrome.send('requestDefaultProfileIcons', ['create']);
682 chrome.send('requestNewProfileDefaults'); 682 chrome.send('requestNewProfileDefaults');
683 683
684 $('manage-profile-overlay-create').hidden = false; 684 $('manage-profile-overlay-create').hidden = false;
685 $('manage-profile-overlay-manage').hidden = true; 685 $('manage-profile-overlay-manage').hidden = true;
686 $('manage-profile-overlay-delete').hidden = true; 686 $('manage-profile-overlay-delete').hidden = true;
687 $('manage-profile-overlay-disconnect-managed').hidden = true; 687 $('manage-profile-overlay-disconnect-managed').hidden = true;
688 $('create-profile-instructions').textContent = 688 $('create-profile-instructions').textContent =
689 loadTimeData.getStringF('createProfileInstructions'); 689 loadTimeData.getStringF('createProfileInstructions');
690 this.hideErrorBubble_(); 690 this.hideErrorBubble_();
691 this.updateCreateInProgress_(false); 691 this.updateCreateInProgress_(false);
692 692
693 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); 693 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled');
694 $('create-shortcut-container').hidden = !shortcutsEnabled; 694 $('create-shortcut-container').hidden = !shortcutsEnabled;
695 $('create-shortcut').checked = shortcutsEnabled; 695 $('create-shortcut').checked = shortcutsEnabled;
696 696
697 $('create-profile-name-label').hidden = true; 697 $('create-profile-name-label').hidden = true;
698 $('create-profile-name').hidden = true; 698 $('create-profile-name').hidden = true;
699 $('create-profile-ok').disabled = true; 699 $('create-profile-ok').disabled = true;
(...skipping 11 matching lines...) Expand all
711 this.profileNameIsDefault_ = false; 711 this.profileNameIsDefault_ = false;
712 }, 712 },
713 713
714 /** @override */ 714 /** @override */
715 handleCancel: function() { 715 handleCancel: function() {
716 this.cancelCreateProfile_(); 716 this.cancelCreateProfile_();
717 }, 717 },
718 718
719 /** @override */ 719 /** @override */
720 showErrorBubble_: function(errorHtml) { 720 showErrorBubble_: function(errorHtml) {
721 ManageProfileOverlay.getInstance().showErrorBubble_(errorHtml, 721 ManageProfileOverlay.getInstance().showErrorBubble_(
722 'create', 722 errorHtml, 'create', false);
723 false);
724 }, 723 },
725 724
726 /** @override */ 725 /** @override */
727 hideErrorBubble_: function() { 726 hideErrorBubble_: function() {
728 ManageProfileOverlay.getInstance().hideErrorBubble_('create'); 727 ManageProfileOverlay.getInstance().hideErrorBubble_('create');
729 }, 728 },
730 729
731 /** 730 /**
732 * Updates the UI when a profile create step begins or ends. 731 * Updates the UI when a profile create step begins or ends.
733 * Note that hideErrorBubble_() also enables the "OK" button, so it 732 * Note that hideErrorBubble_() also enables the "OK" button, so it
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 * @param {boolean} allowed True if creating supervised users should be 867 * @param {boolean} allowed True if creating supervised users should be
869 * allowed. 868 * allowed.
870 * @private 869 * @private
871 */ 870 */
872 updateSupervisedUsersAllowed_: function(allowed) { 871 updateSupervisedUsersAllowed_: function(allowed) {
873 this.supervisedUsersAllowed_ = allowed; 872 this.supervisedUsersAllowed_ = allowed;
874 this.updateCreateSupervisedUserCheckbox_(); 873 this.updateCreateSupervisedUserCheckbox_();
875 874
876 $('create-profile-supervised-sign-in-link').enabled = allowed; 875 $('create-profile-supervised-sign-in-link').enabled = allowed;
877 if (!allowed) { 876 if (!allowed) {
878 $('create-profile-supervised-indicator').setAttribute('controlled-by', 877 $('create-profile-supervised-indicator')
879 'policy'); 878 .setAttribute('controlled-by', 'policy');
880 } else { 879 } else {
881 $('create-profile-supervised-indicator').removeAttribute( 880 $('create-profile-supervised-indicator')
882 'controlled-by'); 881 .removeAttribute('controlled-by');
883 } 882 }
884 }, 883 },
885 884
886 /** 885 /**
887 * Updates the status of the "create supervised user" checkbox. Called from 886 * Updates the status of the "create supervised user" checkbox. Called from
888 * updateSupervisedUsersAllowed_() or updateCreateInProgress_(). 887 * updateSupervisedUsersAllowed_() or updateCreateInProgress_().
889 * updateSignedInStatus_() does not call this method directly, because it 888 * updateSignedInStatus_() does not call this method directly, because it
890 * will be followed by a call to updateSupervisedUsersAllowed_(). 889 * will be followed by a call to updateSupervisedUsersAllowed_().
891 * @private 890 * @private
892 */ 891 */
893 updateCreateSupervisedUserCheckbox_: function() { 892 updateCreateSupervisedUserCheckbox_: function() {
894 $('create-profile-supervised').disabled = 893 $('create-profile-supervised').disabled = !this.supervisedUsersAllowed_ ||
895 !this.supervisedUsersAllowed_ || this.createInProgress_ || 894 this.createInProgress_ || this.signedInEmail_ == '' || this.hasError_;
896 this.signedInEmail_ == '' || this.hasError_;
897 }, 895 },
898 }; 896 };
899 897
900 // Forward public APIs to private implementations. 898 // Forward public APIs to private implementations.
901 cr.makePublic(CreateProfileOverlay, [ 899 cr.makePublic(CreateProfileOverlay, [
902 'cancelCreateProfile', 900 'cancelCreateProfile',
903 'onError', 901 'onError',
904 'onSuccess', 902 'onSuccess',
905 'onWarning', 903 'onWarning',
906 'updateCreateInProgress', 904 'updateCreateInProgress',
907 'updateSignedInStatus', 905 'updateSignedInStatus',
908 'updateSupervisedUsersAllowed', 906 'updateSupervisedUsersAllowed',
909 ]); 907 ]);
910 908
911 // Export 909 // Export
912 return { 910 return {
913 ManageProfileOverlay: ManageProfileOverlay, 911 ManageProfileOverlay: ManageProfileOverlay,
914 DisconnectAccountOverlay: DisconnectAccountOverlay, 912 DisconnectAccountOverlay: DisconnectAccountOverlay,
915 CreateProfileOverlay: CreateProfileOverlay, 913 CreateProfileOverlay: CreateProfileOverlay,
916 }; 914 };
917 }); 915 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698