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

Side by Side Diff: chrome/browser/resources/extensions/extension_loader.js

Issue 979453002: [Extensions] Make chrome://extensions use developerPrivate for unpacked loading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 */ 173 */
174 function ExtensionLoader() { 174 function ExtensionLoader() {
175 /** 175 /**
176 * The ExtensionLoadError to show any errors from loading an unpacked 176 * The ExtensionLoadError to show any errors from loading an unpacked
177 * extension. 177 * extension.
178 * @type {ExtensionLoadError} 178 * @type {ExtensionLoadError}
179 * @private 179 * @private
180 */ 180 */
181 this.loadError_ = new ExtensionLoadError( 181 this.loadError_ = new ExtensionLoadError(
182 /** @type {HTMLDivElement} */($('extension-load-error'))); 182 /** @type {HTMLDivElement} */($('extension-load-error')));
183
184 /**
185 * Whether or not we are currently loading an unpacked extension.
186 * @type {boolean}
187 * @private
Dan Beam 2015/03/03 23:37:03 nit: @private {boolean}
Devlin 2015/03/04 17:29:13 Done.
188 */
189 this.isLoading_ = false;
183 } 190 }
184 191
185 cr.addSingletonGetter(ExtensionLoader); 192 cr.addSingletonGetter(ExtensionLoader);
186 193
187 ExtensionLoader.prototype = { 194 ExtensionLoader.prototype = {
Dan Beam 2015/03/03 23:37:03 nit: put simple default in the prototype, e.g.
Devlin 2015/03/04 17:29:13 Done.
188 /** 195 /**
189 * Begin the sequence of loading an unpacked extension. If an error is 196 * Begin the sequence of loading an unpacked extension. If an error is
190 * encountered, this object will get notified via notifyFailed(). 197 * encountered, this object will get notified via notifyFailed().
191 */ 198 */
192 loadUnpacked: function() { 199 loadUnpacked: function() {
193 chrome.send('extensionLoaderLoadUnpacked'); 200 if (this.isLoading_) // Only one running load at a time.
201 return;
202 this.isLoading_ = true;
203 chrome.developerPrivate.loadUnpacked({failQuietly: true}, function() {
204 // Check lastError to avoid the log, but don't do anything with it -
205 // error-handling is done on the C++ side.
206 var lastError = chrome.runtime.lastError;
Dan Beam 2015/03/03 23:37:03 :(
Devlin 2015/03/04 17:29:13 Yeah :/
207 this.isLoading_ = false;
208 }.bind(this));
194 }, 209 },
195 210
196 /** 211 /**
197 * Notify the ExtensionLoader that loading an unpacked extension failed. 212 * Notify the ExtensionLoader that loading an unpacked extension failed.
198 * Add the failure to failures_ and show the ExtensionLoadError. 213 * Add the failure to failures_ and show the ExtensionLoadError.
199 * @param {Array<Object>} failures Array of failures containing paths, 214 * @param {Array<Object>} failures Array of failures containing paths,
200 * errors, and manifests. 215 * errors, and manifests.
201 */ 216 */
202 notifyFailed: function(failures) { 217 notifyFailed: function(failures) {
203 this.loadError_.add_(failures); 218 this.loadError_.add_(failures);
204 }, 219 },
205 }; 220 };
206 221
207 /** 222 /**
208 * A static forwarding function for ExtensionLoader.notifyFailed. 223 * A static forwarding function for ExtensionLoader.notifyFailed.
209 * @param {Array<Object>} failures Array of failures containing paths, 224 * @param {Array<Object>} failures Array of failures containing paths,
210 * errors, and manifests. 225 * errors, and manifests.
211 * @see ExtensionLoader.notifyFailed 226 * @see ExtensionLoader.notifyFailed
212 */ 227 */
213 ExtensionLoader.notifyLoadFailed = function(failures) { 228 ExtensionLoader.notifyLoadFailed = function(failures) {
214 ExtensionLoader.getInstance().notifyFailed(failures); 229 ExtensionLoader.getInstance().notifyFailed(failures);
215 }; 230 };
216 231
217 return { 232 return {
218 ExtensionLoader: ExtensionLoader 233 ExtensionLoader: ExtensionLoader
219 }; 234 };
220 }); 235 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698