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 3b44018deacb49d5b97e49616dcc266422bc4968..3b44c5d17250b855c3727df900793def26e0f4cf 100644 |
| --- a/chrome/browser/resources/options/personal_options.js |
| +++ b/chrome/browser/resources/options/personal_options.js |
| @@ -60,8 +60,9 @@ cr.define('options', function() { |
| profilesList.onchange = function(event) { |
| var selectedProfile = profilesList.selectedItem; |
| var hasSelection = selectedProfile != null; |
| + var hasOneProfile = profilesList.dataModel.length <= 1; |
|
James Hawkins
2011/10/08 18:17:39
What if the length is 0? I don't think this varia
binji
2011/10/10 17:23:03
Done.
|
| $('profiles-manage').disabled = !hasSelection; |
| - $('profiles-delete').disabled = !hasSelection; |
| + $('profiles-delete').disabled = !hasOneProfile && !hasSelection; |
| }; |
| $('profiles-create').onclick = function(event) { |
| chrome.send('createProfile'); |
| @@ -220,10 +221,13 @@ cr.define('options', function() { |
| * @param {number} numProfiles The number of profiles to display. |
| */ |
| setProfileViewSingle_: function(numProfiles) { |
| - $('profiles-list').hidden = numProfiles <= 1; |
| - $('profiles-single-message').hidden = numProfiles > 1; |
| - $('profiles-manage').hidden = numProfiles <= 1; |
| - $('profiles-delete').hidden = numProfiles <= 1; |
| + var hasOneProfile = numProfiles <= 1; |
| + $('profiles-list').hidden = hasOneProfile; |
| + $('profiles-single-message').hidden = !hasOneProfile; |
| + $('profiles-manage').hidden = hasOneProfile; |
| + $('profiles-delete').textContent = hasOneProfile ? |
| + templateData.profilesDeleteSingle : |
| + templateData.profilesDelete; |
| }, |
| /** |