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..9307bbcd38477fe43aaa51b5892726c1f266da2e 100644 |
--- a/chrome/browser/resources/options/personal_options.js |
+++ b/chrome/browser/resources/options/personal_options.js |
@@ -62,7 +62,8 @@ 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 = hasSingleProfile ? |
+ false : !hasSelection; |
Miranda Callahan
2011/10/19 12:42:23
This logic is incorrect. Please reread my comments
NaveenBobbili (Motorola)
2011/10/19 13:01:09
Done.
|
}; |
$('profiles-create').onclick = function(event) { |
chrome.send('createProfile'); |
@@ -242,10 +243,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); |
Miranda Callahan
2011/10/19 12:42:23
This logic is also wrong; for now, the delete butt
NaveenBobbili (Motorola)
2011/10/19 13:01:09
Done.
|
+ this.setEditButtonEnabled_(hasSelection); |
+ }, |
+ |
+ setDeleteButtonEnabled_: function(enabled) { |
+ $('profiles-delete').disabled = !enabled; |
+ }, |
+ |
+ setEditButtonEnabled_: function(enabled) { |
+ $('profiles-manage').disabled = !enabled; |
}, |
setStartStopButtonVisible_: function(visible) { |