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..74032a5ff1c7f78b2a9cecdeeba0f2a7562e8c90 100644 |
| --- a/chrome/browser/resources/options/personal_options.js |
| +++ b/chrome/browser/resources/options/personal_options.js |
| @@ -62,7 +62,7 @@ cr.define('options', function() { |
| var hasSelection = selectedProfile != null; |
| var hasSingleProfile = profilesList.dataModel.length == 1; |
| $('profiles-manage').disabled = !hasSelection; |
| - $('profiles-delete').disabled = !hasSingleProfile && !hasSelection; |
| + $('profiles-delete').disabled = !hasSelection || hasSingleProfile; |
| }; |
| $('profiles-create').onclick = function(event) { |
| chrome.send('createProfile'); |
| @@ -242,10 +242,25 @@ cr.define('options', function() { |
| * }; |
| */ |
| setProfilesInfo_: function(profiles) { |
| + var profilesList = $('profiles-list'); |
| this.setProfileViewSingle_(profiles.length); |
| // add it to the list, even if the list is hidden so we can access it |
| // later. |
| - $('profiles-list').dataModel = new ArrayDataModel(profiles); |
| + profilesList.dataModel = new ArrayDataModel(profiles); |
| + // Enable/Disable delete and edit buttons based on the number of profiles |
| + // and the selection status. |
| + var hasSelection = profilesList.selectedItem != null; |
| + var hasSingleProfile = profilesList.dataModel.length == 1; |
| + this.setDeleteButtonEnabled_(!hasSingleProfile && hasSelection); |
| + this.setEditButtonEnabled_(hasSelection); |
|
binji
2011/10/19 22:07:11
Create a helper function consisting of these four
NaveenBobbili (Motorola)
2011/10/20 05:46:15
Done.
|
| + }, |
| + |
| + setDeleteButtonEnabled_: function(enabled) { |
|
binji
2011/10/19 22:07:11
Please remove this helper function. The similar fu
NaveenBobbili (Motorola)
2011/10/20 05:46:15
Done.
|
| + $('profiles-delete').disabled = !enabled; |
| + }, |
| + |
| + setEditButtonEnabled_: function(enabled) { |
|
binji
2011/10/19 22:07:11
Please remove this helper function.
NaveenBobbili (Motorola)
2011/10/20 05:46:15
Done.
|
| + $('profiles-manage').disabled = !enabled; |
| }, |
| setStartStopButtonVisible_: function(visible) { |