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 | 8 |
9 /** | 9 /** |
10 * ManageProfileOverlay class | 10 * ManageProfileOverlay class |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 /** | 327 /** |
328 * Called when the profile name is changed or the 'create managed' checkbox | 328 * Called when the profile name is changed or the 'create managed' checkbox |
329 * is toggled. Updates the 'ok' button and the 'import existing supervised | 329 * is toggled. Updates the 'ok' button and the 'import existing supervised |
330 * user' link. | 330 * user' link. |
331 * @param {string} mode A label that specifies the type of dialog box which | 331 * @param {string} mode A label that specifies the type of dialog box which |
332 * is currently being viewed (i.e. 'create' or 'manage'). | 332 * is currently being viewed (i.e. 'create' or 'manage'). |
333 * @private | 333 * @private |
334 */ | 334 */ |
335 updateCreateOrImport_: function(mode) { | 335 updateCreateOrImport_: function(mode) { |
336 // In 'create' mode, check for existing managed users with the same name. | 336 // In 'create' mode, check for existing managed users with the same name. |
337 if (mode == 'create' && | 337 if (mode == 'create' && $('create-profile-managed').checked) { |
338 !loadTimeData.getBoolean('disableCreateExistingManagedUsers') && | |
339 $('create-profile-managed').checked) { | |
340 options.ManagedUserListData.requestExistingManagedUsers().then( | 338 options.ManagedUserListData.requestExistingManagedUsers().then( |
341 this.receiveExistingManagedUsers_.bind(this), | 339 this.receiveExistingManagedUsers_.bind(this), |
342 this.onSigninError_.bind(this)); | 340 this.onSigninError_.bind(this)); |
343 } else { | 341 } else { |
344 this.updateOkButton_(mode); | 342 this.updateOkButton_(mode); |
345 } | 343 } |
346 }, | 344 }, |
347 | 345 |
348 /** | 346 /** |
349 * Callback which receives the list of existing managed users. Checks if the | 347 * Callback which receives the list of existing managed users. Checks if the |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); | 630 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); |
633 $('create-shortcut-container').hidden = !shortcutsEnabled; | 631 $('create-shortcut-container').hidden = !shortcutsEnabled; |
634 $('create-shortcut').checked = shortcutsEnabled; | 632 $('create-shortcut').checked = shortcutsEnabled; |
635 | 633 |
636 $('create-profile-name-label').hidden = true; | 634 $('create-profile-name-label').hidden = true; |
637 $('create-profile-name').hidden = true; | 635 $('create-profile-name').hidden = true; |
638 $('create-profile-ok').disabled = true; | 636 $('create-profile-ok').disabled = true; |
639 | 637 |
640 $('create-profile-managed').checked = false; | 638 $('create-profile-managed').checked = false; |
641 $('import-existing-managed-user-link').hidden = true; | 639 $('import-existing-managed-user-link').hidden = true; |
642 if (!loadTimeData.getBoolean('disableCreateExistingManagedUsers')) { | 640 $('create-profile-managed').onchange = function() { |
643 $('create-profile-managed').onchange = function() { | 641 ManageProfileOverlay.getInstance().updateCreateOrImport_('create'); |
644 ManageProfileOverlay.getInstance().updateCreateOrImport_('create'); | 642 }; |
645 }; | |
646 } | |
647 $('create-profile-managed-signed-in').disabled = true; | 643 $('create-profile-managed-signed-in').disabled = true; |
648 $('create-profile-managed-signed-in').hidden = true; | 644 $('create-profile-managed-signed-in').hidden = true; |
649 $('create-profile-managed-not-signed-in').hidden = true; | 645 $('create-profile-managed-not-signed-in').hidden = true; |
650 | 646 |
651 this.profileNameIsDefault_ = false; | 647 this.profileNameIsDefault_ = false; |
652 }, | 648 }, |
653 | 649 |
654 /** @override */ | 650 /** @override */ |
655 handleCancel: function() { | 651 handleCancel: function() { |
656 this.cancelCreateProfile_(); | 652 this.cancelCreateProfile_(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 }, | 780 }, |
785 | 781 |
786 /** | 782 /** |
787 * Enables/disables the 'import existing managed users' link button. | 783 * Enables/disables the 'import existing managed users' link button. |
788 * It also updates the button text. | 784 * It also updates the button text. |
789 * @param {boolean} enable True to enable the link button and | 785 * @param {boolean} enable True to enable the link button and |
790 * false otherwise. | 786 * false otherwise. |
791 * @private | 787 * @private |
792 */ | 788 */ |
793 updateImportExistingManagedUserLink_: function(enable) { | 789 updateImportExistingManagedUserLink_: function(enable) { |
794 if (loadTimeData.getBoolean('disableCreateExistingManagedUsers')) | |
795 return; | |
796 | |
797 var importManagedUserElement = $('import-existing-managed-user-link'); | 790 var importManagedUserElement = $('import-existing-managed-user-link'); |
798 importManagedUserElement.hidden = false; | 791 importManagedUserElement.hidden = false; |
799 importManagedUserElement.disabled = !enable || this.createInProgress_; | 792 importManagedUserElement.disabled = !enable || this.createInProgress_; |
800 importManagedUserElement.textContent = enable ? | 793 importManagedUserElement.textContent = enable ? |
801 loadTimeData.getString('importExistingManagedUserLink') : | 794 loadTimeData.getString('importExistingManagedUserLink') : |
802 loadTimeData.getString('signInToImportManagedUsers'); | 795 loadTimeData.getString('signInToImportManagedUsers'); |
803 }, | 796 }, |
804 | 797 |
805 /** | 798 /** |
806 * Sets whether creating managed users is allowed or not. Called by the | 799 * Sets whether creating managed users is allowed or not. Called by the |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 return instance[name + '_'].apply(instance, arguments); | 846 return instance[name + '_'].apply(instance, arguments); |
854 }; | 847 }; |
855 }); | 848 }); |
856 | 849 |
857 // Export | 850 // Export |
858 return { | 851 return { |
859 ManageProfileOverlay: ManageProfileOverlay, | 852 ManageProfileOverlay: ManageProfileOverlay, |
860 CreateProfileOverlay: CreateProfileOverlay, | 853 CreateProfileOverlay: CreateProfileOverlay, |
861 }; | 854 }; |
862 }); | 855 }); |
OLD | NEW |