| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 /** | 431 /** |
| 432 * Called to update the state of the ok button depending if the name is | 432 * Called to update the state of the ok button depending if the name is |
| 433 * already used or not. | 433 * already used or not. |
| 434 * @param {string} mode A label that specifies the type of dialog box which | 434 * @param {string} mode A label that specifies the type of dialog box which |
| 435 * is currently being viewed (i.e. 'create' or 'manage'). | 435 * is currently being viewed (i.e. 'create' or 'manage'). |
| 436 * @private | 436 * @private |
| 437 */ | 437 */ |
| 438 updateOkButton_: function(mode) { | 438 updateOkButton_: function(mode) { |
| 439 var oldName = this.profileInfo_.name; | 439 var oldName = this.profileInfo_.name; |
| 440 var newName = $(mode + '-profile-name').value; | 440 var newName = $(mode + '-profile-name').value; |
| 441 var nameIsDuplicate = this.existingProfileNames_[newName] != undefined; | 441 this.hideErrorBubble_(mode); |
| 442 if (mode == 'manage' && oldName == newName) | |
| 443 nameIsDuplicate = false; | |
| 444 if (nameIsDuplicate) { | |
| 445 var errorHtml = | |
| 446 loadTimeData.getString('manageProfilesDuplicateNameError'); | |
| 447 this.showErrorBubble_(errorHtml, mode, true); | |
| 448 } else { | |
| 449 this.hideErrorBubble_(mode); | |
| 450 | 442 |
| 451 var nameIsValid = $(mode + '-profile-name').validity.valid; | 443 var nameIsValid = $(mode + '-profile-name').validity.valid; |
| 452 $(mode + '-profile-ok').disabled = !nameIsValid; | 444 $(mode + '-profile-ok').disabled = !nameIsValid; |
| 453 } | |
| 454 }, | 445 }, |
| 455 | 446 |
| 456 /** | 447 /** |
| 457 * Called when the user clicks "OK" or hits enter. Saves the newly changed | 448 * Called when the user clicks "OK" or hits enter. Saves the newly changed |
| 458 * profile info. | 449 * profile info. |
| 459 * @private | 450 * @private |
| 460 */ | 451 */ |
| 461 submitManageChanges_: function() { | 452 submitManageChanges_: function() { |
| 462 var name = $('manage-profile-name').value; | 453 var name = $('manage-profile-name').value; |
| 463 var iconURL = $('manage-profile-icon-grid').selectedItem; | 454 var iconURL = $('manage-profile-icon-grid').selectedItem; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 'updateSignedInStatus', | 878 'updateSignedInStatus', |
| 888 'updateSupervisedUsersAllowed', | 879 'updateSupervisedUsersAllowed', |
| 889 ]); | 880 ]); |
| 890 | 881 |
| 891 // Export | 882 // Export |
| 892 return { | 883 return { |
| 893 ManageProfileOverlay: ManageProfileOverlay, | 884 ManageProfileOverlay: ManageProfileOverlay, |
| 894 CreateProfileOverlay: CreateProfileOverlay, | 885 CreateProfileOverlay: CreateProfileOverlay, |
| 895 }; | 886 }; |
| 896 }); | 887 }); |
| OLD | NEW |