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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 chrome.developerPrivate.onItemStateChanged.addListener( | 43 chrome.developerPrivate.onItemStateChanged.addListener( |
44 this.onItemStateChanged_.bind(this)); | 44 this.onItemStateChanged_.bind(this)); |
45 chrome.developerPrivate.getExtensionsInfo( | 45 chrome.developerPrivate.getExtensionsInfo( |
46 {includeDisabled: true, includeTerminated: true}, | 46 {includeDisabled: true, includeTerminated: true}, |
47 function(extensions) { | 47 function(extensions) { |
48 /** @private {Array<chrome.developerPrivate.ExtensionInfo>} */ | 48 /** @private {Array<chrome.developerPrivate.ExtensionInfo>} */ |
49 this.extensions_ = extensions; | 49 this.extensions_ = extensions; |
50 for (let extension of extensions) | 50 for (let extension of extensions) |
51 this.manager_.addItem(extension); | 51 this.manager_.addItem(extension); |
52 | 52 |
53 var id = new URLSearchParams(location.search).get('id'); | 53 this.manager_.initPage(); |
54 if (id) { | |
55 var data = this.extensions_.find(function(e) { | |
56 return e.id == id; | |
57 }); | |
58 if (data) | |
59 this.manager_.showItemDetails(data); | |
60 } | |
61 }.bind(this)); | 54 }.bind(this)); |
62 chrome.developerPrivate.getProfileConfiguration( | 55 chrome.developerPrivate.getProfileConfiguration( |
63 this.onProfileStateChanged_.bind(this)); | 56 this.onProfileStateChanged_.bind(this)); |
64 }, | 57 }, |
65 | 58 |
66 /** | 59 /** |
67 * @param {chrome.developerPrivate.ProfileInfo} profileInfo | 60 * @param {chrome.developerPrivate.ProfileInfo} profileInfo |
68 * @private | 61 * @private |
69 */ | 62 */ |
70 onProfileStateChanged_: function(profileInfo) { | 63 onProfileStateChanged_: function(profileInfo) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 chrome.developerPrivate.reload(id, {failQuietly: false}); | 243 chrome.developerPrivate.reload(id, {failQuietly: false}); |
251 }, | 244 }, |
252 | 245 |
253 /** @override */ | 246 /** @override */ |
254 repairItem: function(id) { | 247 repairItem: function(id) { |
255 chrome.developerPrivate.repairExtension(id); | 248 chrome.developerPrivate.repairExtension(id); |
256 }, | 249 }, |
257 | 250 |
258 /** @override */ | 251 /** @override */ |
259 showItemOptionsPage: function(id) { | 252 showItemOptionsPage: function(id) { |
260 var extension = this.extensions_.find(function(extension) { | 253 var extension = this.extensions_.find(function(e) { |
261 return extension.id == id; | 254 return e.id == id; |
262 }); | 255 }); |
263 assert(extension && extension.optionsPage); | 256 assert(extension && extension.optionsPage); |
264 if (extension.optionsPage.openInTab) | 257 if (extension.optionsPage.openInTab) { |
265 chrome.developerPrivate.showOptions(id); | 258 chrome.developerPrivate.showOptions(id); |
266 else | 259 } else { |
267 this.manager_.optionsDialog.show(extension); | 260 this.manager_.changePage( |
| 261 {page: Page.DETAILS, subpage: Dialog.OPTIONS, extensionId: id}); |
| 262 } |
268 }, | 263 }, |
269 | 264 |
270 /** @override */ | 265 /** @override */ |
271 setProfileInDevMode: function(inDevMode) { | 266 setProfileInDevMode: function(inDevMode) { |
272 chrome.developerPrivate.updateProfileConfiguration( | 267 chrome.developerPrivate.updateProfileConfiguration( |
273 {inDeveloperMode: inDevMode}); | 268 {inDeveloperMode: inDevMode}); |
274 }, | 269 }, |
275 | 270 |
276 /** @override */ | 271 /** @override */ |
277 loadUnpacked: function() { | 272 loadUnpacked: function() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 resolve(code); | 318 resolve(code); |
324 }); | 319 }); |
325 }); | 320 }); |
326 }, | 321 }, |
327 }; | 322 }; |
328 | 323 |
329 cr.addSingletonGetter(Service); | 324 cr.addSingletonGetter(Service); |
330 | 325 |
331 return {Service: Service}; | 326 return {Service: Service}; |
332 }); | 327 }); |
OLD | NEW |