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

Unified Diff: chrome/browser/resources/extensions/extension_list.js

Issue 1016413004: [Extensions] Update Error Console UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
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 fe1cec3976b0da7f2f2fa13f2178b37c6cc06544..c8871bec2bb2dbd721f272b4d2d5d6469999f00d 100644
--- a/chrome/browser/resources/extensions/extension_list.js
+++ b/chrome/browser/resources/extensions/extension_list.js
@@ -245,6 +245,7 @@ cr.define('extensions', function() {
case EventType.LOADED:
case EventType.UNLOADED:
case EventType.ERROR_ADDED:
+ case EventType.ERRORS_REMOVED:
case EventType.PREFS_CHANGED:
if (eventData.extensionInfo)
this.updateExtension_(eventData.extensionInfo);
@@ -488,6 +489,18 @@ cr.define('extensions', function() {
chrome.management.launchApp(extension.id);
});
+ row.setupColumn('.errors-link', 'errors', 'click', function(e) {
+ var extensionId = extension.id;
+ assert(this.extensions_.length > 0);
+ 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) {
@@ -688,6 +701,30 @@ cr.define('extensions', function() {
isUnpacked && extension.type ==
chrome.developerPrivate.ExtensionType.PLATFORM_APP);
+ // The 'Errors' link.
+ var hasErrors = extension.runtimeErrors.length ||
+ extension.manifestErrors.length;
+ this.updateVisibility_(row, '.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 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;
@@ -873,15 +910,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,
@@ -941,38 +969,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.

Powered by Google App Engine
This is Rietveld 408576698