Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Construct an ExtensionLoadError around the given |div|. | 9 * Construct an ExtensionLoadError around the given |div|. |
| 10 * @param {HTMLDivElement} div The HTML div for the extension load error. | 10 * @param {HTMLDivElement} div The HTML div for the extension load error. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 */ | 30 */ |
| 31 this.path_ = this.querySelector('#extension-load-error-path'); | 31 this.path_ = this.querySelector('#extension-load-error-path'); |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * The element which displays the reason the extension failed to load. | 34 * The element which displays the reason the extension failed to load. |
| 35 * @type {HTMLSpanElement} | 35 * @type {HTMLSpanElement} |
| 36 * @private | 36 * @private |
| 37 */ | 37 */ |
| 38 this.reason_ = this.querySelector('#extension-load-error-reason'); | 38 this.reason_ = this.querySelector('#extension-load-error-reason'); |
| 39 | 39 |
| 40 this.additional_ = | |
|
Devlin
2014/06/27 22:31:08
comments.
gpdavis
2014/06/28 02:31:17
Done.
| |
| 41 this.querySelector('#extension-load-error-additional-list'); | |
| 42 | |
| 40 /** | 43 /** |
| 41 * The element which displays the manifest code. | 44 * The element which displays the manifest code. |
| 42 * @type {ExtensionCode} | 45 * @type {ExtensionCode} |
| 43 * @private | 46 * @private |
| 44 */ | 47 */ |
| 45 this.manifest_ = new extensions.ExtensionCode( | 48 this.manifest_ = new extensions.ExtensionCode( |
| 46 this.querySelector('#extension-load-error-manifest')); | 49 this.querySelector('#extension-load-error-manifest')); |
| 47 | 50 |
| 48 this.querySelector('#extension-load-error-retry-button').addEventListener( | 51 this.querySelector('#extension-load-error-retry-button').addEventListener( |
| 49 'click', function(e) { | 52 'click', function(e) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 68 this.reason_.textContent = reason; | 71 this.reason_.textContent = reason; |
| 69 | 72 |
| 70 manifest.message = reason; | 73 manifest.message = reason; |
| 71 this.manifest_.populate( | 74 this.manifest_.populate( |
| 72 manifest, | 75 manifest, |
| 73 loadTimeData.getString('extensionLoadCouldNotLoadManifest')); | 76 loadTimeData.getString('extensionLoadCouldNotLoadManifest')); |
| 74 this.hidden = false; | 77 this.hidden = false; |
| 75 this.manifest_.scrollToError(); | 78 this.manifest_.scrollToError(); |
| 76 }, | 79 }, |
| 77 | 80 |
| 81 showAdditional: function(failures) { | |
|
Devlin
2014/06/27 22:31:08
comments.
gpdavis
2014/06/28 02:31:17
Done.
| |
| 82 this.additional_.textContent = failures; | |
| 83 }, | |
| 84 | |
| 78 /** | 85 /** |
| 79 * Hide the extension load error. | 86 * Hide the extension load error. |
| 80 * @private | 87 * @private |
| 81 */ | 88 */ |
| 82 hide_: function() { | 89 hide_: function() { |
| 83 this.hidden = true; | 90 this.hidden = true; |
| 84 } | 91 } |
| 85 }; | 92 }; |
| 86 | 93 |
| 87 /** | 94 /** |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 115 * @param {string} filePath The path to the unpacked extension. | 122 * @param {string} filePath The path to the unpacked extension. |
| 116 * @param {string} reason The reason the extension failed to load. | 123 * @param {string} reason The reason the extension failed to load. |
| 117 * @param {Object} manifest An object with three strings: beforeHighlight, | 124 * @param {Object} manifest An object with three strings: beforeHighlight, |
| 118 * afterHighlight, and highlight. These represent three portions of the | 125 * afterHighlight, and highlight. These represent three portions of the |
| 119 * file's content to display - the portion which is most relevant and | 126 * file's content to display - the portion which is most relevant and |
| 120 * should be emphasized (highlight), and the parts both before and after | 127 * should be emphasized (highlight), and the parts both before and after |
| 121 * this portion. These may be empty. | 128 * this portion. These may be empty. |
| 122 */ | 129 */ |
| 123 notifyFailed: function(filePath, reason, manifest) { | 130 notifyFailed: function(filePath, reason, manifest) { |
| 124 this.loadError_.show(filePath, reason, manifest); | 131 this.loadError_.show(filePath, reason, manifest); |
| 132 }, | |
| 133 | |
| 134 notifyAdditionalFailures: function(failures) { | |
|
Devlin
2014/06/27 22:31:08
comments.
gpdavis
2014/06/28 02:31:17
Done.
| |
| 135 this.loadError_.showAdditional(failures); | |
| 125 } | 136 } |
| 126 }; | 137 }; |
| 127 | 138 |
| 128 /* | 139 /* |
| 129 * A static forwarding function for ExtensionLoader.notifyFailed. | 140 * A static forwarding function for ExtensionLoader.notifyFailed. |
| 130 * @param {string} filePath The path to the unpacked extension. | 141 * @param {string} filePath The path to the unpacked extension. |
| 131 * @param {string} reason The reason the extension failed to load. | 142 * @param {string} reason The reason the extension failed to load. |
| 132 * @param {Object} manifest The manifest of the failed extension. | 143 * @param {Object} manifest The manifest of the failed extension. |
| 133 * @see ExtensionLoader.notifyFailed | 144 * @see ExtensionLoader.notifyFailed |
| 134 */ | 145 */ |
| 135 ExtensionLoader.notifyLoadFailed = function(filePath, reason, manifest) { | 146 ExtensionLoader.notifyLoadFailed = function(filePath, reason, manifest) { |
| 136 ExtensionLoader.getInstance().notifyFailed(filePath, reason, manifest); | 147 ExtensionLoader.getInstance().notifyFailed(filePath, reason, manifest); |
| 137 }; | 148 }; |
| 138 | 149 |
| 150 ExtensionLoader.notifyAdditional = function(failures) { | |
|
Devlin
2014/06/27 22:31:08
comments.
gpdavis
2014/06/28 02:31:17
Done.
| |
| 151 ExtensionLoader.getInstance().notifyAdditionalFailures(failures); | |
| 152 }; | |
| 153 | |
| 139 return { | 154 return { |
| 140 ExtensionLoader: ExtensionLoader | 155 ExtensionLoader: ExtensionLoader |
| 141 }; | 156 }; |
| 142 }); | 157 }); |
| OLD | NEW |