Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2709)

Unified Diff: chrome/browser/resources/options/personal_options.js

Issue 8339014: Options: Disable the delete button when no profile is selected in personal settings. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed review comments by binji@chromium.org Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698