| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 $('manage-profile-cancel').onclick = | 61 $('manage-profile-cancel').onclick = |
| 62 $('delete-profile-cancel').onclick = function(event) { | 62 $('delete-profile-cancel').onclick = function(event) { |
| 63 OptionsPage.closeOverlay(); | 63 OptionsPage.closeOverlay(); |
| 64 }; | 64 }; |
| 65 $('delete-profile-ok').onclick = function(event) { | 65 $('delete-profile-ok').onclick = function(event) { |
| 66 OptionsPage.closeOverlay(); | 66 OptionsPage.closeOverlay(); |
| 67 if (BrowserOptions.getCurrentProfile().isManaged) | 67 if (BrowserOptions.getCurrentProfile().isManaged) |
| 68 return; | 68 return; |
| 69 chrome.send('deleteProfile', [self.profileInfo_.filePath]); | 69 chrome.send('deleteProfile', [self.profileInfo_.filePath]); |
| 70 options.ManagedUserListData.reloadExistingManagedUsers(); | 70 options.ManagedUserListData.resetPromise(); |
| 71 }; | 71 }; |
| 72 $('add-shortcut-button').onclick = function(event) { | 72 $('add-shortcut-button').onclick = function(event) { |
| 73 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); | 73 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); |
| 74 }; | 74 }; |
| 75 $('remove-shortcut-button').onclick = function(event) { | 75 $('remove-shortcut-button').onclick = function(event) { |
| 76 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); | 76 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 $('create-profile-managed-signed-in-learn-more-link').onclick = | 79 $('create-profile-managed-signed-in-learn-more-link').onclick = |
| 80 function(event) { | 80 function(event) { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 /** | 309 /** |
| 310 * Checks if a supervised user with the currently entered name already | 310 * Checks if a supervised user with the currently entered name already |
| 311 * exists. | 311 * exists. |
| 312 * @private | 312 * @private |
| 313 */ | 313 */ |
| 314 checkIfSupervisedUserExists_: function() { | 314 checkIfSupervisedUserExists_: function() { |
| 315 if (!$('create-profile-managed').checked) { | 315 if (!$('create-profile-managed').checked) { |
| 316 this.updateOkButton_('create'); | 316 this.updateOkButton_('create'); |
| 317 return; | 317 return; |
| 318 } | 318 } |
| 319 options.ManagedUserListData.requestExistingManagedUsers( | 319 options.ManagedUserListData.requestExistingManagedUsers().then( |
| 320 this.receiveExistingManagedUsers_.bind(this), | 320 this.receiveExistingManagedUsers_.bind(this), |
| 321 this.onSigninError_.bind(this)); | 321 this.onSigninError_.bind(this)); |
| 322 }, | 322 }, |
| 323 | 323 |
| 324 /** | 324 /** |
| 325 * Callback which receives the list of existing managed users. Checks if the | 325 * Callback which receives the list of existing managed users. Checks if the |
| 326 * currently entered name is the name of an already existing managed user. | 326 * currently entered name is the name of an already existing managed user. |
| 327 * If yes, the user is prompted to import the existing managed user, and the | 327 * If yes, the user is prompted to import the existing managed user, and the |
| 328 * create button is disabled. | 328 * create button is disabled. |
| 329 * @param {Array.<Object>} The list of existing managed users. | 329 * @param {Array.<Object>} The list of existing managed users. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 * Called when the user clicks "OK" or hits enter. Saves the newly changed | 396 * Called when the user clicks "OK" or hits enter. Saves the newly changed |
| 397 * profile info. | 397 * profile info. |
| 398 * @private | 398 * @private |
| 399 */ | 399 */ |
| 400 submitManageChanges_: function() { | 400 submitManageChanges_: function() { |
| 401 var name = $('manage-profile-name').value; | 401 var name = $('manage-profile-name').value; |
| 402 var iconURL = $('manage-profile-icon-grid').selectedItem; | 402 var iconURL = $('manage-profile-icon-grid').selectedItem; |
| 403 | 403 |
| 404 chrome.send('setProfileIconAndName', | 404 chrome.send('setProfileIconAndName', |
| 405 [this.profileInfo_.filePath, iconURL, name]); | 405 [this.profileInfo_.filePath, iconURL, name]); |
| 406 if (name != this.profileInfo_.name) |
| 407 options.ManagedUserListData.resetPromise(); |
| 406 }, | 408 }, |
| 407 | 409 |
| 408 /** | 410 /** |
| 409 * Called when the user clicks "OK" or hits enter. Creates the profile | 411 * Called when the user clicks "OK" or hits enter. Creates the profile |
| 410 * using the information in the dialog. | 412 * using the information in the dialog. |
| 411 * @private | 413 * @private |
| 412 */ | 414 */ |
| 413 submitCreateProfile_: function() { | 415 submitCreateProfile_: function() { |
| 414 // This is visual polish: the UI to access this should be disabled for | 416 // This is visual polish: the UI to access this should be disabled for |
| 415 // managed users, and the back end will prevent user creation anyway. | 417 // managed users, and the back end will prevent user creation anyway. |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 * name: "Profile Name", | 665 * name: "Profile Name", |
| 664 * filePath: "/path/to/profile/data/on/disk" | 666 * filePath: "/path/to/profile/data/on/disk" |
| 665 * isManaged: (true|false), | 667 * isManaged: (true|false), |
| 666 * }; | 668 * }; |
| 667 * @private | 669 * @private |
| 668 */ | 670 */ |
| 669 onSuccess_: function(profileInfo) { | 671 onSuccess_: function(profileInfo) { |
| 670 this.updateCreateInProgress_(false); | 672 this.updateCreateInProgress_(false); |
| 671 OptionsPage.closeOverlay(); | 673 OptionsPage.closeOverlay(); |
| 672 if (profileInfo.isManaged) { | 674 if (profileInfo.isManaged) { |
| 673 options.ManagedUserListData.reloadExistingManagedUsers(); | 675 options.ManagedUserListData.resetPromise(); |
| 674 profileInfo.custodianEmail = this.signedInEmail_; | 676 profileInfo.custodianEmail = this.signedInEmail_; |
| 675 ManagedUserCreateConfirmOverlay.setProfileInfo(profileInfo); | 677 ManagedUserCreateConfirmOverlay.setProfileInfo(profileInfo); |
| 676 OptionsPage.showPageByName('managedUserCreateConfirm', false); | 678 OptionsPage.showPageByName('managedUserCreateConfirm', false); |
| 677 BrowserOptions.updateManagesSupervisedUsers(true); | 679 BrowserOptions.updateManagesSupervisedUsers(true); |
| 678 } | 680 } |
| 679 }, | 681 }, |
| 680 | 682 |
| 681 /** | 683 /** |
| 682 * Updates the signed-in or not-signed-in UI when in create mode. Called by | 684 * Updates the signed-in or not-signed-in UI when in create mode. Called by |
| 683 * the handler in response to the 'requestCreateProfileUpdate' message. | 685 * the handler in response to the 'requestCreateProfileUpdate' message. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 return instance[name + '_'].apply(instance, arguments); | 783 return instance[name + '_'].apply(instance, arguments); |
| 782 }; | 784 }; |
| 783 }); | 785 }); |
| 784 | 786 |
| 785 // Export | 787 // Export |
| 786 return { | 788 return { |
| 787 ManageProfileOverlay: ManageProfileOverlay, | 789 ManageProfileOverlay: ManageProfileOverlay, |
| 788 CreateProfileOverlay: CreateProfileOverlay, | 790 CreateProfileOverlay: CreateProfileOverlay, |
| 789 }; | 791 }; |
| 790 }); | 792 }); |
| OLD | NEW |