| Index: chrome/browser/resources/extensions/extension_list.js
|
| diff --git a/chrome/browser/resources/extensions/extension_list.js b/chrome/browser/resources/extensions/extension_list.js
|
| index 5582d587065f5b0213acbdab79d5b9088a3d15e1..51cf2b3fa5a84b66b067075550723b228f8c8bc8 100644
|
| --- a/chrome/browser/resources/extensions/extension_list.js
|
| +++ b/chrome/browser/resources/extensions/extension_list.js
|
| @@ -84,8 +84,8 @@ cr.define('extensions', function() {
|
| return 0;
|
| }
|
| return compareLocation(a, b) ||
|
| - compare(a.name.toLowerCase(), b.name.toLowerCase()) ||
|
| - compare(a.id, b.id);
|
| + compare(a.name.toLowerCase(), b.name.toLowerCase()) ||
|
| + compare(a.id, b.id);
|
| }
|
|
|
| /** @interface */
|
| @@ -171,8 +171,8 @@ cr.define('extensions', function() {
|
|
|
| this.resetLoadFinished();
|
|
|
| - chrome.developerPrivate.onItemStateChanged.addListener(
|
| - function(eventData) {
|
| + chrome.developerPrivate.onItemStateChanged.addListener(function(
|
| + eventData) {
|
| var EventType = chrome.developerPrivate.EventType;
|
| switch (eventData.event_type) {
|
| case EventType.VIEW_REGISTERED:
|
| @@ -253,26 +253,26 @@ cr.define('extensions', function() {
|
| chrome.developerPrivate.getExtensionsInfo(
|
| {includeDisabled: true, includeTerminated: true},
|
| function(extensions) {
|
| - // Sort in order of unpacked vs. packed, followed by name, followed by
|
| - // id.
|
| - extensions.sort(compareExtensions);
|
| - this.extensions_ = extensions;
|
| - this.showExtensionNodes_();
|
| -
|
| - // We keep the commands overlay's extension info in sync, so that we
|
| - // don't duplicate the same querying logic there.
|
| - ExtensionCommandsOverlay.updateExtensionsData(this.extensions_);
|
| -
|
| - resolve();
|
| -
|
| - // |resolve| is async so it's necessary to use |then| here in order to
|
| - // do work after other |then|s have finished. This is important so
|
| - // elements are visible when these updates happen.
|
| - this.extensionsUpdated_.then(function() {
|
| - this.onUpdateFinished_();
|
| - this.resolveLoadFinished_();
|
| - }.bind(this));
|
| - }.bind(this));
|
| + // Sort in order of unpacked vs. packed, followed by name,
|
| + // followed by id.
|
| + extensions.sort(compareExtensions);
|
| + this.extensions_ = extensions;
|
| + this.showExtensionNodes_();
|
| +
|
| + // We keep the commands overlay's extension info in sync, so that
|
| + // we don't duplicate the same querying logic there.
|
| + ExtensionCommandsOverlay.updateExtensionsData(this.extensions_);
|
| +
|
| + resolve();
|
| +
|
| + // |resolve| is async so it's necessary to use |then| here in
|
| + // order to do work after other |then|s have finished. This is
|
| + // important so elements are visible when these updates happen.
|
| + this.extensionsUpdated_.then(function() {
|
| + this.onUpdateFinished_();
|
| + this.resolveLoadFinished_();
|
| + }.bind(this));
|
| + }.bind(this));
|
| }.bind(this));
|
| return this.extensionsUpdated_;
|
| },
|
| @@ -301,7 +301,8 @@ cr.define('extensions', function() {
|
| (focusRow.getFirstFocusable('enabled') ||
|
| focusRow.getFirstFocusable('remove-enterprise') ||
|
| focusRow.getFirstFocusable('website') ||
|
| - focusRow.getFirstFocusable('details')).focus();
|
| + focusRow.getFirstFocusable('details'))
|
| + .focus();
|
| }
|
| }
|
|
|
| @@ -352,8 +353,8 @@ cr.define('extensions', function() {
|
| this.focusGrid_.ensureRowActive();
|
|
|
| // Remove extensions that are no longer installed.
|
| - var wrappers = document.querySelectorAll(
|
| - '.extension-list-item-wrapper[id]');
|
| + var wrappers =
|
| + document.querySelectorAll('.extension-list-item-wrapper[id]');
|
| Array.prototype.forEach.call(wrappers, function(wrapper) {
|
| if (seenIds.indexOf(wrapper.id) < 0)
|
| this.removeWrapper_(wrapper);
|
| @@ -370,8 +371,8 @@ cr.define('extensions', function() {
|
| // If focus is in the wrapper about to be removed, move it first. This
|
| // happens when clicking the trash can to remove an extension.
|
| if (wrapper.contains(document.activeElement)) {
|
| - var wrappers = document.querySelectorAll(
|
| - '.extension-list-item-wrapper[id]');
|
| + var wrappers =
|
| + document.querySelectorAll('.extension-list-item-wrapper[id]');
|
| var index = Array.prototype.indexOf.call(wrappers, wrapper);
|
| assert(index != -1);
|
| var focusableWrapper = wrappers[index + 1] || wrappers[index - 1];
|
| @@ -422,10 +423,10 @@ cr.define('extensions', function() {
|
| // The 'Permissions' link.
|
| wrapper.setupColumn('details', '.permissions-link', 'click', function(e) {
|
| if (!this.permissionsPromptIsShowing_) {
|
| - chrome.developerPrivate.showPermissionsDialog(extension.id,
|
| - function() {
|
| - this.permissionsPromptIsShowing_ = false;
|
| - }.bind(this));
|
| + chrome.developerPrivate.showPermissionsDialog(
|
| + extension.id, function() {
|
| + this.permissionsPromptIsShowing_ = false;
|
| + }.bind(this));
|
| this.permissionsPromptIsShowing_ = true;
|
| }
|
| e.preventDefault();
|
| @@ -471,87 +472,81 @@ cr.define('extensions', function() {
|
| errors, extensionId, newEx.name);
|
| }.bind(this));
|
|
|
| - wrapper.setupColumn('suspiciousLearnMore',
|
| - '.suspicious-install-message .learn-more-link');
|
| + wrapper.setupColumn(
|
| + 'suspiciousLearnMore',
|
| + '.suspicious-install-message .learn-more-link');
|
|
|
| // The path, if provided by unpacked extension.
|
| - wrapper.setupColumn('loadPath', '.load-path a:first-of-type', 'click',
|
| - function(e) {
|
| - chrome.developerPrivate.showPath(extension.id);
|
| - e.preventDefault();
|
| - });
|
| + wrapper.setupColumn(
|
| + 'loadPath', '.load-path a:first-of-type', 'click', function(e) {
|
| + chrome.developerPrivate.showPath(extension.id);
|
| + e.preventDefault();
|
| + });
|
|
|
| // The 'allow in incognito' checkbox.
|
| - wrapper.setupColumn('incognito', '.incognito-control input', 'change',
|
| - function(e) {
|
| - var butterBar = wrapper.querySelector('.butter-bar');
|
| - var checked = e.target.checked;
|
| - butterBar.hidden = !checked ||
|
| - extension.type == ExtensionType.HOSTED_APP;
|
| - chrome.developerPrivate.updateExtensionConfiguration({
|
| - extensionId: extension.id,
|
| - incognitoAccess: e.target.checked
|
| - });
|
| - }.bind(this));
|
| + wrapper.setupColumn(
|
| + 'incognito', '.incognito-control input', 'change', function(e) {
|
| + var butterBar = wrapper.querySelector('.butter-bar');
|
| + var checked = e.target.checked;
|
| + butterBar.hidden =
|
| + !checked || extension.type == ExtensionType.HOSTED_APP;
|
| + chrome.developerPrivate.updateExtensionConfiguration(
|
| + {extensionId: extension.id, incognitoAccess: e.target.checked});
|
| + }.bind(this));
|
|
|
| // The 'collect errors' checkbox. This should only be visible if the
|
| // error console is enabled - we can detect this by the existence of the
|
| // |errorCollectionEnabled| property.
|
| - wrapper.setupColumn('collectErrors', '.error-collection-control input',
|
| - 'change', function(e) {
|
| - chrome.developerPrivate.updateExtensionConfiguration({
|
| - extensionId: extension.id,
|
| - errorCollection: e.target.checked
|
| - });
|
| - });
|
| + wrapper.setupColumn(
|
| + 'collectErrors', '.error-collection-control input', 'change',
|
| + function(e) {
|
| + chrome.developerPrivate.updateExtensionConfiguration(
|
| + {extensionId: extension.id, errorCollection: e.target.checked});
|
| + });
|
|
|
| // The 'allow on all urls' checkbox. This should only be visible if
|
| // active script restrictions are enabled. If they are not enabled, no
|
| // extensions should want all urls.
|
| - wrapper.setupColumn('allUrls', '.all-urls-control input', 'click',
|
| - function(e) {
|
| - chrome.developerPrivate.updateExtensionConfiguration({
|
| - extensionId: extension.id,
|
| - runOnAllUrls: e.target.checked
|
| - });
|
| - });
|
| + wrapper.setupColumn(
|
| + 'allUrls', '.all-urls-control input', 'click', function(e) {
|
| + chrome.developerPrivate.updateExtensionConfiguration(
|
| + {extensionId: extension.id, runOnAllUrls: e.target.checked});
|
| + });
|
|
|
| // The 'allow file:// access' checkbox.
|
| - wrapper.setupColumn('localUrls', '.file-access-control input', 'click',
|
| - function(e) {
|
| - chrome.developerPrivate.updateExtensionConfiguration({
|
| - extensionId: extension.id,
|
| - fileAccess: e.target.checked
|
| - });
|
| - });
|
| + wrapper.setupColumn(
|
| + 'localUrls', '.file-access-control input', 'click', function(e) {
|
| + chrome.developerPrivate.updateExtensionConfiguration(
|
| + {extensionId: extension.id, fileAccess: e.target.checked});
|
| + });
|
|
|
| // The 'Reload' terminated link.
|
| - wrapper.setupColumn('terminatedReload', '.terminated-reload-link',
|
| - 'click', function(e) {
|
| - chrome.developerPrivate.reload(extension.id, {failQuietly: true});
|
| - });
|
| + wrapper.setupColumn(
|
| + 'terminatedReload', '.terminated-reload-link', 'click', function(e) {
|
| + chrome.developerPrivate.reload(extension.id, {failQuietly: true});
|
| + });
|
|
|
| // The 'Repair' corrupted link.
|
| - wrapper.setupColumn('repair', '.corrupted-repair-button', 'click',
|
| - function(e) {
|
| - chrome.developerPrivate.repairExtension(extension.id);
|
| - });
|
| + wrapper.setupColumn(
|
| + 'repair', '.corrupted-repair-button', 'click', function(e) {
|
| + chrome.developerPrivate.repairExtension(extension.id);
|
| + });
|
|
|
| // The 'Enabled' checkbox.
|
| - wrapper.setupColumn('enabled', '.enable-checkbox input', 'click',
|
| - function(e) {
|
| - var checked = e.target.checked;
|
| - // TODO(devlin): What should we do if this fails? Ideally we want to
|
| - // show some kind of error or feedback to the user if this fails.
|
| - chrome.management.setEnabled(extension.id, checked);
|
| -
|
| - // This may seem counter-intuitive (to not set/clear the checkmark)
|
| - // but this page will be updated asynchronously if the extension
|
| - // becomes enabled/disabled. It also might not become enabled or
|
| - // disabled, because the user might e.g. get prompted when enabling
|
| - // and choose not to.
|
| - e.preventDefault();
|
| - });
|
| + wrapper.setupColumn(
|
| + 'enabled', '.enable-checkbox input', 'click', function(e) {
|
| + var checked = e.target.checked;
|
| + // TODO(devlin): What should we do if this fails? Ideally we want to
|
| + // show some kind of error or feedback to the user if this fails.
|
| + chrome.management.setEnabled(extension.id, checked);
|
| +
|
| + // This may seem counter-intuitive (to not set/clear the checkmark)
|
| + // but this page will be updated asynchronously if the extension
|
| + // becomes enabled/disabled. It also might not become enabled or
|
| + // disabled, because the user might e.g. get prompted when enabling
|
| + // and choose not to.
|
| + e.preventDefault();
|
| + });
|
|
|
| // 'Remove' button.
|
| var trash = cloneTemplate('trash');
|
| @@ -565,23 +560,24 @@ cr.define('extensions', function() {
|
| if (this.uninstallIsShowing_)
|
| return;
|
| this.uninstallIsShowing_ = true;
|
| - chrome.management.uninstall(extension.id,
|
| - {showConfirmDialog: true},
|
| - function() {
|
| - // TODO(devlin): What should we do if the uninstall fails?
|
| - this.uninstallIsShowing_ = false;
|
| -
|
| - if (trash.classList.contains('mouse-clicked'))
|
| - trash.blur();
|
| -
|
| - if (chrome.runtime.lastError) {
|
| - // The uninstall failed (e.g. a cancel). Allow the trash to close.
|
| - trash.classList.remove('open');
|
| - } else {
|
| - // Leave the trash open if the uninstall succeded. Otherwise it can
|
| - // half-close right before it's removed when the DOM is modified.
|
| - }
|
| - }.bind(this));
|
| + chrome.management.uninstall(
|
| + extension.id, {showConfirmDialog: true}, function() {
|
| + // TODO(devlin): What should we do if the uninstall fails?
|
| + this.uninstallIsShowing_ = false;
|
| +
|
| + if (trash.classList.contains('mouse-clicked'))
|
| + trash.blur();
|
| +
|
| + if (chrome.runtime.lastError) {
|
| + // The uninstall failed (e.g. a cancel). Allow the trash to
|
| + // close.
|
| + trash.classList.remove('open');
|
| + } else {
|
| + // Leave the trash open if the uninstall succeded. Otherwise it
|
| + // can half-close right before it's removed when the DOM is
|
| + // modified.
|
| + }
|
| + }.bind(this));
|
| }.bind(this));
|
|
|
| // Maintain the order that nodes should be in when creating as well as
|
| @@ -608,9 +604,9 @@ cr.define('extensions', function() {
|
|
|
| if (extension.controlledInfo) {
|
| wrapper.classList.add('controlled');
|
| - } else if (!extension.userMayModify ||
|
| - extension.mustRemainInstalled ||
|
| - extension.dependentExtensions.length > 0) {
|
| + } else if (
|
| + !extension.userMayModify || extension.mustRemainInstalled ||
|
| + extension.dependentExtensions.length > 0) {
|
| wrapper.classList.add('may-not-remove');
|
| }
|
|
|
| @@ -624,16 +620,15 @@ cr.define('extensions', function() {
|
| this.setText_(wrapper, '.extension-description', extension.description);
|
|
|
| // The 'allow in incognito' checkbox.
|
| - this.updateVisibility_(wrapper, '.incognito-control',
|
| - isActive && this.incognitoAvailable_,
|
| - function(item) {
|
| - var incognito = item.querySelector('input');
|
| - incognito.disabled = !extension.incognitoAccess.isEnabled;
|
| - incognito.checked = extension.incognitoAccess.isActive;
|
| - });
|
| - var showButterBar = isActive &&
|
| - extension.incognitoAccess.isActive &&
|
| - extension.type != ExtensionType.HOSTED_APP;
|
| + this.updateVisibility_(
|
| + wrapper, '.incognito-control', isActive && this.incognitoAvailable_,
|
| + function(item) {
|
| + var incognito = item.querySelector('input');
|
| + incognito.disabled = !extension.incognitoAccess.isEnabled;
|
| + incognito.checked = extension.incognitoAccess.isActive;
|
| + });
|
| + var showButterBar = isActive && extension.incognitoAccess.isActive &&
|
| + extension.type != ExtensionType.HOSTED_APP;
|
| // The 'allow in incognito' butter bar.
|
| this.updateVisibility_(wrapper, '.butter-bar', showButterBar);
|
|
|
| @@ -642,46 +637,48 @@ cr.define('extensions', function() {
|
| // |errorCollectionEnabled| property.
|
| this.updateVisibility_(
|
| wrapper, '.error-collection-control',
|
| - isActive && extension.errorCollection.isEnabled,
|
| - function(item) {
|
| - item.querySelector('input').checked =
|
| - extension.errorCollection.isActive;
|
| - });
|
| + isActive && extension.errorCollection.isEnabled, function(item) {
|
| + item.querySelector('input').checked =
|
| + extension.errorCollection.isActive;
|
| + });
|
|
|
| // The 'allow on all urls' checkbox. This should only be visible if
|
| // active script restrictions are enabled. If they are not enabled, no
|
| // extensions should want all urls.
|
| this.updateVisibility_(
|
| wrapper, '.all-urls-control',
|
| - isActive && extension.runOnAllUrls.isEnabled,
|
| - function(item) {
|
| - item.querySelector('input').checked = extension.runOnAllUrls.isActive;
|
| - });
|
| + isActive && extension.runOnAllUrls.isEnabled, function(item) {
|
| + item.querySelector('input').checked =
|
| + extension.runOnAllUrls.isActive;
|
| + });
|
|
|
| // The 'allow file:// access' checkbox.
|
| - this.updateVisibility_(wrapper, '.file-access-control',
|
| - isActive && extension.fileAccess.isEnabled,
|
| - function(item) {
|
| - item.querySelector('input').checked = extension.fileAccess.isActive;
|
| - });
|
| + this.updateVisibility_(
|
| + wrapper, '.file-access-control',
|
| + isActive && extension.fileAccess.isEnabled, function(item) {
|
| + item.querySelector('input').checked = extension.fileAccess.isActive;
|
| + });
|
|
|
| // The 'Options' button or link, depending on its behaviour.
|
| var optionsEnabled = isActive && !!extension.optionsPage;
|
| - this.updateVisibility_(wrapper, '.options-link', optionsEnabled &&
|
| - extension.optionsPage.openInTab);
|
| - this.updateVisibility_(wrapper, '.options-button', optionsEnabled &&
|
| - !extension.optionsPage.openInTab);
|
| + this.updateVisibility_(
|
| + wrapper, '.options-link',
|
| + optionsEnabled && extension.optionsPage.openInTab);
|
| + this.updateVisibility_(
|
| + wrapper, '.options-button',
|
| + optionsEnabled && !extension.optionsPage.openInTab);
|
|
|
| // The 'View in Web Store/View Web Site' link.
|
| - var siteLinkEnabled = !!extension.homePage.url &&
|
| - !this.enableAppInfoDialog_;
|
| - this.updateVisibility_(wrapper, '.site-link', siteLinkEnabled,
|
| - function(item) {
|
| - item.href = extension.homePage.url;
|
| - item.textContent = loadTimeData.getString(
|
| - extension.homePage.specified ? 'extensionSettingsVisitWebsite' :
|
| - 'extensionSettingsVisitWebStore');
|
| - });
|
| + var siteLinkEnabled =
|
| + !!extension.homePage.url && !this.enableAppInfoDialog_;
|
| + this.updateVisibility_(
|
| + wrapper, '.site-link', siteLinkEnabled, function(item) {
|
| + item.href = extension.homePage.url;
|
| + item.textContent = loadTimeData.getString(
|
| + extension.homePage.specified ?
|
| + 'extensionSettingsVisitWebsite' :
|
| + 'extensionSettingsVisitWebStore');
|
| + });
|
|
|
| var isUnpacked =
|
| extension.location == chrome.developerPrivate.Location.UNPACKED;
|
| @@ -697,31 +694,33 @@ cr.define('extensions', function() {
|
| // The 'Errors' link.
|
| var hasErrors = extension.runtimeErrors.length > 0 ||
|
| extension.manifestErrors.length > 0;
|
| - this.updateVisibility_(wrapper, '.errors-link', hasErrors,
|
| - function(item) {
|
| - var Level = chrome.developerPrivate.ErrorLevel;
|
| -
|
| - var map = {};
|
| - map[Level.LOG] = {weight: 0, name: 'extension-error-info-icon'};
|
| - map[Level.WARN] = {weight: 1, name: 'extension-error-warning-icon'};
|
| - map[Level.ERROR] = {weight: 2, name: 'extension-error-fatal-icon'};
|
| -
|
| - // Find the highest severity of all the errors; manifest errors all have
|
| - // a 'warning' level severity.
|
| - var highestSeverity = extension.runtimeErrors.reduce(
|
| - function(prev, error) {
|
| - return map[error.severity].weight > map[prev].weight ?
|
| - error.severity : prev;
|
| - }, extension.manifestErrors.length ? Level.WARN : Level.LOG);
|
| -
|
| - // Adjust the class on the icon.
|
| - var icon = item.querySelector('.extension-error-icon');
|
| - // TODO(hcarmona): Populate alt text with a proper description since
|
| - // this icon conveys the severity of the error. (info, warning, fatal).
|
| - icon.alt = '';
|
| - icon.className = 'extension-error-icon'; // Remove other classes.
|
| - icon.classList.add(map[highestSeverity].name);
|
| - });
|
| + this.updateVisibility_(
|
| + wrapper, '.errors-link', hasErrors, function(item) {
|
| + var Level = chrome.developerPrivate.ErrorLevel;
|
| +
|
| + var map = {};
|
| + map[Level.LOG] = {weight: 0, name: 'extension-error-info-icon'};
|
| + map[Level.WARN] = {weight: 1, name: 'extension-error-warning-icon'};
|
| + map[Level.ERROR] = {weight: 2, name: 'extension-error-fatal-icon'};
|
| +
|
| + // Find the highest severity of all the errors; manifest errors all
|
| + // have a 'warning' level severity.
|
| + var highestSeverity =
|
| + extension.runtimeErrors.reduce(function(prev, error) {
|
| + return map[error.severity].weight > map[prev].weight ?
|
| + error.severity :
|
| + prev;
|
| + }, extension.manifestErrors.length ? Level.WARN : Level.LOG);
|
| +
|
| + // Adjust the class on the icon.
|
| + var icon = item.querySelector('.extension-error-icon');
|
| + // TODO(hcarmona): Populate alt text with a proper description since
|
| + // this icon conveys the severity of the error. (info, warning,
|
| + // fatal).
|
| + icon.alt = '';
|
| + icon.className = 'extension-error-icon'; // Remove other classes.
|
| + icon.classList.add(map[highestSeverity].name);
|
| + });
|
|
|
| // The 'Reload' terminated link.
|
| var isTerminated =
|
| @@ -730,16 +729,14 @@ cr.define('extensions', function() {
|
|
|
| // The 'Repair' corrupted link.
|
| var canRepair = !isTerminated &&
|
| - extension.disableReasons.corruptInstall &&
|
| - extension.location ==
|
| - chrome.developerPrivate.Location.FROM_STORE;
|
| + extension.disableReasons.corruptInstall &&
|
| + extension.location == chrome.developerPrivate.Location.FROM_STORE;
|
| this.updateVisibility_(wrapper, '.corrupted-repair-button', canRepair);
|
|
|
| // The 'Enabled' checkbox.
|
| var isOK = !isTerminated && !canRepair;
|
| this.updateVisibility_(wrapper, '.enable-checkbox', isOK, function(item) {
|
| - var enableCheckboxDisabled =
|
| - !extension.userMayModify ||
|
| + var enableCheckboxDisabled = !extension.userMayModify ||
|
| extension.disableReasons.suspiciousInstall ||
|
| extension.disableReasons.corruptInstall ||
|
| extension.disableReasons.updateRequired ||
|
| @@ -789,8 +786,7 @@ cr.define('extensions', function() {
|
| idLabel.textContent = ' ' + extension.id;
|
|
|
| // Then the path, if provided by unpacked extension.
|
| - this.updateVisibility_(wrapper, '.load-path', isUnpacked,
|
| - function(item) {
|
| + this.updateVisibility_(wrapper, '.load-path', isUnpacked, function(item) {
|
| item.querySelector('a:first-of-type').textContent =
|
| ' ' + extension.prettifiedPath;
|
| });
|
| @@ -800,122 +796,130 @@ cr.define('extensions', function() {
|
| // extension is disabled.
|
| var isRequired =
|
| !extension.userMayModify || extension.mustRemainInstalled;
|
| - this.updateVisibility_(wrapper, '.managed-message', isRequired &&
|
| - !extension.disableReasons.updateRequired);
|
| + this.updateVisibility_(
|
| + wrapper, '.managed-message',
|
| + isRequired && !extension.disableReasons.updateRequired);
|
|
|
| // Then the 'This isn't from the webstore, looks suspicious' message.
|
| var isSuspicious = extension.disableReasons.suspiciousInstall;
|
| - this.updateVisibility_(wrapper, '.suspicious-install-message',
|
| - !isRequired && isSuspicious);
|
| + this.updateVisibility_(
|
| + wrapper, '.suspicious-install-message', !isRequired && isSuspicious);
|
|
|
| // Then the 'This is a corrupt extension' message.
|
| - this.updateVisibility_(wrapper, '.corrupt-install-message', !isRequired &&
|
| - extension.disableReasons.corruptInstall);
|
| + this.updateVisibility_(
|
| + wrapper, '.corrupt-install-message',
|
| + !isRequired && extension.disableReasons.corruptInstall);
|
|
|
| // Then the 'An update required by enterprise policy' message. Note that
|
| // a force-installed extension might be disabled due to being outdated
|
| // as well.
|
| - this.updateVisibility_(wrapper, '.update-required-message',
|
| - extension.disableReasons.updateRequired);
|
| + this.updateVisibility_(
|
| + wrapper, '.update-required-message',
|
| + extension.disableReasons.updateRequired);
|
|
|
| // The 'following extensions depend on this extension' list.
|
| var hasDependents = extension.dependentExtensions.length > 0;
|
| wrapper.classList.toggle('developer-extras', hasDependents);
|
| - this.updateVisibility_(wrapper, '.dependent-extensions-message',
|
| - hasDependents, function(item) {
|
| - var dependentList = item.querySelector('ul');
|
| - dependentList.textContent = '';
|
| - extension.dependentExtensions.forEach(function(dependentExtension) {
|
| - var depNode = cloneTemplate('dependent-list-item');
|
| - depNode.querySelector('.dep-extension-title').textContent =
|
| - dependentExtension.name;
|
| - depNode.querySelector('.dep-extension-id').textContent =
|
| - dependentExtension.id;
|
| - dependentList.appendChild(depNode);
|
| - }, this);
|
| - }.bind(this));
|
| + this.updateVisibility_(
|
| + wrapper, '.dependent-extensions-message', hasDependents,
|
| + function(item) {
|
| + var dependentList = item.querySelector('ul');
|
| + dependentList.textContent = '';
|
| + extension.dependentExtensions.forEach(function(dependentExtension) {
|
| + var depNode = cloneTemplate('dependent-list-item');
|
| + depNode.querySelector('.dep-extension-title').textContent =
|
| + dependentExtension.name;
|
| + depNode.querySelector('.dep-extension-id').textContent =
|
| + dependentExtension.id;
|
| + dependentList.appendChild(depNode);
|
| + }, this);
|
| + }.bind(this));
|
|
|
| // The active views.
|
| - this.updateVisibility_(wrapper, '.active-views',
|
| - extension.views.length > 0, function(item) {
|
| - var link = item.querySelector('a');
|
| -
|
| - // Link needs to be an only child before the list is updated.
|
| - while (link.nextElementSibling)
|
| - item.removeChild(link.nextElementSibling);
|
| -
|
| - // Link needs to be cleaned up if it was used before.
|
| - link.textContent = '';
|
| - if (link.clickHandler)
|
| - link.removeEventListener('click', link.clickHandler);
|
| -
|
| - extension.views.forEach(function(view, i) {
|
| - if (view.type == chrome.developerPrivate.ViewType.EXTENSION_DIALOG ||
|
| - view.type == chrome.developerPrivate.ViewType.EXTENSION_POPUP) {
|
| - return;
|
| - }
|
| - var displayName;
|
| - if (view.url.startsWith('chrome-extension://')) {
|
| - var pathOffset = 'chrome-extension://'.length + 32 + 1;
|
| - displayName = view.url.substring(pathOffset);
|
| - if (displayName == '_generated_background_page.html')
|
| - displayName = loadTimeData.getString('backgroundPage');
|
| - } else {
|
| - displayName = view.url;
|
| - }
|
| - var label = displayName +
|
| - (view.incognito ?
|
| - ' ' + loadTimeData.getString('viewIncognito') : '') +
|
| - (view.renderProcessId == -1 ?
|
| - ' ' + loadTimeData.getString('viewInactive') : '') +
|
| - (view.isIframe ?
|
| - ' ' + loadTimeData.getString('viewIframe') : '');
|
| - link.textContent = label;
|
| - link.clickHandler = function(e) {
|
| - chrome.developerPrivate.openDevTools({
|
| - extensionId: extension.id,
|
| - renderProcessId: view.renderProcessId,
|
| - renderViewId: view.renderViewId,
|
| - incognito: view.incognito
|
| + this.updateVisibility_(
|
| + wrapper, '.active-views', extension.views.length > 0, function(item) {
|
| + var link = item.querySelector('a');
|
| +
|
| + // Link needs to be an only child before the list is updated.
|
| + while (link.nextElementSibling)
|
| + item.removeChild(link.nextElementSibling);
|
| +
|
| + // Link needs to be cleaned up if it was used before.
|
| + link.textContent = '';
|
| + if (link.clickHandler)
|
| + link.removeEventListener('click', link.clickHandler);
|
| +
|
| + extension.views.forEach(function(view, i) {
|
| + if (view.type ==
|
| + chrome.developerPrivate.ViewType.EXTENSION_DIALOG ||
|
| + view.type ==
|
| + chrome.developerPrivate.ViewType.EXTENSION_POPUP) {
|
| + return;
|
| + }
|
| + var displayName;
|
| + if (view.url.startsWith('chrome-extension://')) {
|
| + var pathOffset = 'chrome-extension://'.length + 32 + 1;
|
| + displayName = view.url.substring(pathOffset);
|
| + if (displayName == '_generated_background_page.html')
|
| + displayName = loadTimeData.getString('backgroundPage');
|
| + } else {
|
| + displayName = view.url;
|
| + }
|
| + var label = displayName +
|
| + (view.incognito ?
|
| + ' ' + loadTimeData.getString('viewIncognito') :
|
| + '') +
|
| + (view.renderProcessId == -1 ?
|
| + ' ' + loadTimeData.getString('viewInactive') :
|
| + '') +
|
| + (view.isIframe ? ' ' + loadTimeData.getString('viewIframe') :
|
| + '');
|
| + link.textContent = label;
|
| + link.clickHandler = function(e) {
|
| + chrome.developerPrivate.openDevTools({
|
| + extensionId: extension.id,
|
| + renderProcessId: view.renderProcessId,
|
| + renderViewId: view.renderViewId,
|
| + incognito: view.incognito
|
| + });
|
| + };
|
| + link.addEventListener('click', link.clickHandler);
|
| +
|
| + if (i < extension.views.length - 1) {
|
| + link = link.cloneNode(true);
|
| + item.appendChild(link);
|
| + }
|
| +
|
| + wrapper.setupColumn('activeView', '.active-views a:last-of-type');
|
| });
|
| - };
|
| - link.addEventListener('click', link.clickHandler);
|
| -
|
| - if (i < extension.views.length - 1) {
|
| - link = link.cloneNode(true);
|
| - item.appendChild(link);
|
| - }
|
| -
|
| - wrapper.setupColumn('activeView', '.active-views a:last-of-type');
|
| - });
|
| - });
|
| + });
|
|
|
| // The extension warnings (describing runtime issues).
|
| - this.updateVisibility_(wrapper, '.extension-warnings',
|
| - extension.runtimeWarnings.length > 0,
|
| - function(item) {
|
| - var warningList = item.querySelector('ul');
|
| - warningList.textContent = '';
|
| - extension.runtimeWarnings.forEach(function(warning) {
|
| - var li = document.createElement('li');
|
| - warningList.appendChild(li).innerText = warning;
|
| - });
|
| - });
|
| + this.updateVisibility_(
|
| + wrapper, '.extension-warnings', extension.runtimeWarnings.length > 0,
|
| + function(item) {
|
| + var warningList = item.querySelector('ul');
|
| + warningList.textContent = '';
|
| + extension.runtimeWarnings.forEach(function(warning) {
|
| + var li = document.createElement('li');
|
| + warningList.appendChild(li).innerText = warning;
|
| + });
|
| + });
|
|
|
| // Install warnings.
|
| - this.updateVisibility_(wrapper, '.install-warnings',
|
| - extension.installWarnings.length > 0,
|
| - function(item) {
|
| - var installWarningList = item.querySelector('ul');
|
| - installWarningList.textContent = '';
|
| - if (extension.installWarnings) {
|
| - extension.installWarnings.forEach(function(warning) {
|
| - var li = document.createElement('li');
|
| - li.innerText = warning;
|
| - installWarningList.appendChild(li);
|
| + this.updateVisibility_(
|
| + wrapper, '.install-warnings', extension.installWarnings.length > 0,
|
| + function(item) {
|
| + var installWarningList = item.querySelector('ul');
|
| + installWarningList.textContent = '';
|
| + if (extension.installWarnings) {
|
| + extension.installWarnings.forEach(function(warning) {
|
| + var li = document.createElement('li');
|
| + li.innerText = warning;
|
| + installWarningList.appendChild(li);
|
| + });
|
| + }
|
| });
|
| - }
|
| - });
|
|
|
| if (location.hash.substr(1) == extension.id) {
|
| // Scroll beneath the fixed header so that the extension is not
|
| @@ -971,8 +975,8 @@ cr.define('extensions', function() {
|
| // Get the extension from the given id.
|
| var extension = this.extensions_.filter(function(extension) {
|
| return extension.state ==
|
| - chrome.developerPrivate.ExtensionState.ENABLED &&
|
| - extension.id == extensionId;
|
| + chrome.developerPrivate.ExtensionState.ENABLED &&
|
| + extension.id == extensionId;
|
| })[0];
|
|
|
| if (!extension)
|
| @@ -993,8 +997,8 @@ cr.define('extensions', function() {
|
| if (cr.ui.FocusOutlineManager.forDocument(document).visible)
|
| overlay.setInitialFocus();
|
| };
|
| - overlay.setExtensionAndShow(extensionId, extension.name,
|
| - extension.iconUrl, shownCallback);
|
| + overlay.setExtensionAndShow(
|
| + extensionId, extension.name, extension.iconUrl, shownCallback);
|
| this.optionsShown_ = true;
|
|
|
| var self = this;
|
|
|