Chromium Code Reviews| Index: chrome/browser/resources/options/personal_options.js |
| diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js |
| index 23483d01a22fd0f27e2d2e8adac4a2c5a06e742a..d772da6f1e33c1c3560d371b03aab56c5ffec629 100644 |
| --- a/chrome/browser/resources/options/personal_options.js |
| +++ b/chrome/browser/resources/options/personal_options.js |
| @@ -58,11 +58,7 @@ cr.define('options', function() { |
| profilesList.autoExpands = true; |
| profilesList.onchange = function(event) { |
|
Evan Stade
2011/10/21 01:13:07
this should be
profilesList.onchange = this.setPr
NaveenBobbili (Motorola)
2011/10/22 17:34:35
Done.
|
| - var selectedProfile = profilesList.selectedItem; |
| - var hasSelection = selectedProfile != null; |
| - var hasSingleProfile = profilesList.dataModel.length == 1; |
| - $('profiles-manage').disabled = !hasSelection; |
| - $('profiles-delete').disabled = !hasSingleProfile && !hasSelection; |
| + self.setProfileViewButtonsStatus_(); |
| }; |
| $('profiles-create').onclick = function(event) { |
| chrome.send('createProfile'); |
| @@ -216,6 +212,20 @@ cr.define('options', function() { |
| }, |
| /** |
| + * Helper function to set the status of profile view buttons to disabled or |
| + * enabled, depending on the number of profiles and selection status of the |
| + * profiles list. |
| + */ |
| + setProfileViewButtonsStatus_: function() { |
| + var profilesList = $('profiles-list'); |
| + var selectedProfile = profilesList.selectedItem; |
| + var hasSelection = selectedProfile != null; |
| + var hasSingleProfile = profilesList.dataModel.length == 1; |
| + $('profiles-manage').disabled = !hasSelection; |
| + $('profiles-delete').disabled = !hasSelection || hasSingleProfile; |
| + }, |
| + |
| + /** |
| * Display the correct dialog layout, depending on how many profiles are |
| * available. |
| * @param {number} numProfiles The number of profiles to display. |
| @@ -246,6 +256,7 @@ cr.define('options', function() { |
| // add it to the list, even if the list is hidden so we can access it |
| // later. |
| $('profiles-list').dataModel = new ArrayDataModel(profiles); |
| + this.setProfileViewButtonsStatus_(); |
| }, |
| setStartStopButtonVisible_: function(visible) { |