| 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.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{actionLinkText: (string|undefined), | 8 * @typedef {{actionLinkText: (string|undefined), |
| 9 * childUser: (boolean|undefined), | 9 * childUser: (boolean|undefined), |
| 10 * hasError: (boolean|undefined), | 10 * hasError: (boolean|undefined), |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 $('profiles-manage').onclick = function(event) { | 343 $('profiles-manage').onclick = function(event) { |
| 344 ManageProfileOverlay.showManageDialog(); | 344 ManageProfileOverlay.showManageDialog(); |
| 345 }; | 345 }; |
| 346 $('profiles-delete').onclick = function(event) { | 346 $('profiles-delete').onclick = function(event) { |
| 347 var selectedProfile = self.getSelectedProfileItem_(); | 347 var selectedProfile = self.getSelectedProfileItem_(); |
| 348 if (selectedProfile) | 348 if (selectedProfile) |
| 349 ManageProfileOverlay.showDeleteDialog(selectedProfile); | 349 ManageProfileOverlay.showDeleteDialog(selectedProfile); |
| 350 }; | 350 }; |
| 351 if (loadTimeData.getBoolean('profileIsSupervised')) { | 351 if (loadTimeData.getBoolean('profileIsSupervised')) { |
| 352 $('profiles-create').disabled = true; | 352 $('profiles-create').disabled = true; |
| 353 } |
| 354 if (!loadTimeData.getBoolean('allowProfileDeletion')) { |
| 353 $('profiles-delete').disabled = true; | 355 $('profiles-delete').disabled = true; |
| 354 $('profiles-list').canDeleteItems = false; | 356 $('profiles-list').canDeleteItems = false; |
| 355 } | 357 } |
| 356 } | 358 } |
| 357 | 359 |
| 358 if (cr.isChromeOS) { | 360 if (cr.isChromeOS) { |
| 359 // Username (canonical email) of the currently logged in user or | 361 // Username (canonical email) of the currently logged in user or |
| 360 // |kGuestUser| if a guest session is active. | 362 // |kGuestUser| if a guest session is active. |
| 361 this.username_ = loadTimeData.getString('username'); | 363 this.username_ = loadTimeData.getString('username'); |
| 362 | 364 |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 * Helper function to set the status of profile view buttons to disabled or | 1401 * Helper function to set the status of profile view buttons to disabled or |
| 1400 * enabled, depending on the number of profiles and selection status of the | 1402 * enabled, depending on the number of profiles and selection status of the |
| 1401 * profiles list. | 1403 * profiles list. |
| 1402 * @private | 1404 * @private |
| 1403 */ | 1405 */ |
| 1404 setProfileViewButtonsStatus_: function() { | 1406 setProfileViewButtonsStatus_: function() { |
| 1405 var profilesList = $('profiles-list'); | 1407 var profilesList = $('profiles-list'); |
| 1406 var selectedProfile = profilesList.selectedItem; | 1408 var selectedProfile = profilesList.selectedItem; |
| 1407 var hasSelection = selectedProfile != null; | 1409 var hasSelection = selectedProfile != null; |
| 1408 var hasSingleProfile = profilesList.dataModel.length == 1; | 1410 var hasSingleProfile = profilesList.dataModel.length == 1; |
| 1409 var isSupervised = loadTimeData.getBoolean('profileIsSupervised'); | |
| 1410 $('profiles-manage').disabled = !hasSelection || | 1411 $('profiles-manage').disabled = !hasSelection || |
| 1411 !selectedProfile.isCurrentProfile; | 1412 !selectedProfile.isCurrentProfile; |
| 1412 if (hasSelection && !selectedProfile.isCurrentProfile) | 1413 if (hasSelection && !selectedProfile.isCurrentProfile) |
| 1413 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); | 1414 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); |
| 1414 else | 1415 else |
| 1415 $('profiles-manage').title = ''; | 1416 $('profiles-manage').title = ''; |
| 1416 $('profiles-delete').disabled = isSupervised || | 1417 $('profiles-delete').disabled = !profilesList.canDeleteItems || |
| 1417 (!hasSelection && !hasSingleProfile); | 1418 (!hasSelection && !hasSingleProfile); |
| 1418 if (OptionsPage.isSettingsApp()) { | 1419 if (OptionsPage.isSettingsApp()) { |
| 1419 $('profiles-app-list-switch').disabled = !hasSelection || | 1420 $('profiles-app-list-switch').disabled = !hasSelection || |
| 1420 selectedProfile.isCurrentProfile; | 1421 selectedProfile.isCurrentProfile; |
| 1421 } | 1422 } |
| 1422 var importData = $('import-data'); | 1423 var importData = $('import-data'); |
| 1423 if (importData) { | 1424 if (importData) { |
| 1424 importData.disabled = $('import-data').disabled = hasSelection && | 1425 importData.disabled = $('import-data').disabled = hasSelection && |
| 1425 !selectedProfile.isCurrentProfile; | 1426 !selectedProfile.isCurrentProfile; |
| 1426 } | 1427 } |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 } | 2203 } |
| 2203 button.textContent = loadTimeData.getString(strId); | 2204 button.textContent = loadTimeData.getString(strId); |
| 2204 }; | 2205 }; |
| 2205 } | 2206 } |
| 2206 | 2207 |
| 2207 // Export | 2208 // Export |
| 2208 return { | 2209 return { |
| 2209 BrowserOptions: BrowserOptions | 2210 BrowserOptions: BrowserOptions |
| 2210 }; | 2211 }; |
| 2211 }); | 2212 }); |
| OLD | NEW |