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

Side by Side Diff: chrome/browser/resources/options2/manage_profile_overlay.js

Issue 10834142: [options2] Fix issue when deleting a user and pressing back. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: let's try again Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 var ArrayDataModel = cr.ui.ArrayDataModel; 7 var ArrayDataModel = cr.ui.ArrayDataModel;
8 8
9 /** 9 /**
10 * ManageProfileOverlay class 10 * ManageProfileOverlay class
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 var name = $('create-profile-name').value; 78 var name = $('create-profile-name').value;
79 var icon_url = createIconGrid.selectedItem; 79 var icon_url = createIconGrid.selectedItem;
80 chrome.send('createProfile', [name, icon_url]); 80 chrome.send('createProfile', [name, icon_url]);
81 }; 81 };
82 }, 82 },
83 83
84 /** @inheritDoc */ 84 /** @inheritDoc */
85 didShowPage: function() { 85 didShowPage: function() {
86 chrome.send('requestDefaultProfileIcons'); 86 chrome.send('requestDefaultProfileIcons');
87 87
88 // Use the hash to specify the profile index. Note: the actual index 88 if (window.location.pathname == '/manageProfile')
89 // is ignored. Only the current profile may be edited.
90 if (window.location.hash.length > 1)
91 ManageProfileOverlay.getInstance().prepareForManageDialog_(); 89 ManageProfileOverlay.getInstance().prepareForManageDialog_();
92 90
93 $('manage-profile-name').focus(); 91 $('manage-profile-name').focus();
94 $('create-profile-name').focus(); 92 $('create-profile-name').focus();
95 }, 93 },
96 94
97 /** 95 /**
98 * Set the profile info used in the dialog. 96 * Set the profile info used in the dialog.
99 * @param {Object} profileInfo An object of the form: 97 * @param {Object} profileInfo An object of the form:
100 * profileInfo = { 98 * profileInfo = {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 chrome.send('profileIconSelectionChanged', 229 chrome.send('profileIconSelectionChanged',
232 [this.profileInfo_.filePath, iconURL]); 230 [this.profileInfo_.filePath, iconURL]);
233 }, 231 },
234 232
235 /** 233 /**
236 * Updates the contents of the "Manage Profile" section of the dialog, 234 * Updates the contents of the "Manage Profile" section of the dialog,
237 * and shows that section. 235 * and shows that section.
238 * @private 236 * @private
239 */ 237 */
240 prepareForManageDialog_: function() { 238 prepareForManageDialog_: function() {
239 if (cr.isChromeOS)
Dan Beam 2012/08/07 21:31:31 so apparently chromeos uses /accounts and hides th
240 return;
241
241 var profileInfo = BrowserOptions.getCurrentProfile(); 242 var profileInfo = BrowserOptions.getCurrentProfile();
242 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); 243 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage');
243 $('manage-profile-overlay-create').hidden = true; 244 $('manage-profile-overlay-create').hidden = true;
244 $('manage-profile-overlay-manage').hidden = false; 245 $('manage-profile-overlay-manage').hidden = false;
245 $('manage-profile-overlay-delete').hidden = true; 246 $('manage-profile-overlay-delete').hidden = true;
246 this.hideErrorBubble_('manage'); 247 this.hideErrorBubble_('manage');
247 }, 248 },
248 249
249 /** 250 /**
250 * Display the "Manage Profile" dialog. 251 * Display the "Manage Profile" dialog.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 */ 284 */
284 showCreateDialog_: function(profileInfo) { 285 showCreateDialog_: function(profileInfo) {
285 ManageProfileOverlay.setProfileInfo(profileInfo, 'create'); 286 ManageProfileOverlay.setProfileInfo(profileInfo, 'create');
286 $('manage-profile-overlay-create').hidden = false; 287 $('manage-profile-overlay-create').hidden = false;
287 $('manage-profile-overlay-manage').hidden = true; 288 $('manage-profile-overlay-manage').hidden = true;
288 $('manage-profile-overlay-delete').hidden = true; 289 $('manage-profile-overlay-delete').hidden = true;
289 $('create-profile-instructions').textContent = 290 $('create-profile-instructions').textContent =
290 loadTimeData.getStringF('createProfileInstructions'); 291 loadTimeData.getStringF('createProfileInstructions');
291 ManageProfileOverlay.getInstance().hideErrorBubble_('create'); 292 ManageProfileOverlay.getInstance().hideErrorBubble_('create');
292 293
293 OptionsPage.navigateToPage('manageProfile'); 294 OptionsPage.showPageByName('manageProfile', false);
294 }, 295 },
295 296
296 }; 297 };
297 298
298 // Forward public APIs to private implementations. 299 // Forward public APIs to private implementations.
299 [ 300 [
300 'receiveDefaultProfileIcons', 301 'receiveDefaultProfileIcons',
301 'receiveProfileNames', 302 'receiveProfileNames',
302 'setProfileInfo', 303 'setProfileInfo',
303 'setProfileName', 304 'setProfileName',
304 'showManageDialog', 305 'showManageDialog',
305 'showDeleteDialog', 306 'showDeleteDialog',
306 'showCreateDialog', 307 'showCreateDialog',
307 ].forEach(function(name) { 308 ].forEach(function(name) {
308 ManageProfileOverlay[name] = function() { 309 ManageProfileOverlay[name] = function() {
309 var instance = ManageProfileOverlay.getInstance(); 310 var instance = ManageProfileOverlay.getInstance();
310 return instance[name + '_'].apply(instance, arguments); 311 return instance[name + '_'].apply(instance, arguments);
311 }; 312 };
312 }); 313 });
313 314
314 // Export 315 // Export
315 return { 316 return {
316 ManageProfileOverlay: ManageProfileOverlay 317 ManageProfileOverlay: ManageProfileOverlay
317 }; 318 };
318 }); 319 });
OLDNEW
« 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