| 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 70fbb2f08a4676be8ed43e015ad96c5460738e0e..a394785b93ba673a12b155d9aef39c82a4e73bb9 100644
|
| --- a/chrome/browser/resources/extensions/extension_list.js
|
| +++ b/chrome/browser/resources/extensions/extension_list.js
|
| @@ -148,6 +148,8 @@ cr.define('extensions', function() {
|
| div.__proto__ = ExtensionList.prototype;
|
| /** @private {!Array<ExtensionInfo>} */
|
| div.extensions_ = [];
|
| + chrome.developerPrivate.onItemStateChanged.addListener(
|
| + div.onItemStateChanged_.bind(div));
|
| return div;
|
| }
|
|
|
| @@ -448,6 +450,17 @@ cr.define('extensions', function() {
|
| chrome.send('extensionSettingsLaunch', [extension.id]);
|
| });
|
|
|
| + row.setupColumn('.errors-link', 'errors', 'click', function(e) {
|
| + var extensionId = extension.id;
|
| + var newEx = this.extensions_.filter(function(e) {
|
| + return e.state == chrome.developerPrivate.ExtensionState.ENABLED &&
|
| + e.id == extensionId;
|
| + })[0];
|
| + var errors = newEx.manifestErrors.concat(newEx.runtimeErrors);
|
| + extensions.ExtensionErrorOverlay.getInstance().setErrorsAndShowOverlay(
|
| + errors, extensionId, newEx.name);
|
| + }.bind(this));
|
| +
|
| // The 'Reload' terminated link.
|
| row.setupColumn('.terminated-reload-link', 'terminatedReload', 'click',
|
| function(e) {
|
| @@ -648,6 +661,31 @@ cr.define('extensions', function() {
|
| isUnpacked && extension.type ==
|
| chrome.developerPrivate.ExtensionType.PLATFORM_APP);
|
|
|
| + // The 'Errors' link.
|
| + this.updateVisibility_(
|
| + row, '.errors-link',
|
| + extension.runtimeErrors.length > 0 ||
|
| + extension.manifestErrors.length > 0,
|
| + 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 highSeverity = 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');
|
| + icon.className = 'extension-error-icon';
|
| + icon.classList.add(map[highSeverity].name);
|
| + });
|
| +
|
| // The 'Reload' terminated link.
|
| var isTerminated =
|
| extension.state == chrome.developerPrivate.ExtensionState.TERMINATED;
|
| @@ -826,15 +864,6 @@ cr.define('extensions', function() {
|
| });
|
| });
|
|
|
| - // If the ErrorConsole is enabled, we should have manifest and/or runtime
|
| - // errors. Otherwise, we may have install warnings. We should not have
|
| - // both ErrorConsole errors and install warnings.
|
| - // Errors.
|
| - this.updateErrors_(row.querySelector('.manifest-errors'),
|
| - 'dev-manifestErrors', extension.manifestErrors);
|
| - this.updateErrors_(row.querySelector('.runtime-errors'),
|
| - 'dev-runtimeErrors', extension.runtimeErrors);
|
| -
|
| // Install warnings.
|
| this.updateVisibility_(row, '.install-warnings',
|
| extension.installWarnings.length > 0,
|
| @@ -894,38 +923,6 @@ cr.define('extensions', function() {
|
| },
|
|
|
| /**
|
| - * Updates an element to show a list of errors.
|
| - * @param {Element} panel An element to hold the errors.
|
| - * @param {string} columnType A tag used to identify the column when
|
| - * changing focus.
|
| - * @param {Array<RuntimeError|ManifestError>|undefined} errors The errors
|
| - * to be displayed.
|
| - * @private
|
| - */
|
| - updateErrors_: function(panel, columnType, errors) {
|
| - // TODO(hcarmona): Look into updating the ExtensionErrorList rather than
|
| - // rebuilding it every time.
|
| - panel.hidden = !errors || errors.length == 0;
|
| - panel.textContent = '';
|
| -
|
| - if (panel.hidden)
|
| - return;
|
| -
|
| - var errorList =
|
| - new extensions.ExtensionErrorList(assertInstanceof(errors, Array));
|
| -
|
| - panel.appendChild(errorList);
|
| -
|
| - var list = errorList.getErrorListElement();
|
| - if (list)
|
| - list.setAttribute('column-type', columnType + 'list');
|
| -
|
| - var button = errorList.getToggleElement();
|
| - if (button)
|
| - button.setAttribute('column-type', columnType + 'button');
|
| - },
|
| -
|
| - /**
|
| * Opens the extension options overlay for the extension with the given id.
|
| * @param {string} extensionId The id of extension whose options page should
|
| * be displayed.
|
| @@ -975,6 +972,24 @@ cr.define('extensions', function() {
|
| // after its showing animation? Makes very little sense to me.
|
| overlay.setInitialFocus();
|
| },
|
| +
|
| + /**
|
| + * Handle an extension changing. Currently this only checks when errors are
|
| + * deleted.
|
| + * @param {EventData} e The event data for the extension change.
|
| + * @private
|
| + */
|
| + onItemStateChanged_: function(e) {
|
| + // TODO(devlin): We should be doing this for far more than just
|
| + // ERRORS_REMOVED, instead of re-generating all extension data whenever
|
| + // anything happens.
|
| + if (e.event_type == chrome.developerPrivate.EventType.ERRORS_REMOVED &&
|
| + e.info) {
|
| + var node = /** @type {ExtensionFocusRow} */($(e.info.id));
|
| + if (node)
|
| + this.updateNode_(e.info, node);
|
| + }
|
| + },
|
| };
|
|
|
| return {
|
|
|