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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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' && |
338 !loadTimeData.getBoolean('disableCreateExistingManagedUsers') && | |
339 $('create-profile-managed').checked) { | 338 $('create-profile-managed').checked) { |
Pam (message me for reviews)
2014/04/11 13:54:16
Can this line be moved up?
Adrian Kuegel
2014/04/11 14:04:56
Yes, definitely. Thanks for catching this. Done.
| |
340 options.ManagedUserListData.requestExistingManagedUsers().then( | 339 options.ManagedUserListData.requestExistingManagedUsers().then( |
341 this.receiveExistingManagedUsers_.bind(this), | 340 this.receiveExistingManagedUsers_.bind(this), |
342 this.onSigninError_.bind(this)); | 341 this.onSigninError_.bind(this)); |
343 } else { | 342 } else { |
344 this.updateOkButton_(mode); | 343 this.updateOkButton_(mode); |
345 } | 344 } |
346 }, | 345 }, |
347 | 346 |
348 /** | 347 /** |
349 * Callback which receives the list of existing managed users. Checks if the | 348 * 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'); | 631 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); |
633 $('create-shortcut-container').hidden = !shortcutsEnabled; | 632 $('create-shortcut-container').hidden = !shortcutsEnabled; |
634 $('create-shortcut').checked = shortcutsEnabled; | 633 $('create-shortcut').checked = shortcutsEnabled; |
635 | 634 |
636 $('create-profile-name-label').hidden = true; | 635 $('create-profile-name-label').hidden = true; |
637 $('create-profile-name').hidden = true; | 636 $('create-profile-name').hidden = true; |
638 $('create-profile-ok').disabled = true; | 637 $('create-profile-ok').disabled = true; |
639 | 638 |
640 $('create-profile-managed').checked = false; | 639 $('create-profile-managed').checked = false; |
641 $('import-existing-managed-user-link').hidden = true; | 640 $('import-existing-managed-user-link').hidden = true; |
642 if (!loadTimeData.getBoolean('disableCreateExistingManagedUsers')) { | 641 $('create-profile-managed').onchange = function() { |
643 $('create-profile-managed').onchange = function() { | 642 ManageProfileOverlay.getInstance().updateCreateOrImport_('create'); |
644 ManageProfileOverlay.getInstance().updateCreateOrImport_('create'); | 643 }; |
645 }; | |
646 } | |
647 $('create-profile-managed-signed-in').disabled = true; | 644 $('create-profile-managed-signed-in').disabled = true; |
648 $('create-profile-managed-signed-in').hidden = true; | 645 $('create-profile-managed-signed-in').hidden = true; |
649 $('create-profile-managed-not-signed-in').hidden = true; | 646 $('create-profile-managed-not-signed-in').hidden = true; |
650 | 647 |
651 this.profileNameIsDefault_ = false; | 648 this.profileNameIsDefault_ = false; |
652 }, | 649 }, |
653 | 650 |
654 /** @override */ | 651 /** @override */ |
655 handleCancel: function() { | 652 handleCancel: function() { |
656 this.cancelCreateProfile_(); | 653 this.cancelCreateProfile_(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
784 }, | 781 }, |
785 | 782 |
786 /** | 783 /** |
787 * Enables/disables the 'import existing managed users' link button. | 784 * Enables/disables the 'import existing managed users' link button. |
788 * It also updates the button text. | 785 * It also updates the button text. |
789 * @param {boolean} enable True to enable the link button and | 786 * @param {boolean} enable True to enable the link button and |
790 * false otherwise. | 787 * false otherwise. |
791 * @private | 788 * @private |
792 */ | 789 */ |
793 updateImportExistingManagedUserLink_: function(enable) { | 790 updateImportExistingManagedUserLink_: function(enable) { |
794 if (loadTimeData.getBoolean('disableCreateExistingManagedUsers')) | |
795 return; | |
796 | |
797 var importManagedUserElement = $('import-existing-managed-user-link'); | 791 var importManagedUserElement = $('import-existing-managed-user-link'); |
798 importManagedUserElement.hidden = false; | 792 importManagedUserElement.hidden = false; |
799 importManagedUserElement.disabled = !enable || this.createInProgress_; | 793 importManagedUserElement.disabled = !enable || this.createInProgress_; |
800 importManagedUserElement.textContent = enable ? | 794 importManagedUserElement.textContent = enable ? |
801 loadTimeData.getString('importExistingManagedUserLink') : | 795 loadTimeData.getString('importExistingManagedUserLink') : |
802 loadTimeData.getString('signInToImportManagedUsers'); | 796 loadTimeData.getString('signInToImportManagedUsers'); |
803 }, | 797 }, |
804 | 798 |
805 /** | 799 /** |
806 * Sets whether creating managed users is allowed or not. Called by the | 800 * 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); | 847 return instance[name + '_'].apply(instance, arguments); |
854 }; | 848 }; |
855 }); | 849 }); |
856 | 850 |
857 // Export | 851 // Export |
858 return { | 852 return { |
859 ManageProfileOverlay: ManageProfileOverlay, | 853 ManageProfileOverlay: ManageProfileOverlay, |
860 CreateProfileOverlay: CreateProfileOverlay, | 854 CreateProfileOverlay: CreateProfileOverlay, |
861 }; | 855 }; |
862 }); | 856 }); |
OLD | NEW |