| 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 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 /** |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 }, | 413 }, |
| 414 | 414 |
| 415 /** | 415 /** |
| 416 * Called in case the request for the list of supervised users fails because | 416 * Called in case the request for the list of supervised users fails because |
| 417 * of a signin error. | 417 * of a signin error. |
| 418 * @private | 418 * @private |
| 419 */ | 419 */ |
| 420 onSigninError_: function() { | 420 onSigninError_: function() { |
| 421 this.updateSignedInStatus_(this.signedInEmail_, true); | 421 this.updateSignedInStatus(this.signedInEmail_, true); |
| 422 }, | 422 }, |
| 423 | 423 |
| 424 /** | 424 /** |
| 425 * Called to update the state of the ok button depending if the name is | 425 * Called to update the state of the ok button depending if the name is |
| 426 * already used or not. | 426 * already used or not. |
| 427 * @param {string} mode A label that specifies the type of dialog box which | 427 * @param {string} mode A label that specifies the type of dialog box which |
| 428 * is currently being viewed (i.e. 'create' or 'manage'). | 428 * is currently being viewed (i.e. 'create' or 'manage'). |
| 429 * @private | 429 * @private |
| 430 */ | 430 */ |
| 431 updateOkButton_: function(mode) { | 431 updateOkButton_: function(mode) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 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('setProfileIconAndName', |
| 459 [this.profileInfo_.filePath, iconURL, name]); | 459 [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 /** @private */ | 464 /** |
| 465 updateSignedInStatus_: assertNotReached, | 465 * Abstract method. Should be overriden in subclasses. |
| 466 * @param {string} email |
| 467 * @param {boolean} hasError |
| 468 * @protected |
| 469 */ |
| 470 updateSignedInStatus: function(email, hasError) { |
| 471 assertNotReached(); |
| 472 }, |
| 466 | 473 |
| 467 /** | 474 /** |
| 468 * Called when the user clicks "OK" or hits enter. Creates the profile | 475 * Called when the user clicks "OK" or hits enter. Creates the profile |
| 469 * using the information in the dialog. | 476 * using the information in the dialog. |
| 470 * @private | 477 * @private |
| 471 */ | 478 */ |
| 472 submitCreateProfile_: function() { | 479 submitCreateProfile_: function() { |
| 473 // This is visual polish: the UI to access this should be disabled for | 480 // This is visual polish: the UI to access this should be disabled for |
| 474 // supervised users, and the back end will prevent user creation anyway. | 481 // supervised users, and the back end will prevent user creation anyway. |
| 475 if (this.profileInfo_ && this.profileInfo_.isSupervised) | 482 if (this.profileInfo_ && this.profileInfo_.isSupervised) |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 if (profileInfo.isSupervised) { | 769 if (profileInfo.isSupervised) { |
| 763 options.SupervisedUserListData.resetPromise(); | 770 options.SupervisedUserListData.resetPromise(); |
| 764 profileInfo.custodianEmail = this.signedInEmail_; | 771 profileInfo.custodianEmail = this.signedInEmail_; |
| 765 SupervisedUserCreateConfirmOverlay.setProfileInfo(profileInfo); | 772 SupervisedUserCreateConfirmOverlay.setProfileInfo(profileInfo); |
| 766 PageManager.showPageByName('supervisedUserCreateConfirm', false); | 773 PageManager.showPageByName('supervisedUserCreateConfirm', false); |
| 767 BrowserOptions.updateManagesSupervisedUsers(true); | 774 BrowserOptions.updateManagesSupervisedUsers(true); |
| 768 } | 775 } |
| 769 }, | 776 }, |
| 770 | 777 |
| 771 /** | 778 /** |
| 779 * @param {string} email |
| 780 * @param {boolean} hasError |
| 781 * @override |
| 782 */ |
| 783 updateSignedInStatus: function(email, hasError) { |
| 784 this.updateSignedInStatus_(email, hasError); |
| 785 }, |
| 786 |
| 787 /** |
| 772 * Updates the signed-in or not-signed-in UI when in create mode. Called by | 788 * Updates the signed-in or not-signed-in UI when in create mode. Called by |
| 773 * the handler in response to the 'requestCreateProfileUpdate' message. | 789 * the handler in response to the 'requestCreateProfileUpdate' message. |
| 774 * updateSupervisedUsersAllowed_ is expected to be called after this is, and | 790 * updateSupervisedUsersAllowed_ is expected to be called after this is, and |
| 775 * will update additional UI elements. | 791 * will update additional UI elements. |
| 776 * @param {string} email The email address of the currently signed-in user. | 792 * @param {string} email The email address of the currently signed-in user. |
| 777 * An empty string indicates that the user is not signed in. | 793 * An empty string indicates that the user is not signed in. |
| 778 * @param {boolean} hasError Whether the user's sign-in credentials are | 794 * @param {boolean} hasError Whether the user's sign-in credentials are |
| 779 * still valid. | 795 * still valid. |
| 780 * @private | 796 * @private |
| 781 */ | 797 */ |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 'updateSignedInStatus', | 876 'updateSignedInStatus', |
| 861 'updateSupervisedUsersAllowed', | 877 'updateSupervisedUsersAllowed', |
| 862 ]); | 878 ]); |
| 863 | 879 |
| 864 // Export | 880 // Export |
| 865 return { | 881 return { |
| 866 ManageProfileOverlay: ManageProfileOverlay, | 882 ManageProfileOverlay: ManageProfileOverlay, |
| 867 CreateProfileOverlay: CreateProfileOverlay, | 883 CreateProfileOverlay: CreateProfileOverlay, |
| 868 }; | 884 }; |
| 869 }); | 885 }); |
| OLD | NEW |