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

Side by Side Diff: chrome/browser/resources/options/personal_options.js

Issue 8200017: [Multi Profile] Add "Delete this user" button for singleton profiles. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 var ArrayDataModel = cr.ui.ArrayDataModel; 8 var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 // State variables. 10 // State variables.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 }; 53 };
54 54
55 // Profiles. 55 // Profiles.
56 var profilesList = $('profiles-list'); 56 var profilesList = $('profiles-list');
57 options.personal_options.ProfileList.decorate(profilesList); 57 options.personal_options.ProfileList.decorate(profilesList);
58 profilesList.autoExpands = true; 58 profilesList.autoExpands = true;
59 59
60 profilesList.onchange = function(event) { 60 profilesList.onchange = function(event) {
61 var selectedProfile = profilesList.selectedItem; 61 var selectedProfile = profilesList.selectedItem;
62 var hasSelection = selectedProfile != null; 62 var hasSelection = selectedProfile != null;
63 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.
63 $('profiles-manage').disabled = !hasSelection; 64 $('profiles-manage').disabled = !hasSelection;
64 $('profiles-delete').disabled = !hasSelection; 65 $('profiles-delete').disabled = !hasOneProfile && !hasSelection;
65 }; 66 };
66 $('profiles-create').onclick = function(event) { 67 $('profiles-create').onclick = function(event) {
67 chrome.send('createProfile'); 68 chrome.send('createProfile');
68 }; 69 };
69 $('profiles-manage').onclick = function(event) { 70 $('profiles-manage').onclick = function(event) {
70 var selectedProfile = self.getSelectedProfileItem_(); 71 var selectedProfile = self.getSelectedProfileItem_();
71 if (selectedProfile) 72 if (selectedProfile)
72 ManageProfileOverlay.showManageDialog(selectedProfile); 73 ManageProfileOverlay.showManageDialog(selectedProfile);
73 }; 74 };
74 $('profiles-delete').onclick = function(event) { 75 $('profiles-delete').onclick = function(event) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 214 }
214 return null; 215 return null;
215 }, 216 },
216 217
217 /** 218 /**
218 * Display the correct dialog layout, depending on how many profiles are 219 * Display the correct dialog layout, depending on how many profiles are
219 * available. 220 * available.
220 * @param {number} numProfiles The number of profiles to display. 221 * @param {number} numProfiles The number of profiles to display.
221 */ 222 */
222 setProfileViewSingle_: function(numProfiles) { 223 setProfileViewSingle_: function(numProfiles) {
223 $('profiles-list').hidden = numProfiles <= 1; 224 var hasOneProfile = numProfiles <= 1;
224 $('profiles-single-message').hidden = numProfiles > 1; 225 $('profiles-list').hidden = hasOneProfile;
225 $('profiles-manage').hidden = numProfiles <= 1; 226 $('profiles-single-message').hidden = !hasOneProfile;
226 $('profiles-delete').hidden = numProfiles <= 1; 227 $('profiles-manage').hidden = hasOneProfile;
228 $('profiles-delete').textContent = hasOneProfile ?
229 templateData.profilesDeleteSingle :
230 templateData.profilesDelete;
227 }, 231 },
228 232
229 /** 233 /**
230 * Adds all |profiles| to the list. 234 * Adds all |profiles| to the list.
231 * @param {Array.<Object>} An array of profile info objects. 235 * @param {Array.<Object>} An array of profile info objects.
232 * each object is of the form: 236 * each object is of the form:
233 * profileInfo = { 237 * profileInfo = {
234 * name: "Profile Name", 238 * name: "Profile Name",
235 * iconURL: "chrome://path/to/icon/image", 239 * iconURL: "chrome://path/to/icon/image",
236 * filePath: "/path/to/profile/data/on/disk", 240 * filePath: "/path/to/profile/data/on/disk",
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 PersonalOptions.getInstance()[name + '_'](value); 334 PersonalOptions.getInstance()[name + '_'](value);
331 }; 335 };
332 }); 336 });
333 337
334 // Export 338 // Export
335 return { 339 return {
336 PersonalOptions: PersonalOptions 340 PersonalOptions: PersonalOptions
337 }; 341 };
338 342
339 }); 343 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/personal_options.html ('k') | chrome/browser/ui/webui/options/personal_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698