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

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

Issue 8343032: Resolve conflict and commit patch http://codereview.chromium.org/8339014/ to disable delete butto... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' 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
===================================================================
--- chrome/browser/resources/options/personal_options.js (revision 107614)
+++ chrome/browser/resources/options/personal_options.js (working copy)
@@ -57,14 +57,8 @@
options.personal_options.ProfileList.decorate(profilesList);
profilesList.autoExpands = true;
- profilesList.onchange = function(event) {
- var selectedProfile = profilesList.selectedItem;
- var hasSelection = selectedProfile != null;
- var hasSingleProfile = profilesList.dataModel.length == 1;
- $('profiles-manage').disabled = !hasSelection ||
- !selectedProfile.isCurrentProfile;
- $('profiles-delete').disabled = !hasSingleProfile && !hasSelection;
- };
+ profilesList.onchange = self.setProfileViewButtonsStatus_;
+
$('profiles-create').onclick = function(event) {
chrome.send('createProfile');
};
@@ -221,6 +215,21 @@
},
/**
+ * 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 ||
+ !selectedProfile.isCurrentProfile;
+ $('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.
@@ -251,6 +260,7 @@
// 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