| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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('extensions', function() { | 5 cr.define('extensions', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Clone a template within the extension error template collection. | 9 * Clone a template within the extension error template collection. |
| 10 * @param {string} templateName The class name of the template to clone. | 10 * @param {string} templateName The class name of the template to clone. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 div.__proto__ = ExtensionError.prototype; | 37 div.__proto__ = ExtensionError.prototype; |
| 38 div.decorate(error); | 38 div.decorate(error); |
| 39 return div; | 39 return div; |
| 40 } | 40 } |
| 41 | 41 |
| 42 ExtensionError.prototype = { | 42 ExtensionError.prototype = { |
| 43 __proto__: HTMLDivElement.prototype, | 43 __proto__: HTMLDivElement.prototype, |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * @param {RuntimeError} error | 46 * @param {RuntimeError} error |
| 47 * @override | |
| 48 */ | 47 */ |
| 49 decorate: function(error) { | 48 decorate: function(error) { |
| 50 // Add an additional class for the severity level. | 49 // Add an additional class for the severity level. |
| 51 if (error.level == 0) | 50 if (error.level == 0) |
| 52 this.classList.add('extension-error-severity-info'); | 51 this.classList.add('extension-error-severity-info'); |
| 53 else if (error.level == 1) | 52 else if (error.level == 1) |
| 54 this.classList.add('extension-error-severity-warning'); | 53 this.classList.add('extension-error-severity-warning'); |
| 55 else | 54 else |
| 56 this.classList.add('extension-error-severity-fatal'); | 55 this.classList.add('extension-error-severity-fatal'); |
| 57 | 56 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 /** | 101 /** |
| 103 * @private | 102 * @private |
| 104 * @const | 103 * @const |
| 105 * @type {number} | 104 * @type {number} |
| 106 */ | 105 */ |
| 107 ExtensionErrorList.MAX_ERRORS_TO_SHOW_ = 3; | 106 ExtensionErrorList.MAX_ERRORS_TO_SHOW_ = 3; |
| 108 | 107 |
| 109 ExtensionErrorList.prototype = { | 108 ExtensionErrorList.prototype = { |
| 110 __proto__: HTMLDivElement.prototype, | 109 __proto__: HTMLDivElement.prototype, |
| 111 | 110 |
| 112 /** @override */ | |
| 113 decorate: function() { | 111 decorate: function() { |
| 114 this.contents_ = this.querySelector('.extension-error-list-contents'); | 112 this.contents_ = this.querySelector('.extension-error-list-contents'); |
| 115 this.errors_.forEach(function(error) { | 113 this.errors_.forEach(function(error) { |
| 116 if (idIsValid(error.extensionId)) { | 114 if (idIsValid(error.extensionId)) { |
| 117 this.contents_.appendChild(document.createElement('li')).appendChild( | 115 this.contents_.appendChild(document.createElement('li')).appendChild( |
| 118 new ExtensionError(error)); | 116 new ExtensionError(error)); |
| 119 } | 117 } |
| 120 }, this); | 118 }, this); |
| 121 | 119 |
| 122 var numShowing = this.contents_.children.length; | 120 var numShowing = this.contents_.children.length; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 listContents.classList.add('deactivating'); | 161 listContents.classList.add('deactivating'); |
| 164 } | 162 } |
| 165 }.bind(this)); | 163 }.bind(this)); |
| 166 } | 164 } |
| 167 }; | 165 }; |
| 168 | 166 |
| 169 return { | 167 return { |
| 170 ExtensionErrorList: ExtensionErrorList | 168 ExtensionErrorList: ExtensionErrorList |
| 171 }; | 169 }; |
| 172 }); | 170 }); |
| OLD | NEW |