Chromium Code Reviews| 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 Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 var ArrayDataModel = cr.ui.ArrayDataModel; | 8 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 CreateProfileOverlay.cancelCreateProfile(); | 64 CreateProfileOverlay.cancelCreateProfile(); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 $('manage-profile-cancel').onclick = | 67 $('manage-profile-cancel').onclick = |
| 68 $('disconnect-managed-profile-cancel').onclick = | 68 $('disconnect-managed-profile-cancel').onclick = |
| 69 $('delete-profile-cancel').onclick = function(event) { | 69 $('delete-profile-cancel').onclick = function(event) { |
| 70 PageManager.closeOverlay(); | 70 PageManager.closeOverlay(); |
| 71 }; | 71 }; |
| 72 $('delete-profile-ok').onclick = function(event) { | 72 $('delete-profile-ok').onclick = function(event) { |
| 73 PageManager.closeOverlay(); | 73 PageManager.closeOverlay(); |
| 74 if (BrowserOptions.getCurrentProfile().isSupervised) | |
| 75 return; | |
| 76 chrome.send('deleteProfile', [self.profileInfo_.filePath]); | 74 chrome.send('deleteProfile', [self.profileInfo_.filePath]); |
| 77 options.SupervisedUserListData.resetPromise(); | 75 options.SupervisedUserListData.resetPromise(); |
| 78 }; | 76 }; |
| 79 $('add-shortcut-button').onclick = function(event) { | 77 $('add-shortcut-button').onclick = function(event) { |
| 80 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); | 78 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); |
| 81 }; | 79 }; |
| 82 $('remove-shortcut-button').onclick = function(event) { | 80 $('remove-shortcut-button').onclick = function(event) { |
| 83 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); | 81 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); |
| 84 }; | 82 }; |
| 85 | 83 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 // call |receiveHasProfileShortcuts|, which will show the appropriate one. | 139 // call |receiveHasProfileShortcuts|, which will show the appropriate one. |
| 142 $('remove-shortcut-button').hidden = true; | 140 $('remove-shortcut-button').hidden = true; |
| 143 $('add-shortcut-button').hidden = true; | 141 $('add-shortcut-button').hidden = true; |
| 144 | 142 |
| 145 if (loadTimeData.getBoolean('profileShortcutsEnabled')) { | 143 if (loadTimeData.getBoolean('profileShortcutsEnabled')) { |
| 146 var profileInfo = ManageProfileOverlay.getInstance().profileInfo_; | 144 var profileInfo = ManageProfileOverlay.getInstance().profileInfo_; |
| 147 chrome.send('requestHasProfileShortcuts', [profileInfo.filePath]); | 145 chrome.send('requestHasProfileShortcuts', [profileInfo.filePath]); |
| 148 } | 146 } |
| 149 | 147 |
| 150 var manageNameField = $('manage-profile-name'); | 148 var manageNameField = $('manage-profile-name'); |
| 151 // Supervised users cannot edit their names. | 149 // Legacy supervised users cannot edit their names. |
| 152 if (manageNameField.disabled) | 150 if (manageNameField.disabled) |
| 153 $('manage-profile-ok').focus(); | 151 $('manage-profile-ok').focus(); |
| 154 else | 152 else |
| 155 manageNameField.focus(); | 153 manageNameField.focus(); |
| 156 | 154 |
| 157 this.profileNameIsDefault_ = false; | 155 this.profileNameIsDefault_ = false; |
| 158 }, | 156 }, |
| 159 | 157 |
| 160 /** | 158 /** |
| 161 * Registers event handlers that are common between create and manage modes. | 159 * Registers event handlers that are common between create and manage modes. |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 * @private | 527 * @private |
| 530 */ | 528 */ |
| 531 prepareForManageDialog_: function() { | 529 prepareForManageDialog_: function() { |
| 532 chrome.send('refreshGaiaPicture'); | 530 chrome.send('refreshGaiaPicture'); |
| 533 var profileInfo = BrowserOptions.getCurrentProfile(); | 531 var profileInfo = BrowserOptions.getCurrentProfile(); |
| 534 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); | 532 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); |
| 535 $('manage-profile-overlay-create').hidden = true; | 533 $('manage-profile-overlay-create').hidden = true; |
| 536 $('manage-profile-overlay-manage').hidden = false; | 534 $('manage-profile-overlay-manage').hidden = false; |
| 537 $('manage-profile-overlay-delete').hidden = true; | 535 $('manage-profile-overlay-delete').hidden = true; |
| 538 $('manage-profile-overlay-disconnect-managed').hidden = true; | 536 $('manage-profile-overlay-disconnect-managed').hidden = true; |
| 539 $('manage-profile-name').disabled = profileInfo.isSupervised; | 537 $('manage-profile-name').disabled = |
| 538 profileInfo.isSupervised && !profileInfo.isChild; | |
|
Dan Beam
2015/02/09 22:20:33
this broke the closure compile:
http://build.chrom
| |
| 540 this.hideErrorBubble_('manage'); | 539 this.hideErrorBubble_('manage'); |
| 541 }, | 540 }, |
| 542 | 541 |
| 543 /** | 542 /** |
| 544 * Display the "Manage Profile" dialog. | 543 * Display the "Manage Profile" dialog. |
| 545 * @param {boolean=} opt_updateHistory If we should update the history after | 544 * @param {boolean=} opt_updateHistory If we should update the history after |
| 546 * showing the dialog (defaults to true). | 545 * showing the dialog (defaults to true). |
| 547 * @private | 546 * @private |
| 548 */ | 547 */ |
| 549 showManageDialog_: function(opt_updateHistory) { | 548 showManageDialog_: function(opt_updateHistory) { |
| 550 var updateHistory = opt_updateHistory !== false; | 549 var updateHistory = opt_updateHistory !== false; |
| 551 this.prepareForManageDialog_(); | 550 this.prepareForManageDialog_(); |
| 552 PageManager.showPageByName('manageProfile', updateHistory); | 551 PageManager.showPageByName('manageProfile', updateHistory); |
| 553 }, | 552 }, |
| 554 | 553 |
| 555 /** | 554 /** |
| 556 * Display the "Delete Profile" dialog. | 555 * Display the "Delete Profile" dialog. |
| 557 * @param {Object} profileInfo The profile object of the profile to delete. | 556 * @param {Object} profileInfo The profile object of the profile to delete. |
| 558 * @private | 557 * @private |
| 559 */ | 558 */ |
| 560 showDeleteDialog_: function(profileInfo) { | 559 showDeleteDialog_: function(profileInfo) { |
| 561 if (BrowserOptions.getCurrentProfile().isSupervised) | |
| 562 return; | |
| 563 | |
| 564 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); | 560 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); |
| 565 $('manage-profile-overlay-create').hidden = true; | 561 $('manage-profile-overlay-create').hidden = true; |
| 566 $('manage-profile-overlay-manage').hidden = true; | 562 $('manage-profile-overlay-manage').hidden = true; |
| 567 $('manage-profile-overlay-delete').hidden = false; | 563 $('manage-profile-overlay-delete').hidden = false; |
| 568 $('manage-profile-overlay-disconnect-managed').hidden = true; | 564 $('manage-profile-overlay-disconnect-managed').hidden = true; |
| 569 $('delete-profile-icon').style.content = | 565 $('delete-profile-icon').style.content = |
| 570 getProfileAvatarIcon(profileInfo.iconURL); | 566 getProfileAvatarIcon(profileInfo.iconURL); |
| 571 $('delete-profile-text').textContent = | 567 $('delete-profile-text').textContent = |
| 572 loadTimeData.getStringF('deleteProfileMessage', | 568 loadTimeData.getStringF('deleteProfileMessage', |
| 573 elide(profileInfo.name, /* maxLength */ 50)); | 569 elide(profileInfo.name, /* maxLength */ 50)); |
| 574 $('delete-supervised-profile-addendum').hidden = | 570 $('delete-supervised-profile-addendum').hidden = |
| 575 !profileInfo.isSupervised; | 571 !profileInfo.isSupervised || profileInfo.isChild; |
| 576 | 572 |
| 577 // Because this dialog isn't useful when refreshing or as part of the | 573 // Because this dialog isn't useful when refreshing or as part of the |
| 578 // history, don't create a history entry for it when showing. | 574 // history, don't create a history entry for it when showing. |
| 579 PageManager.showPageByName('manageProfile', false); | 575 PageManager.showPageByName('manageProfile', false); |
| 580 }, | 576 }, |
| 581 | 577 |
| 582 /** | 578 /** |
| 583 * Display the "Disconnect Managed Profile" dialog. | 579 * Display the "Disconnect Managed Profile" dialog. |
| 584 * @private | 580 * @private |
| 585 */ | 581 */ |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 'updateSignedInStatus', | 874 'updateSignedInStatus', |
| 879 'updateSupervisedUsersAllowed', | 875 'updateSupervisedUsersAllowed', |
| 880 ]); | 876 ]); |
| 881 | 877 |
| 882 // Export | 878 // Export |
| 883 return { | 879 return { |
| 884 ManageProfileOverlay: ManageProfileOverlay, | 880 ManageProfileOverlay: ManageProfileOverlay, |
| 885 CreateProfileOverlay: CreateProfileOverlay, | 881 CreateProfileOverlay: CreateProfileOverlay, |
| 886 }; | 882 }; |
| 887 }); | 883 }); |
| OLD | NEW |