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

Side by Side Diff: chrome/browser/resources/extensions/extension_list.js

Issue 1051273002: Update chrome://extensions for supervised users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new icons Created 5 years, 7 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
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 <include src="extension_error.js"> 5 <include src="extension_error.js">
6 6
7 /////////////////////////////////////////////////////////////////////////////// 7 ///////////////////////////////////////////////////////////////////////////////
8 // ExtensionFocusRow: 8 // ExtensionFocusRow:
9 9
10 /** 10 /**
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 // becomes enabled/disabled. It also might not become enabled or 624 // becomes enabled/disabled. It also might not become enabled or
625 // disabled, because the user might e.g. get prompted when enabling 625 // disabled, because the user might e.g. get prompted when enabling
626 // and choose not to. 626 // and choose not to.
627 e.preventDefault(); 627 e.preventDefault();
628 }); 628 });
629 629
630 // 'Remove' button. 630 // 'Remove' button.
631 var trashTemplate = $('template-collection').querySelector('.trash'); 631 var trashTemplate = $('template-collection').querySelector('.trash');
632 var trash = trashTemplate.cloneNode(true); 632 var trash = trashTemplate.cloneNode(true);
633 trash.title = loadTimeData.getString('extensionUninstall'); 633 trash.title = loadTimeData.getString('extensionUninstall');
634 trash.hidden = !extension.userMayModify;
Marc Treib 2015/05/19 13:21:51 Handled by css, no need to do it again here.
635 trash.setAttribute('column-type', 'trash'); 634 trash.setAttribute('column-type', 'trash');
636 trash.addEventListener('click', function(e) { 635 trash.addEventListener('click', function(e) {
637 trash.classList.add('open'); 636 trash.classList.add('open');
638 trash.classList.toggle('mouse-clicked', e.detail > 0); 637 trash.classList.toggle('mouse-clicked', e.detail > 0);
639 if (this.uninstallIsShowing_) 638 if (this.uninstallIsShowing_)
640 return; 639 return;
641 this.uninstallIsShowing_ = true; 640 this.uninstallIsShowing_ = true;
642 chrome.management.uninstall(extension.id, 641 chrome.management.uninstall(extension.id,
643 {showConfirmDialog: true}, 642 {showConfirmDialog: true},
644 function() { 643 function() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 * @private 686 * @private
688 */ 687 */
689 updateNode_: function(extension, row) { 688 updateNode_: function(extension, row) {
690 var isActive = 689 var isActive =
691 extension.state == chrome.developerPrivate.ExtensionState.ENABLED; 690 extension.state == chrome.developerPrivate.ExtensionState.ENABLED;
692 row.classList.toggle('inactive-extension', !isActive); 691 row.classList.toggle('inactive-extension', !isActive);
693 692
694 // Hack to keep the closure compiler happy about |remove|. 693 // Hack to keep the closure compiler happy about |remove|.
695 // TODO(hcarmona): Remove this hack when the closure compiler is updated. 694 // TODO(hcarmona): Remove this hack when the closure compiler is updated.
696 var node = /** @type {Element} */ (row); 695 var node = /** @type {Element} */ (row);
697 node.classList.remove('policy-controlled', 'may-not-modify', 696 node.classList.remove('controlled', 'may-not-remove');
698 'may-not-remove');
699 var classes = []; 697 var classes = [];
700 if (!extension.userMayModify) { 698 if (extension.controlledBy) {
701 classes.push('policy-controlled', 'may-not-modify'); 699 classes.push('controlled');
702 } else if (extension.dependentExtensions.length > 0) { 700 } else if (!extension.userMayModify ||
703 classes.push('may-not-remove', 'may-not-modify'); 701 extension.mustRemainInstalled ||
704 } else if (extension.mustRemainInstalled) { 702 extension.dependentExtensions.length > 0) {
705 classes.push('may-not-remove'); 703 classes.push('may-not-remove');
706 } else if (extension.disableReasons.suspiciousInstall ||
707 extension.disableReasons.corruptInstall ||
708 extension.disableReasons.updateRequired) {
709 classes.push('may-not-modify');
Marc Treib 2015/05/19 13:21:51 The may-not-modify class doesn't actually do anyth
710 } 704 }
711 row.classList.add.apply(row.classList, classes); 705 row.classList.add.apply(row.classList, classes);
712 706
713 var item = row.querySelector('.extension-list-item'); 707 var item = row.querySelector('.extension-list-item');
714 item.style.backgroundImage = 'url(' + extension.iconUrl + ')'; 708 item.style.backgroundImage = 'url(' + extension.iconUrl + ')';
715 709
716 this.setText_(row, '.extension-title', extension.name); 710 this.setText_(row, '.extension-title', extension.name);
717 this.setText_(row, '.extension-version', extension.version); 711 this.setText_(row, '.extension-version', extension.version);
718 this.setText_(row, '.location-text', extension.locationText || ''); 712 this.setText_(row, '.location-text', extension.locationText || '');
719 this.setText_(row, '.blacklist-text', extension.blacklistText || ''); 713 this.setText_(row, '.blacklist-text', extension.blacklistText || '');
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 this.updateVisibility_(row, '.corrupted-repair-button', canRepair); 829 this.updateVisibility_(row, '.corrupted-repair-button', canRepair);
836 830
837 // The 'Enabled' checkbox. 831 // The 'Enabled' checkbox.
838 var isOK = !isTerminated && !canRepair; 832 var isOK = !isTerminated && !canRepair;
839 this.updateVisibility_(row, '.enable-checkbox', isOK, function(item) { 833 this.updateVisibility_(row, '.enable-checkbox', isOK, function(item) {
840 var enableCheckboxDisabled = 834 var enableCheckboxDisabled =
841 !extension.userMayModify || 835 !extension.userMayModify ||
842 extension.disableReasons.suspiciousInstall || 836 extension.disableReasons.suspiciousInstall ||
843 extension.disableReasons.corruptInstall || 837 extension.disableReasons.corruptInstall ||
844 extension.disableReasons.updateRequired || 838 extension.disableReasons.updateRequired ||
845 extension.installedByCustodian ||
846 extension.dependentExtensions.length > 0; 839 extension.dependentExtensions.length > 0;
847 item.querySelector('input').disabled = enableCheckboxDisabled; 840 item.querySelector('input').disabled = enableCheckboxDisabled;
848 item.querySelector('input').checked = isActive; 841 item.querySelector('input').checked = isActive;
849 }); 842 });
850 843
851 // Button for extensions controlled by policy. 844 // Indicator for extensions controlled by policy.
852 var controlNode = row.querySelector('.enable-controls'); 845 var controlNode = row.querySelector('.enable-controls');
853 var indicator = 846 var indicator =
854 controlNode.querySelector('.controlled-extension-indicator'); 847 controlNode.querySelector('.controlled-extension-indicator');
855 var needsIndicator = isOK && 848 var needsIndicator = isOK && extension.controlledBy;
856 !extension.userMayModify &&
857 extension.policyText;
858 // TODO(treib): If userMayModify is false, but policyText is empty, that
859 // indicates this extension is controlled by something else than
860 // enterprise policy (such as the profile being supervised). For now, just
861 // don't show the indicator in this case. We should really handle this
862 // better though (ie use a different text and icon).
863 849
864 if (needsIndicator && !indicator) { 850 if (needsIndicator && !indicator) {
865 indicator = new cr.ui.ControlledIndicator(); 851 indicator = new cr.ui.ControlledIndicator();
866 indicator.classList.add('controlled-extension-indicator'); 852 indicator.classList.add('controlled-extension-indicator');
867 indicator.setAttribute('controlled-by', 'policy'); 853 indicator.setAttribute('controlled-by', extension.controlledBy);
868 var textPolicy = extension.policyText || ''; 854 var text = extension.controlledByText || '';
869 indicator.setAttribute('textpolicy', textPolicy); 855 indicator.setAttribute('text' + extension.controlledBy, text);
870 indicator.image.setAttribute('aria-label', textPolicy); 856 indicator.image.setAttribute('aria-label', text);
871 controlNode.appendChild(indicator); 857 controlNode.appendChild(indicator);
872 indicator.querySelector('div').setAttribute('column-type', 858 indicator.querySelector('div').setAttribute('column-type',
873 'enterprise'); 859 'enterprise');
874 } else if (!needsIndicator && indicator) { 860 } else if (!needsIndicator && indicator) {
875 controlNode.removeChild(indicator); 861 controlNode.removeChild(indicator);
876 } 862 }
877 863
878 // Developer mode //////////////////////////////////////////////////////// 864 // Developer mode ////////////////////////////////////////////////////////
879 865
880 // First we have the id. 866 // First we have the id.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 this.createNode_(extension, nextExt ? $(nextExt.id) : null); 1148 this.createNode_(extension, nextExt ? $(nextExt.id) : null);
1163 } 1149 }
1164 } 1150 }
1165 }; 1151 };
1166 1152
1167 return { 1153 return {
1168 ExtensionList: ExtensionList, 1154 ExtensionList: ExtensionList,
1169 ExtensionListDelegate: ExtensionListDelegate 1155 ExtensionListDelegate: ExtensionListDelegate
1170 }; 1156 };
1171 }); 1157 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698