OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @constructor | 9 * @constructor |
10 * @implements {extensions.ErrorPageDelegate} | 10 * @implements {extensions.ErrorPageDelegate} |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 }, | 246 }, |
247 | 247 |
248 /** @override */ | 248 /** @override */ |
249 setProfileInDevMode: function(inDevMode) { | 249 setProfileInDevMode: function(inDevMode) { |
250 chrome.developerPrivate.updateProfileConfiguration( | 250 chrome.developerPrivate.updateProfileConfiguration( |
251 {inDeveloperMode: inDevMode}); | 251 {inDeveloperMode: inDevMode}); |
252 }, | 252 }, |
253 | 253 |
254 /** @override */ | 254 /** @override */ |
255 loadUnpacked: function() { | 255 loadUnpacked: function() { |
256 chrome.developerPrivate.loadUnpacked({failQuietly: true}, () => { | 256 chrome.developerPrivate.loadUnpacked( |
257 // TODO(devlin): Show the load error dialog if something went wrong. | 257 {failQuietly: true, populateError: true}, |
| 258 (loadError) => { |
| 259 if (chrome.runtime.lastError && |
| 260 chrome.runtime.lastError.message != |
| 261 'File selection was canceled.') { |
| 262 throw new Error(chrome.runtime.lastError.message); |
| 263 } |
| 264 if (loadError) { |
| 265 this.manager_.loadError.set('loadError', loadError); |
| 266 this.manager_.loadError.show(); |
| 267 } |
258 }); | 268 }); |
259 }, | 269 }, |
260 | 270 |
261 /** @override */ | 271 /** @override */ |
262 retryLoadUnpacked: function() { | 272 retryLoadUnpacked: function() { |
263 // TODO(devlin): Implement this. | 273 // TODO(devlin): Implement this. |
264 }, | 274 }, |
265 | 275 |
266 /** @override */ | 276 /** @override */ |
267 choosePackRootDirectory: function() { | 277 choosePackRootDirectory: function() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 resolve(code); | 313 resolve(code); |
304 }); | 314 }); |
305 }); | 315 }); |
306 }, | 316 }, |
307 }; | 317 }; |
308 | 318 |
309 cr.addSingletonGetter(Service); | 319 cr.addSingletonGetter(Service); |
310 | 320 |
311 return {Service: Service}; | 321 return {Service: Service}; |
312 }); | 322 }); |
OLD | NEW |