| OLD | NEW |
| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 /** | 216 /** |
| 217 * Helper function to set the status of profile view buttons to disabled or | 217 * Helper function to set the status of profile view buttons to disabled or |
| 218 * enabled, depending on the number of profiles and selection status of the | 218 * enabled, depending on the number of profiles and selection status of the |
| 219 * profiles list. | 219 * profiles list. |
| 220 */ | 220 */ |
| 221 setProfileViewButtonsStatus_: function() { | 221 setProfileViewButtonsStatus_: function() { |
| 222 var profilesList = $('profiles-list'); | 222 var profilesList = $('profiles-list'); |
| 223 var selectedProfile = profilesList.selectedItem; | 223 var selectedProfile = profilesList.selectedItem; |
| 224 var hasSelection = selectedProfile != null; | 224 var hasSelection = selectedProfile != null; |
| 225 var hasSingleProfile = profilesList.dataModel.length == 1; | 225 var hasSingleProfile = profilesList.dataModel.length == 1; |
| 226 $('profiles-manage').disabled = !hasSelection; | 226 $('profiles-manage').disabled = !hasSelection || |
| 227 !selectedProfile.isCurrentProfile; |
| 227 $('profiles-delete').disabled = !hasSelection || hasSingleProfile; | 228 $('profiles-delete').disabled = !hasSelection || hasSingleProfile; |
| 228 }, | 229 }, |
| 229 | 230 |
| 230 /** | 231 /** |
| 231 * Display the correct dialog layout, depending on how many profiles are | 232 * Display the correct dialog layout, depending on how many profiles are |
| 232 * available. | 233 * available. |
| 233 * @param {number} numProfiles The number of profiles to display. | 234 * @param {number} numProfiles The number of profiles to display. |
| 234 */ | 235 */ |
| 235 setProfileViewSingle_: function(numProfiles) { | 236 setProfileViewSingle_: function(numProfiles) { |
| 236 var hasSingleProfile = numProfiles == 1; | 237 var hasSingleProfile = numProfiles == 1; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 PersonalOptions.getInstance()[name + '_'](value); | 349 PersonalOptions.getInstance()[name + '_'](value); |
| 349 }; | 350 }; |
| 350 }); | 351 }); |
| 351 | 352 |
| 352 // Export | 353 // Export |
| 353 return { | 354 return { |
| 354 PersonalOptions: PersonalOptions | 355 PersonalOptions: PersonalOptions |
| 355 }; | 356 }; |
| 356 | 357 |
| 357 }); | 358 }); |
| OLD | NEW |