OLD | NEW |
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 Loading... |
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 // Just ignore the manage profile dialog on Chrome OS, they use /accounts. |
89 // is ignored. Only the current profile may be edited. | 89 if (!cr.isChromeOS && window.location.pathname == '/manageProfile') |
90 if (window.location.hash.length > 1) | |
91 ManageProfileOverlay.getInstance().prepareForManageDialog_(); | 90 ManageProfileOverlay.getInstance().prepareForManageDialog_(); |
92 | 91 |
93 $('manage-profile-name').focus(); | 92 $('manage-profile-name').focus(); |
94 $('create-profile-name').focus(); | 93 $('create-profile-name').focus(); |
95 }, | 94 }, |
96 | 95 |
97 /** | 96 /** |
98 * Set the profile info used in the dialog. | 97 * Set the profile info used in the dialog. |
99 * @param {Object} profileInfo An object of the form: | 98 * @param {Object} profileInfo An object of the form: |
100 * profileInfo = { | 99 * profileInfo = { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 */ | 282 */ |
284 showCreateDialog_: function(profileInfo) { | 283 showCreateDialog_: function(profileInfo) { |
285 ManageProfileOverlay.setProfileInfo(profileInfo, 'create'); | 284 ManageProfileOverlay.setProfileInfo(profileInfo, 'create'); |
286 $('manage-profile-overlay-create').hidden = false; | 285 $('manage-profile-overlay-create').hidden = false; |
287 $('manage-profile-overlay-manage').hidden = true; | 286 $('manage-profile-overlay-manage').hidden = true; |
288 $('manage-profile-overlay-delete').hidden = true; | 287 $('manage-profile-overlay-delete').hidden = true; |
289 $('create-profile-instructions').textContent = | 288 $('create-profile-instructions').textContent = |
290 loadTimeData.getStringF('createProfileInstructions'); | 289 loadTimeData.getStringF('createProfileInstructions'); |
291 ManageProfileOverlay.getInstance().hideErrorBubble_('create'); | 290 ManageProfileOverlay.getInstance().hideErrorBubble_('create'); |
292 | 291 |
293 OptionsPage.navigateToPage('manageProfile'); | 292 OptionsPage.showPageByName('manageProfile', false); |
294 }, | 293 }, |
295 | 294 |
296 }; | 295 }; |
297 | 296 |
298 // Forward public APIs to private implementations. | 297 // Forward public APIs to private implementations. |
299 [ | 298 [ |
300 'receiveDefaultProfileIcons', | 299 'receiveDefaultProfileIcons', |
301 'receiveProfileNames', | 300 'receiveProfileNames', |
302 'setProfileInfo', | 301 'setProfileInfo', |
303 'setProfileName', | 302 'setProfileName', |
304 'showManageDialog', | 303 'showManageDialog', |
305 'showDeleteDialog', | 304 'showDeleteDialog', |
306 'showCreateDialog', | 305 'showCreateDialog', |
307 ].forEach(function(name) { | 306 ].forEach(function(name) { |
308 ManageProfileOverlay[name] = function() { | 307 ManageProfileOverlay[name] = function() { |
309 var instance = ManageProfileOverlay.getInstance(); | 308 var instance = ManageProfileOverlay.getInstance(); |
310 return instance[name + '_'].apply(instance, arguments); | 309 return instance[name + '_'].apply(instance, arguments); |
311 }; | 310 }; |
312 }); | 311 }); |
313 | 312 |
314 // Export | 313 // Export |
315 return { | 314 return { |
316 ManageProfileOverlay: ManageProfileOverlay | 315 ManageProfileOverlay: ManageProfileOverlay |
317 }; | 316 }; |
318 }); | 317 }); |
OLD | NEW |